How to check for corrupted orderbooks


I have recently migrated from the FTX API to adapt my algo to Binance, since FTX is no more online.
With FTX API, I could check that my current local version of the orderbook was not corrupted by performing a checksum at every update (look their docs here).

I am now streaming websocket updates from the btcusdt@depth@100ms channel. I am applying the updates as suggested in the docs here but I don’t understand how can I be sure that the local copy of the orderbook is actually right. is there any consistency check I can perform like I was used to do with FTX?


There is no checksum available at the moment. Sadly, there is no practical way to mechanically validate the order book computation either, unless you test it with very low-volume symbols.

You can retain computed order book states, query a snapshot with GET /api/v3/depth, but there is no guarantee that the lastUpdateId you receive in response would be one of the states you computed while listening to the btcusdt@depth stream, since you get a batch of updates and not individual ones :frowning: