Skip to content

Historical data via WebSocket: 5 streams limitation #100

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

Open
art1c0 opened this issue Apr 28, 2025 · 4 comments
Open

Historical data via WebSocket: 5 streams limitation #100

art1c0 opened this issue Apr 28, 2025 · 4 comments

Comments

@art1c0
Copy link

art1c0 commented Apr 28, 2025

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.

@Voyz
Copy link
Owner

Voyz commented May 1, 2025

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.

@art1c0
Copy link
Author

art1c0 commented May 2, 2025

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?

@Voyz
Copy link
Owner

Voyz commented May 2, 2025

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 👍

@art1c0
Copy link
Author

art1c0 commented May 10, 2025

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...

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

2 participants