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

Reset cached orderbook when new orderbook is a snapshot #844

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

v36u
Copy link
Contributor

@v36u v36u commented Sep 26, 2024

This idea came while looking over Bybit's API:

Once you have subscribed successfully, you will receive a snapshot. The WebSocket will keep pushing delta messages every time the orderbook changes. If you receive a new snapshot message, you will have to reset your local orderbook. If there is a problem on Bybit's end, a snapshot will be re-sent, which is guaranteed to contain the latest data.

https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook#process-snapshotdelta

It seems like common sense to reset the old orderbook when the new one is a full one. Also, the impact would be very reduced because the only ones that set IsFromSnapshot to true are Bybit and KuCoin.

I've also updated the readme to reflect that Bybit and KuCoin have orderbook websockets implemented.

@vslee vslee merged commit 3f24f4b into DigitalRuby:main Sep 26, 2024
1 of 3 checks passed
@v36u v36u deleted the reset-orderbook-when-snapshot branch September 28, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants