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

Reply ID not found #35

Open
outrageousinc-dev opened this issue Dec 17, 2024 · 11 comments
Open

Reply ID not found #35

outrageousinc-dev opened this issue Dec 17, 2024 · 11 comments
Assignees

Comments

@outrageousinc-dev
Copy link

Hi there!

I'm using ibeam and ibind with the ibkr API. I keep getting this error when placing orders:

ibind.support.errors.ExternalBrokerError: IbkrClient: response error Result(data=None, request={'url': 'https://ibkr-gateway.agent.local:5000/v1/api/iserver/reply/7adec048-1dd9-42d6-bcf0-e52698293303', 'json': {'confirmed': True}}) :: 400 :: Bad Request :: 
{
    "error": "reply id not found: '7adec048-1dd9-42d6-bcf0-e52698293303'"
}

Any idea why this could be?

in

File "/usr/local/lib/python3.11/site-packages/ibind/base/rest_client.py", line 189, in _process_response
raise ExternalBrokerError(f'{self}: response error {result} :: {response.status_code} :: {response.reason} :: {response.text}', status_code=response.status_code) from e

Thanks in advance, and have a great day! :)

@Voyz
Copy link
Owner

Voyz commented Dec 18, 2024

Hey @outrageousinc-dev thanks for trying out IBeam and IBind and reporting your issue 👍

This error indicates that in the order placement question/answer exchange your client has encountered a situation in which giving an answer to a question was not recognised by IBKR's servers.

It is quite strange, as this answer ID (what you see after reply) is read directly from the question we've received.

Does this happen to you every time you submit an order? Was this only one instance?

@Voyz Voyz self-assigned this Dec 18, 2024
@ChienHsiao
Copy link

I encountered the same situation and I'm not sure if it's related to the fact that I'm running multi-threaded trading.

@Voyz
Copy link
Owner

Voyz commented Jan 15, 2025

@ChienHsiao can you provide more info? Multi threaded was fine, but were you submitting multiple orders at the same time?

@ChienHsiao
Copy link

Yes, I did submit multiple orders at the same time, but after I ensured that only one order was submitted at a time, I no longer received the same error.

@Voyz
Copy link
Owner

Voyz commented Jan 15, 2025

Okay, that must be it then - submitting multiple orders at the same time. Which makes sense, the replies get mixed up. I should add this limit to the library itself though, thanks for pointing it out 👍

@Voyz
Copy link
Owner

Voyz commented Jan 29, 2025

@ChienHsiao please see ibind[oauth]==0.1.11-rc1 for a version which only allows submitting one order at a time. Let me know if it works as expected 👍

@ChienHsiao
Copy link

@Voyz After testing with the paper account, everything is running smoothly. By the way, I really appreciate you providing the ibind and ibeam packages—they've played a huge role in the rapid growth of my business.

@Voyz
Copy link
Owner

Voyz commented Jan 30, 2025

Superb @ChienHsiao happy to hear 👏 And thanks for the kind words, I'm happy to hear it helps!

@weklund
Copy link

weklund commented Feb 11, 2025

I just ran into this issue! :D Perfect timing. I'll get the latest release and see if that resolves it for me too.

For my use case, I have to get the price the parent order was filled at (I'd like for my parent order to be MKT) before I know where to set my stop loss and take profit orders. Meaning I don't think I can use the order bracket method here.

When we say "submitting one order at a time", we are saying we have to place an order, wait for it to get filled, then place another? Is there potentially an eventually consistent issue with IBKR? Because I believe my parent order was filled, or else how would I have gotten the filled price? Not sure how I would still get this reply id error then 🤔

@Voyz
Copy link
Owner

Voyz commented Feb 12, 2025

Yeah, sending separate orders sounds like a safer choice @weklund 👍

When we say "submitting one order at a time", we are saying we have to place an order, wait for it to get filled, then place another?

Just placing. The order can be on the exchange unfilled while you're already submitting the next one. So, the moment ibkr_client.place_order returns you should be able to place another one.

Is there potentially an eventually consistent issue with IBKR? Because I believe my parent order was filled, or else how would I have gotten the filled price? Not sure how I would still get this reply id error then 🤔

Sorry, I'm not sure I'm following here. Can you explain exactly what were you trying to do and what happened? If you get a filled price then yes, the order got either partially or fully filled, meaning that you should already be able to place more orders. Not sure if you can specify an existing order as a parent though, it could be that the parenting only works for placing multiple orders at the same time (eg. bracket orders).

@weklund
Copy link

weklund commented Feb 12, 2025

Sorry I meant I was just referring to my 1st order.

It's just odd that I would experience this issue on a 2nd order, when I was able to successfully get the fill price on the 1st. I'll follow up with logs here in a bit.

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