Multi-Order Book WebSocket
Route
/trading-api/v1/market-data/orderbook
This allows simultaneous subscriptions to multiple L1 and L2 order books of different markets:
It also provides a heartbeat topic which sends heartbeat every 30s as an indicator of platform healthiness. Please refer to the heartbeat section for the details.
Subscription Sample
The order books of different markets to be subscribed are controlled by the parameters in the subscription message listed below:
| Parameters | Type | Description |
|---|---|---|
| topic | String | l1 order book: l1Orderbook l2 order book: l2Orderbook heartbeat: heartbeat |
| symbol | String | market symbol |
L1 Subscription Message Sample:
{
"jsonrpc": "2.0",
"type": "command",
"method": "subscribe",
"params": {
"topic": "l1Orderbook",
"symbol": "BTCUSD"
},
"id": "1611082473000"
}
L2 Subscription Message Sample:
{
"jsonrpc": "2.0",
"type": "command",
"method": "subscribe",
"params": {
"topic": "l2Orderbook",
"symbol": "BTCUSD"
},
"id": "1611082473000"
}
Heartbeat Subscription Message Sample:
{
"jsonrpc": "2.0",
"type": "command",
"method": "subscribe",
"params": {
"topic": "heartbeat"
},
"id": "1611082473000"
}
L1 Update Response Sample
| Name | Type | Description |
|---|---|---|
| sequenceNumber | String | incrementing, unique, unsigned integer that identifies a state of the L1 order book |
| symbol | String | market symbol |
| timestamp | String | denotes the time the update was created |
| bid | Array | nested array containing price and quantity of highest bid |
| ask | Array | nested array containing price and quantity of lowest ask |
{
"type": "update",
"dataType": "V1TALevel1",
"data": {
"symbol": "BTCUSD",
"bid": ["5199.5000", "61.95995262"],
"ask": ["5199.6000", "96.59626782"],
"sequenceNumber": "8",
"datetime": "2020-06-29T06:28:55.500Z",
"timestamp": "1593412135500"
}
}
L2 Snapshot Response Sample
| Name | Type | Description |
|---|---|---|
| symbol | String | market symbol |
| bids | Array | array of size 200 where even indices denote price, odd indices denote absolute quantities |
| asks | Array | array of size 200 where even indices denote price, odd indices denote absolute quantities |
| sequenceNumberRange | Array | array of size 2 where first element denotes lower bound, second element denotes upper bound of sequence numbers lower and upper bound are equal for initial snapshot; this may differ for subsequent snapshots |
| datetime | String | denotes the time the update was created by the engine, ISO 8601 with millisecond as string |
| timestamp | String | denotes the time the update was created by the engine |
| publishedAtTimestamp | String | denotes the time the update was broadcasted to connected WebSockets |
{
"type": "snapshot",
"dataType": "V1TALevel2",
"data": {
"symbol": "BTCUSDC",
"bids": [
"5199.5000",
"110.92467647",
"5199.4000",
"20.92470365",
"5199.3000",
"0.92473034",
"5199.2000",
"0.92475701",
"5199.1000",
"0.92478369",
"5199.0000",
"0.92481038",
"5198.9000",
"0.92483705",
"5198.8000",
"0.92486375",
"5198.7000",
"0.92489042",
"5198.6000",
"0.92491712"
],
"asks": [
"5199.6000",
"96.37848193",
"5199.7000",
"0.92465082",
"5199.8000",
"11.04464563",
"5199.9000",
"0.92459696",
"5200.0000",
"0.92457029",
"5200.1000",
"0.92454362",
"5200.2000",
"0.92451695",
"5200.3000",
"0.92449028",
"5200.4000",
"0.92446361",
"5200.5000",
"0.92443695"
],
"sequenceNumberRange": [1370055970, 1370055970],
"datetime": "2025-02-14T07:15:33.797Z",
"timestamp": "1739517333797",
"publishedAtTimestamp": "1739517333798"
}
}
See connect to multi-order book WebSocket for a sample Python script.