ibind icon indicating copy to clipboard operation
ibind copied to clipboard

Historical data via WebSocket: 5 streams limitation

Open art1c0 opened this issue 8 months ago • 5 comments

This is more of a question than an issue, feel free to remove if it's not useful.

At the time of working with IBKR WebSocket I've found that there's a limit of 5 simultaneous streams of historical data. However it's not completely clear: 5 per single connection, or 5 separate connections in total (one stream per connection)?

For instance, for market data it's possible to subscribe for a few streams using single connection. It does not seem to be the case for historical though... When I subscribe to a second stream, data for the first one stops arriving. So I'm just wondering: is it by design or I'm doing something wrong?

Also is this limit of 5 hard or also depends on market data lines as other subscription types?

And if I'd like to get both market and historical data - I have to open 2 WebSocket connections? The same goes for other topics such as account summary, live orders, etc.

Please share your experience in this field.

art1c0 avatar Apr 28 '25 10:04 art1c0

hey @art1c0 thanks for these questions - did you try contacting IBKR support regarding this?

My understanding is that 5 is the total limit of connections you can have at a time, but I never verified this. In general the market history websocket doesn't make sense to me, I'd probably suggest using the market data one instead.

Voyz avatar May 01 '25 11:05 Voyz

Hi @Voyz, yes I'm currently in touch with IBKR on this matter, it's a bit confusing so far but I don't lose my hope :)

Actually I expected historical websocket to be equivalent of TWS reqHistoricalData, but it doesn't seem to be like that. It just spits out bunch of (historical) bars on connect and after that it produces incomplete or corrupt data that doesn't make any sense. So for now I build bars from market data using last price/size, that has its own downsides.

For instance, I need trade volume and I calculate it summarising last size amounts, but it seems to be incorrect as this sum is much larger than volume found in bars returned by reqHistoricalData. Do you have any experience with that by the way?

art1c0 avatar May 02 '25 11:05 art1c0

Ok, don't quote me on this but I remember talking to IBKR about this one day and they've mentioned something along the lines of: Market Data is sending partial data as it arrives, then once every now and then it sends a 'complete' update. Therefore, these incomplete messages are more like 'correction', while the message with all fields present is more like a full message. Try filtering based on this condition and only sum up 'full' messages, see if the volumes match then? As always, probably talking to them about this would be a good idea 👍

Voyz avatar May 02 '25 11:05 Voyz

Well, there's some update: after a few iterations finally I got this message from IBKR support: The system accepts up to five contracts in a single request. However, each contract is processed individually before it will interact with another. Don't ask me what that actually means, but the fact is that only one contract data is being sent at a time, and tests prove that. Not sure what the reason to subscribe to 5 contracts in this case, but it is what it is...

art1c0 avatar May 10 '25 06:05 art1c0

Gotcha, thanks for reporting back! And Market Data topic? Any luck there?

Voyz avatar May 12 '25 08:05 Voyz

I'm going to close this due to inactivity. Thanks for the contribution so far, feel free to let me know if you'd like it reopen and continue the discussion 👍

Voyz avatar Jun 23 '25 11:06 Voyz