Get Market Depth
HTTP request
GET /spot/depth
Request parameters
Parameter Name | Required | Type | Notes |
---|---|---|---|
market | true | string | Market name |
limit | true | int | Number of depth data items. One of [5, 10, 20, 50] |
interval | true | string | Merge interval. One of ["0", "0.00000000001", "0.000000000001", "0.0000000001", "0.000000001", "0.00000001", "0.0000001", "0.000001", "0.00001", "0.0001", "0.001", "0.01", "0.1", "1", "10", "100", "1000"] |
Return parameters
Parameter Name | Type | Notes |
---|---|---|
market | string | Market name |
is_full | bool | True means full push, and false means incremental push |
depth | object | Depth data |
depth.asks | array | Seller data |
asks[n][0] | string | Seller price |
asks[n][1] | string | Seller size. During incremental push, a value of 0 indicates the depth at which the price needs to be deleted. |
depth.bids | array | Buyer data |
bids[n][0] | string | Buyer price |
bids[n][1] | string | Buyer size. During incremental push, a value of 0 indicates the depth at which the price needs to be deleted. |
depth.last | string | Latest price |
depth.updated_at | int | Timestamp, millisecond |
depth.checksum | string | Data checksum |
Reminder
About Depth Checksum:
- The checksum is a signed 32-bit integer of the full depth data, used to verify the accuracy of the depth data.
- Construct the checksum string: bid1_price:bid1_amount:bid2_price:bid2_amount:ask1_price:ask1_amout:... (if there is no bid, the checksum string will be ask1_price:ask1_amount:ask2_price:ask2_amount:...)
- Encode the checksum string using crc32 algorithm
Please check out the Code Examples to see how to use both full and incremental data pushes in the API client to recover complete depth data and verify its accuracy.
Request example
GET /spot/depth?market=BTCUSDT&limit=5&interval=0.01
Response example
{
"code": 0,
"data": {
"market": "BTCUSDT",
"is_full": true,
"depth": {
"asks": [
[
"30740.00",
"0.31763545"
],
[
"30769.00",
"1.45155000"
]
],
"bids": [
[
"30736.00",
"0.04857373"
],
[
"30733.00",
"0.84696320"
],
[
"30725.00",
"0.12563353"
],
[
"30422.00",
"0"
]
],
"last": "30746.28",
"updated_at": 1689152421692,
"checksum": 2578768879
}
},
"message": "OK"
}