-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Hello, first of all thanks you for this library, I know my problem might not be related to the library directly but as I can't find any answer anywhere, I will try here.
When I try to create an order on a demo account using the following code:
conid = 265598
side = 'BUY'
size = 1
order_type = 'MKT'
order_tag = f'my_order-{datetime.datetime.now().strftime("%Y%m%d%H%M%S")}'
order_request = OrderRequest(conid=conid, side=side, quantity=size, order_type=order_type, acct_id="DUH724521", coid=order_tag)
answers = {
QuestionType.PRICE_PERCENTAGE_CONSTRAINT: True,
QuestionType.ORDER_VALUE_LIMIT: True,
'Unforeseen new question': True,
}
order_response = client.place_order(order_request, answers=answers).data
print(order_response)
I get the following error:
ibind.support.errors.ExternalBrokerError: IbkrClient: response error Result(data=None, request={'url': 'https://api.ibkr.com/v1/api/iserver/account/DUH724521/orders', 'json': {'orders': [{'conid': 265598, 'side': 'BUY', 'quantity': 1, 'orderType': 'MKT', 'acctId': 'DUH724521', 'cOID': 'my_order-20250711074428', 'tif': 'GTC'}]}}) :: 400 :: Bad Request :: {"error":"Bad Request: accountId is not valid: DUH724521","statusCode":400}
However, while placing order is not working, I can successfully fetch my account balance without problem.
I got my account ID in the "Account Parameters" tab, since I can fetch my balance, I assume the problem doesn't come from here, but I may be wrong.

Note that I am using a DEMO account, however as I mentioned, other features such as balance fetching are working and I am able to trade on the live interface.
Any help is much appreciated, have a good day!
Metadata
Metadata
Assignees
Labels
No labels