This channel does NOT support query operations — only subscribe, update, and unsubscribe. For a one-time order book snapshot, use Orderbook over REST.
Connect to
wss://wss.whitebit.com/ws — see WebSocket Overview for protocol details and keepalive requirements.Rate limits
Subscribe to order book L2
Parameters are positional.Update frequency
The server pushes updates in real time.Update model
First message (params[0] is "s"): Full snapshot of the order book, limit levels per side. Asks come first (params[3]), bids second (params[4]).
Subsequent messages (params[0] is an array): Incremental updates. Each record carries the new absolute amount at a price level, not a delta.
- Amount
"0"removes the price level. - A non-zero amount on a price that is absent from the local book adds the level; on a price that is present, it replaces the current amount.
- A repeated snapshot replaces the whole order book of the market — it does not merge with the existing state.
Maintaining a local order book
- Keep a separate order book for each market and remember the
limitof its subscription. Messages for several markets arrive on one connection and differ by themarketfield. - Discard updates received before the first snapshot of a market.
- On a snapshot, replace the local order book of the market.
- On an update, apply every record of the message in order, then check the state.
- After each message, keep only the
limitbest asks (ascending by price) and thelimitbest bids (descending by price). - Store prices and amounts as decimals or strings, not floats — a float key stops matching the level on removal or replacement.
Ordering guarantees
- Apply updates in the order of arrival.
- Asks are sorted ascending and bids descending. The best ask must be strictly greater than the best bid. A crossed book indicates desynchronization — re-subscribe to receive a fresh snapshot.
- After a connection loss, re-subscribe and wait for a new snapshot before applying updates.