Order Book
Spot WebSocket Order Book
Subscribe
{
"op":"subscribe",
"args":[
"<topic 1>",
"<topic 2>",
"...",
"<topic n>"
]
}
Topic Description
- Topic format: "spot/orderBook.{instrument_id}.[depth]"
Name |
Type |
Mandatory |
Description |
instrument_id |
string |
YES |
contract abbreviation, such as BTCUSDT. |
depth |
integer |
NO |
order book depth. 5、10、50、100、200 |
Request Example
{
"op": "subscribe",
"args": [
"spot/orderBook.BTCUSDT.5",
"spot/orderBook.ETHUSDT"
]
}
Response Example
{
"topic": "spot/orderBook.BTCUSDT",
"action": "update", // At the first time , action = insert, then ,action = update, means appended data.
"data": [
{
// Bid levels are sorted from highest to lowest price.
"bids": [
[
"29953.9", // Price
"18167" // Quantity
],
[
"29953.6",
"0"
],
[
"29953.5",
"0"
],
[
"29953.3",
"6419"
],
[
"29953.0",
"3776"
],
[
"29953.4",
"6795"
],
[
"29952.9",
"35043"
]
],
// Ask levels are sorted from lowest to highest price.
"asks": [
[
"29954.2", // Price
"18862" // Quantity
],
[
"29954.3",
"4168"
],
[
"29954.4",
"3738"
],
[
"29954.5",
"0"
],
[
"29954.6",
"23650"
],
[
"29954.7",
"3746"
]
],
"version": 46165145, // This field is strictly increasing value. It can be used to check the continuity of new data.
"timestamp": 1681273582128
}
]
}
Unsubscribe
{
"op":"unsubscribe",
"args":[
"<topic 1>",
"<topic 2>",
"...",
"<topic n>"
]
}
Topic Description
- Topic format: "spot/orderBook.{instrument_id}.[depth]"
Name |
Type |
Mandatory |
Description |
instrument_id |
string |
YES |
contract abbreviation, such as BTCUSDT. |
depth |
integer |
NO |
order book depth. |
Request Example
{
"op": "unsubscribe",
"args": [
"spot/orderBook.BTCUSDT.5",
"spot/orderBook.ETHUSDT"
]
}