During development, the developer endpoints work without an API key. Access to the book stream in production is gated: request an API key with book stream access, or have an existing key upgraded.
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. The 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
Book levels are approximations computed at runtime. The
cumulative_size_human
at each level is the total base size available from the spot out to that price.Related Resources
Market Data Streams
How the streams work and when to use each.
Book Stream API
Messages, fields, and the depth format.
Stream Top-of-Book Quotes
Read live bid and ask for a pair.
Authenticate Requests
Authenticate requests for production rate limits.