-
Notifications
You must be signed in to change notification settings - Fork 77
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
Websocket stream skips messages #53
Comments
After investigating I noticed that I start to exceed the https://developers.binance.com/docs/derivatives/portfolio-margin-pro#websocket-limits If I understand correctly, then I have no more than 200 streams per connection, i.e. I do not violate this point?
Most likely, this is the limit
But I don't really understand when I violate it. Even if there is a ping, pong and creation of subscriptions (with an interval of 0.5 seconds) during one second - there will be a maximum of 4 messages per second (but keepAlive disabled by deafaut). |
Also this code on the Python (library — https://github.com/binance/binance-futures-connector-python) work fine for me with the same pairs and intervals (with timeout 0.2 sec between subscriptions creation) intervals = ['1h', '4h', '1d', '1w', '1M']
for interval in intervals:
for pair_chunk in chunks(pairs, 200):
manager = UMFuturesWebsocketClient(
stream_url="wss://fstream.binance.com",
on_message=g
)
for pair in pair_chunk:
manager.continuous_kline(pair=pair, contractType='perpetual', interval=interval, id=uuid.uuid4().hex)
time.sleep(0.2) Upd: It seems that the problem is with my IP address. When I connect via VPN in the go service - everything is ok. It's strange, why then everything works correctly in python? |
Hello. I was looking for a library that would implement websockets functionality. I decided to stop at yours, but since it does not work with futures, I decided to improve its functionality (also, I want to process messages in separate goroutines). During testing, I encountered the following problem.
I have 372 symbols. For each of them, I subscribe to 5 intervals (1h, 4h, 1d, 1w, 1M). As far as I know, Binance does not allow subscribing to more than 200 symbols per stream. Therefore, I made a small method that breaks symbols into chunks.
Also, I create a new stream each time for the interval-chunk.
But, I see that some data is skipped for 1w and 1M.
If I reduce the number of intervals (for example, to 3) or reduce the number of symbols, for example, to 50 - all data comes correctly.
Any ideas why this is happening and how it can be handled?
My Websocket client implementation
The text was updated successfully, but these errors were encountered: