book channel includes a CRC32 checksum with each update. Validating it confirms your local book is correctly synchronised with the exchange.
Checksum verification is optional. You can validate on every update or periodically depending on throughput requirements. The checksum is always calculated over the top 10 price levels regardless of subscription depth.
Maintaining the book
- Process all price level updates in a message before calculating the checksum.
- An update with
"qty": 0means that price level should be removed. - After each update, truncate your book to the subscribed depth — you will not receive
"qty": 0for levels that fall out of scope.
Checksum calculation
Algorithm
1
Build the asks string
For each of the top 10 ask price levels, sorted by price low to high:
- Remove
.fromprice→"45285.2"→"452852" - Remove leading zeros →
"452852"→"452852" - Remove
.fromqty→"0.00100000"→"000100000" - Remove leading zeros →
"000100000"→"100000" - Append
price + qtyto the asks string →"452852100000"
2
Build the bids string
For each of the top 10 bid price levels, sorted by price high to low, apply the same formatting and append to the bids string.
3
Concatenate and hash
Concatenate asks + bids strings, then pass the result to a CRC32 function. Cast the result to an unsigned 32-bit integer and compare to the
checksum field in the message.Example
Input snapshot:3310070434