Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key error on placing order #10

Closed
freekeys opened this issue Feb 16, 2023 · 7 comments
Closed

Key error on placing order #10

freekeys opened this issue Feb 16, 2023 · 7 comments

Comments

@freekeys
Copy link

freekeys commented Feb 16, 2023

Hi, when I try to create an order I'm getting this message (not always). It's something to do with how it's handling the response during the "reply all" flow (if the response has no position 0). Any thoughts please? Thanks!

placing order for AAPL
Traceback (most recent call last):
  File "/home/xxx/minute_screener_update_dev.py", line 660, in create_order
    response = api.submit_orders(orders, True)
  File "/home/xxx/.local/lib/python3.9/site-packages/easyib/easyib.py", line 191, in submit_orders
    return self._reply_all_yes(response, reply_yes)
  File "/home/xxx/.local/lib/python3.9/site-packages/easyib/easyib.py", line 167, in _reply_all_yes
    dic = response.json()[0]
KeyError: 0

@utilmon
Copy link
Owner

utilmon commented Feb 16, 2023

Hi,

It seems you are getting an empty response from the order submit request. Are other functions working fine, for example get_account()?

@freekeys
Copy link
Author

Thanks for your quick response. Since I posted this I've tried a couple of things. When I use the same code to trade AAPL (rather than BABL and others which I'm experiencing the error on) it works fine.

When I try to trade BABL via the IBKR app I get the following message: "No Trading Permission, Customer Ineligible; Ineligibility reasons:
Only closing orders are permitted in this instrument.". Any idea what this means? I guess this is what's causing the problem. Shouldn't this message come through via the Api to easyib rather than it being blank?

@utilmon
Copy link
Owner

utilmon commented Feb 16, 2023

I see. According to the error message, the response from the server is empty. I will look into if there are ways to get the warning message printed out.

@freekeys
Copy link
Author

Thanks so much! I've also raised a ticket with IBKR to find out why I'm getting the error

@eolszewski
Copy link

I have had this same issue when submitting multiple orders. I get no error when the list contains only one order, however. No clue why this is, the error I get back is a blank string...

@binxuan
Copy link

binxuan commented Feb 21, 2023

I am having the same issue. My account is IBKR lite. Does the account type matter?

@utilmon
Copy link
Owner

utilmon commented Feb 21, 2023

Interactive Broker must have updated their policy. See Jan 2023 update at https://interactivebrokers.github.io/cpwebapi/changelog. I am also having a similar problem when submitting an order. I get a "not authenticated" error. For now, I added an assertion error line that will spit out the correct error statement. However, I feel the ultimate cause of the issue is interconnected with the authentication server somehow (in my case ibeam).

@utilmon utilmon closed this as completed Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants