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

Fix Kraken WS orderbook updates and add checksum support #626

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

jdx-john
Copy link
Contributor

The existing Kraken implementation for order-book updates is incorrect. It assumes each update will include either one "a" or one "b" block and that the message contains exactly 5 elements.
In most cases this is the case however the API can and sometimes does send both an "a" and "b" block in the same message. I have verified this myself with a live feed (examples are is also shown in the API docs) and in this case the behavior is faulty. The market symbol is read wrongly and the whole message will therefore get missed leading to order-book mismatch locally.

My change follows the spec more accurately and also adds support for Kraken's checksum property (https://docs.kraken.com/websockets/#book-checksum). I do not know if other exchanges provide this but it is vital to ensure your local order book is correct in case of missed messages. I have implemented the simplest possible API change for ExchangeOrderBook.Checksum which could be used by other exchange implementations if desired.

@jdx-john
Copy link
Contributor Author

Assuming this gets accepted I'll add an implementation of the Kraken checksum as a utility method on ExchangeKrakenApi, linked to #624

@vslee vslee merged commit 6f249be into DigitalRuby:master Aug 12, 2021
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