Skip to main content

Partial Book Depth Streams

Stream: <symbol>@depth5 · <symbol>@depth10 · <symbol>@depth20 · Update speed: 250 ms

Status: Implemented.

Top-of-book snapshots pushed four times a second: the best 5, 10, or 20 levels per side. Exactly the shape of GET /api/v3/depth.

Only the three level counts above exist; depth7 or depth05 is refused with 1008 unknown stream.

Frame (bare, on /ws/cbtc-usdcb@depth5; values illustrative)

{
"lastUpdateId": 1756600000250,
"bids": [
["59990.00", "0.2500"],
["59985.50", "1.0000"],
["59980.00", "0.4000"],
["59975.00", "2.0000"],
["59970.00", "0.1000"]
],
"asks": [
["60010.00", "0.1200"],
["60012.00", "0.8000"],
["60015.00", "0.3000"],
["60020.00", "1.5000"],
["60025.00", "0.2000"]
]
}

On /stream: {"stream":"cbtc-usdcb@depth5","data":{…}}.

FieldTypeNotes
lastUpdateIdnumberSnapshot timestamp in ms (matching-engine clock; gateway clock as fallback). Monotonic per symbol. Not a sequence number — there is nothing to gap-detect against.
bids, asks[price, qty] string pairsBest first. A side thinner than the requested depth is returned as-is, not padded.

Semantics

  • Frames are sent on every 250 ms tick whether or not the book changed. Compare lastUpdateId or the content if you need change detection.
  • If the matching engine cannot be reached, the tick is skipped (no frame) rather than an empty book being sent. Silence longer than a few ticks on a normally active market means the engine is unavailable; the socket stays open and resumes when it returns. (The REST endpoint behaves differently: it returns an empty book.)
  • All connections subscribed to any depth level of a symbol share one engine poll; subscribing more clients costs the engine nothing extra.
  • Every subscriber to the same stream receives byte-identical frames.
  • If the symbol is delisted while you are subscribed, its depth streams are closed; the socket ends once every stream on it has closed.

Differences from Binance

  • 250 ms cadence instead of 100 ms / 1000 ms; no @100ms suffix.
  • lastUpdateId is a timestamp and cannot be used to synchronize with a diff stream (there is none — see Diff. Depth Stream).