bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.19k stars 679 forks source link

Order Book Sequence Number Validation #285

Closed bmoscon closed 3 years ago

bmoscon commented 4 years ago

Some exchanges support methods for ensuring no messages were lost, some do not. This is especially important for exchanges that supply only orderbook updates. All exchanges need to be re-checked to see if this support exists or not, and to validate that the existing code validates correctly (assuming said code exists):

bmoscon commented 4 years ago

Adding checksum verification to FTX takes about 0.4 ms (400 microseconds).

zahnz commented 4 years ago

Bybit has a "cross_seq" field which looks like a sequence number, but based on messages in their API support Telegram channel, it's clear that it's not a sequence number, and is only used internally: image That screenshot is from 2020-Feb-21, but the same kind of response is consistently given to other users in the support channel who've asked the similar questions over the last 6 months. There's no indication in the API change announcement Telegram channel that this has changed either.

bmoscon commented 4 years ago

confirmed field is not useable in bybit - https://github.com/bybit-exchange/docs/issues/102

bmoscon commented 3 years ago

adding checksums to kraken adds ~750 microseconds (0.75 ms)

bmoscon commented 3 years ago

checksum validation for okex/okcoin takes 0.4ms

bmoscon commented 3 years ago

all exchanges verified, closing

DennyZen commented 3 years ago

i am using Bitmex. if they dont have sequence numbers - can i get new orderbook snapshot by rest periodically and check it ? @bmoscon

bmoscon commented 3 years ago

@DennyZen you can, but it would be hard to know how far off the rest book was from the websocket book, its unlikely they'd be identical at any given moment, you'd have to look backwards at an older websocket book