深度信息
接口描述
获取有限档订单薄信息。
HTTP请求
GET /fapi/v1/depth
请求权重
| limit | 权重 |
|---|---|
| 5, 10, 20, 50 | 2 |
| 100 | 5 |
| 500 | 10 |
| 1000 | 20 |
请求参数
| 名称 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| symbol | STRING | YES | 交易对 |
| limit | INT | NO | 默认 500; 可选值:[5, 10, 20, 50, 100, 500, 1000] |
响应示例
{
"lastUpdateId": 1027024,
"E": 1589436922972, // 消息时间
"T": 1589436922959, // 撮合引擎时间
"bids": [ // 买单
[
"4.00000000", // 价格
"431.00000000" // 数量
]
],
"asks": [ // 卖单
[
"4.00000200", // 价格
"12.00000000" // 数量
]
]
}
代码示例
cURL
curl -s "https://api-sepolia.ztdx.io/fapi/v1/depth?symbol=BTCUSDT&limit=5"
Python
import requests
base_url = "https://api.ztdx.io"
response = requests.get(f"{base_url}/fapi/v1/depth", params={"symbol": "BTCUSDT", "limit": 5})
data = response.json()
print(f"Last Update ID: {data['lastUpdateId']}")
print("Bids:")
for price, qty in data['bids']:
print(f" {price} x {qty}")
print("Asks:")
for price, qty in data['asks']:
print(f" {price} x {qty}")