Order book
Real-time order book updates.
info
The first response after subscribing includes a full order book snapshot. Subsequent messages are incremental updates -- check the snapshot field to distinguish between the two.
Subscribe Request:
{
"id": "12345",
"method": "subscribe",
"params": {
"channel": "orderbook",
"symbol": "BTC-USDT",
"depth": 20,
"precision": "0.01"
}
}
Request parameters
| Parameter | Description |
|---|---|
| symbol (required) | Trading pair symbol. Specify trading pair to get updates. See Get /api/v1/symbols for all currently available trading pairs. |
| depth (optional) | Number of price levels. Available values: 5, 10, 20, 50, 100, 200, 500. |
| precision (optional) | Price precision. Example available values: 0.0001, 0.001, 0.01, 0.1, 1. See GET /api/v1/symbols/symbol to get precision values for other pairs. |
Response
The initial subscribe response includes a full order book snapshot.
Subscribe response example:
{
"id": "12345",
"result": {
"success": true,
"sequence": "3262786978",
// the values "51190.00" and "0.45054140" indicate [price: string, size: string]
"bids": [["51190.00", "0.45054140"],["51185.00", "1.20000000"]],
"asks": [["51200.00", "0.30000000"],["51205.00", "0.75000000"]],
"askTotalAmount": "1239.22351",
"bidTotalAmount": "1156.45678"
}
}
In this example: the values in pairs, for example "51190.00" and "0.45054140" indicate [price: string, size: string], meaning that the first value is the price and the second is the size.
Subscription Push Example:
{
"method": "subscription",
"params": {
"channel": "orderbook",
"symbol": "BTC-USDT",
"depth": 20,
"precision": "0.01",
"data": {
"snapshot": true,
"sequence": "3262786979",
"bids": [["51190.00", "0.45054140"],["51185.00", "1.20000000"]],
"asks": [["51200.00", "0.30000000"],["51205.00", "0.75000000"]],
"askTotalAmount": "1239.22351",
"bidTotalAmount": "1156.45678"
}
}
}
Response Parameters
| Parameter | Description |
|---|---|
| symbol (required) | Trading pair. |
| depth (optional) | Number of price levels, set in request. |
| precision (optional) | Price precision, set in request. |
| snapshot (required) | true — the full orderbook snapshot is returned, false — only incremental updates. |
| sequence (required) | A sequence number for the order book update. Type: string. |
| bids (required) | Array of bid (buy) price levels, sorted by price descending (best bid first). Each entry is [price, size]. Type: array. |
| asks (required) | Array of ask (sell) price levels, sorted by price ascending (best ask first). Each entry is [price, size]. Type: array. |
| askTotalAmount (required) | Total amount or volume of all current ask (sell) orders. Type: string. |
| bidTotalAmount (required) | Total amount or volume of all current bid (buy) orders. Type: string. |