Extended Hour API

Hi There,

When I am using extended_hours to true in python, I am seeing below error.

can you please show what is wrong here?

temp_buy_order_outcome = api.submit_order(
symbol=‘MSFT’,
qty=1,
side=‘buy’,
type=‘limit’,
time_in_force=‘day’,
extended_hours=‘true’,
limit_price=205.5)
Traceback (most recent call last):

File “C:\Users\Administrator\anaconda3\lib\site-packages\alpaca_trade_api\rest.py”, line 136, in _one_request
resp.raise_for_status()

File “C:\Users\Administrator\anaconda3\lib\site-packages\requests\models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)

HTTPError: 400 Client Error: Bad Request for url: https://api.alpaca.markets/v2/orders

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “”, line 8, in
limit_price=205.5)

File “C:\Users\Administrator\anaconda3\lib\site-packages\alpaca_trade_api\rest.py”, line 249, in submit_order
resp = self.post(’/orders’, params)

File “C:\Users\Administrator\anaconda3\lib\site-packages\alpaca_trade_api\rest.py”, line 155, in post
return self._request(‘POST’, path, data)

File “C:\Users\Administrator\anaconda3\lib\site-packages\alpaca_trade_api\rest.py”, line 115, in _request
return self._one_request(method, url, opts, retry)

File “C:\Users\Administrator\anaconda3\lib\site-packages\alpaca_trade_api\rest.py”, line 144, in _one_request
raise APIError(error, http_error)

APIError: request body format is invalid

@Nick_Peter, not sure if you’ve overcome this issue indicated above, but can you try using a boolean (True) – not a string?

Thanks a lot for your reply. Your suggestion helped me.

Thanks again.

Best regards