Subscriptions
Subscribe to real-time L2 order books, deltas, BBO, trades, candles, and user events.
/wsConnect to /ws and send a JSON message with "method": "subscribe" or "method": "unsubscribe".
L2 Order Book (l2Book)
Streams an immediate 20-level snapshot, followed by updates on book change at up to 50 ms cadence. Set "fast": true for immediate per-block pushes of the top 5 levels (including spread).
{
"method": "subscribe",
"subscription": { "type": "l2Book", "coin": "BTC", "fast": false }
}L2 Order Book Deltas (l2BookDelta)
Per-block incremental order book updates for low-latency local book maintenance. Emits an initial snapshot (isSnapshot: true with height) unless "noSnapshot": true is passed.
{
"method": "subscribe",
"subscription": { "type": "l2BookDelta", "coin": "BTC" }
}Best Bid / Offer (bbo)
Streams top-of-book bid and ask on change at up to 25 ms cadence after an immediate initial snapshot.
{
"method": "subscribe",
"subscription": { "type": "bbo", "coin": "BTC" }
}Trades (trades)
Sends the latest 30 trades on subscribe, followed by live executions as blocks commit.
{
"method": "subscribe",
"subscription": { "type": "trades", "coin": "BTC" }
}Candles (candle)
Streams live OHLCV updates for the active candle every 500 ms (1m–1d).
{
"method": "subscribe",
"subscription": { "type": "candle", "coin": "BTC", "interval": "1m" }
}All Mids (allMids / allMidsDelta)
Streams mid prices across all markets. Use allMidsDelta for per-block incremental diffs.
{
"method": "subscribe",
"subscription": { "type": "allMids" }
}Order Updates (orderUpdates)
Event-driven lifecycle updates (open, filled, canceled, rejected, plus partial-fill progress updates) for a user's orders as blocks commit. Each update includes the original quoted price and cumulative volume-weighted execution price avgPx ("0.0" until filled).
{
"method": "subscribe",
"subscription": {
"type": "orderUpdates",
"user": "0x0000000000000000000000000000000000000000"
}
}User Fills (userFills)
Sends an initial snapshot of the latest 100 fills (isSnapshot: true), followed by real-time fills.
{
"method": "subscribe",
"subscription": {
"type": "userFills",
"user": "0x0000000000000000000000000000000000000000",
"aggregateByTime": true
}
}Account State Streams (clearinghouseState / openOrders / spotState)
Subscribe to live snapshots of perpetual positions, resting orders, or spot balances by setting type to "clearinghouseState", "openOrders", "spotState", "userFundings", "userNonFundingLedgerUpdates", or "webData3".
{
"method": "subscribe",
"subscription": {
"type": "clearinghouseState",
"user": "0x0000000000000000000000000000000000000000"
}
}