24h价格变动情况
接口描述
24小时价格变动统计。
HTTP请求
GET /fapi/v1/ticker/24hr
请求权 重
1 (单个symbol) 40 (所有symbol)
请求参数
| 名称 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| symbol | STRING | NO | 交易对 |
响应示例
{
"symbol": "BTCUSDT",
"priceChange": "-94.99999800",
"priceChangePercent": "-95.960",
"weightedAvgPrice": "0.29628482",
"lastPrice": "4.00000200",
"lastQty": "200.00000000",
"openPrice": "99.00000000",
"highPrice": "100.00000000",
"lowPrice": "0.10000000",
"volume": "8913.30000000",
"quoteVolume": "15.30000000",
"openTime": 1499783499040,
"closeTime": 1499869899040,
"firstId": 28385, // 第一个成交id
"lastId": 28460, // 最后一个成交id
"count": 76 // 总成交笔数
}
或(当不发送symbol)
[
{
"symbol": "BTCUSDT",
...
}
]
代码示例
cURL
curl -s "https://api-sepolia.ztdx.io/fapi/v1/ticker/24hr?symbol=BTCUSDT"
Python
import requests
base_url = "https://api.ztdx.io"
response = requests.get(f"{base_url}/fapi/v1/ticker/24hr", params={"symbol": "BTCUSDT"})
data = response.json()
print(f"Symbol: {data['symbol']}")
print(f"Last Price: {data['lastPrice']}")
print(f"24h Change: {data['priceChange']} ({data['priceChangePercent']}%)")
print(f"24h High: {data['highPrice']}, Low: {data['lowPrice']}")
print(f"24h Volume: {data['volume']}")