Skip to main content

Orderbook stream

Real-time multi-level orderbook for one instrument: an initial snapshot of every price level followed by per-level bid and ask updates. Public channel — no authentication required.

Subscribe

{"op": "subscribe", "args": ["orderbook-stream:BTCUSDC_PERP"]}

Topic format: orderbook-stream:{symbol}, e.g. orderbook-stream:BTCUSDC_PERP. The server replies with a subscribe ack and immediately begins forwarding the snapshot followed by live updates:

{"op": "subscribed", "channel": "orderbook-stream:BTCUSDC_PERP"}

Snapshot Message (delivered once per subscription)

{
"channel": "orderbook-stream:BTCUSDC_PERP",
"type": "snapshot",
"symbol": "BTCUSDC_PERP",
"bids": [
{"price": "67542.00", "amount": "1.5"},
{"price": "67541.50", "amount": "0.8"}
],
"asks": [
{"price": "67543.00", "amount": "2.1"},
{"price": "67543.50", "amount": "1.2"}
],
"timestamp": "2025-06-15T07:30:00.123456789Z"
}
  • bids: every bid level, sorted by price descending
  • asks: every ask level, sorted by price ascending
  • The snapshot alone is sufficient to render a multi-level orderbook.

Update Message

Each update message carries one or more book changes that occurred atomically (same timestamp). Apply the whole changes list as a single unit to keep the local book consistent.

{
"channel": "orderbook-stream:BTCUSDC_PERP",
"type": "update",
"symbol": "BTCUSDC_PERP",
"changes": [
{"action": "delete", "type": "ask", "price": "67543.50", "amount": "0"},
{"action": "change", "type": "bid", "price": "67542.00", "amount": "1.5"},
{"action": "new", "type": "bid", "price": "67541.75", "amount": "2.0"}
],
"timestamp": "2025-06-15T07:30:01.789012345Z"
}

Each entry in changes:

  • action: new (insert level), change (replace amount at level), or delete (remove level).
  • type: bid or ask — which side of the book.
  • price: the price level the change applies to.
  • amount: new size at the level. Always "0" when action is delete.

Errors

Upstream failures raise a channel-scoped error envelope and the affected subscription is torn down (other subscriptions on the same connection continue):

{"op": "error", "code": "ORDERBOOK_STREAM_UPSTREAM_ERROR", "message": "upstream disconnected", "args": ["orderbook-stream:BTCUSDC_PERP"]}

Clients should re-issue subscribe to recover.