I currently to use the Interactive Brokers Web API: https://www.interactivebrokers.com/campus/ibkr-api-page/cpapi-v1/#introduction
I get some difficulty to place orders, even if I manage perfectly to get the endpoints. No matter what I try, included the example from the official doc: https://ibkrcampus.com/ibkr-api-page/cpapi-v1/#place-order, I get an error 500: internal server error
Here is my code:
>>> data {'orders': [{'conid': 136155102, 'orderType': 'MKT', 'quantity': 1, 'side': 'BUY'}]}>>> url 'https://localhost:5005/v1/api/iserver/account/XXXXXX/orders'>>> response = requests.post(url, data=data, verify=False)>>> response.raise_for_status() raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://localhost:5005/v1/api/iserver/account/XXXXXX/orders
I tried also to specify the acctID in the body but I get the same result. I will keep testing in the coming days, in case this is an issue coming directly from the server -- what I doubt.
I get the same error when I try another endpoints requiring POST method, so I believe I miss something on my headers.
Please note that Im currently trying with a paper account.