Access to book stream in production is gated: request an API key with book stream access, or have an existing key upgraded.
Book Stream
Book stream gives you ten levels of order book depth per side, with the mid price and tick size. Levels are cumulative from the spot outward, so each level carries the total size available up to that price. Book stream covers direct routes only. For the full message format and parameters, see the Book Stream API.1
Set up
Import a WebSocket client, read the endpoint from the environment, and pick the pair to watch.
Imports and config
Imports and config
2
Connect and subscribe
Open the connection to
/book-stream and send a subscribe op once it is open. Book stream covers direct routes only.Connect and subscribe
Connect and subscribe
3
Render the book
Each update carries
mid, tick, and ten levels per side. b and a are arrays of { price, cumulative_size_human }, ordered nearest to spot outward, where the size is cumulative base from the spot to that level.Handle messages
Handle messages
Related Resources
Stream Top-of-Book Quotes
Read live bid and ask for a pair.
Book Stream API
Messages, fields, and the depth format.