ibind icon indicating copy to clipboard operation
ibind copied to clipboard

live_orders() and 'filters' performance

Open zacciep opened this issue 1 year ago • 2 comments

When using filters and the live_orders() method I am getting incomplete results. I have tried this across a variety of filter configurations. It appears that IBKR gateway is not returning the complete results when a filter request is made (I cannot see anywhere in IBind that may be further filtering the response). I have resorted to getting all orders and post filtering myself (hoping that this is more reliable).

In addition I often seem to get inconsistent responses on the first call or two to this function (and similarly with other interface functions such as live_marketdata_snapshot). The server seems to need some time to "warm up"!? Not entirely repeatable, so hard to pinpoint the issue.

zacciep avatar Jun 25 '24 16:06 zacciep

I've been seeing similar results on my end. I think that they have some type of caching on their end that isn't updated when it needs to. I spoke to IBKR support about it but since this is really hard to replicate we didn't get far. It has stopped happening to me for some time hence I assumed it has been solved; I'm sad to see it still an issue.

I'd suggest you raise this with IBKR support to in order for them to have more datapoints.

And to clarify - indeed IBind is not filtering these results in any way.

Voyz avatar Jun 26 '24 06:06 Voyz

Same behavior for me. My current approach may seem awkward, but it seems to return a consistent result. If you know a better solution, please write here.

My approach is:

  1. Request "orders" endpoint with desirable "filters" and "force=true". This resets cache on server side and returns an empty list, which is ok.

  2. Wait for N seconds not to abuse IB's pacing limitation. Not sure what number goes best here. In my case, I use 5, as the "Pacing Limitation" section says "1 req/5 secs" for orders endpoint: https://ibkrcampus.com/ibkr-api-page/cpapi-v1/#pacing-limitations

But for fast strategies that might be unacceptable

  1. Re-request "orders" endpoint with the same "filters" as on step 1, but W/O "force". This returns fresh order list

zdytch avatar Jul 11 '24 16:07 zdytch

I'm going to close this issue due to inactivity. Thanks for your contribution and please feel free to request a reopen if you'd like to continue the discussion 👍

Voyz avatar Oct 30 '24 12:10 Voyz