percentageOddsis implied probability scaled by 1020 —"52000000000000000000"is 52.000%.sizeis stake in base units — USDC has 6 decimals, so"2000000"is 2 USDC. It is the resting party’s stake, not the amount you can bet against it.
Odds must sit on the ladder
percentageOdds on a new order must be on the ladder or the order will be rejected.
Odds rounding has the full rules
Fetching the book
Both read the same book. Use best odds to simply get the best odds available on each side and the snapshot to size and price a bet.
Convert a level into what you can bet
A level’ssize is the resting party’s stake. The stake you can put up against it is:
10^20 − percentageOdds. Do both calculations using BigInt. Examples:
Aggregate depth across a side
Levels are already aggregated by exact price, so a depth ladder is a running total.Staying up to date
Polling the snapshot works, but the book changes on every match, cancel and expiry. The channelorderbook_v3:{marketHash} sends immediate real-time updates. It carries the same book and the
same version the snapshot route serves, and the exchange publishes one message per book change.
Related
Posting orders
Sign and submit an order onto the book.
Fetching odds
Scanning many markets, and getting a live client its first snapshot.
Book versioning
Applying live updates in the right order.
Time in force
GTC, IOC, FOK — and what happens when there is not enough depth.