跳到主要内容

最新价格

接口描述

返回最近成交价。若该交易对尚无成交价,则返回标记价格。

HTTP请求

GET /fapi/v1/ticker/price

请求参数

名称类型是否必需描述
symbolSTRINGNO交易对

响应示例

{
"symbol": "BTCUSDT",
"price": "6000.01",
"time": 1589437530011
}

或(当不发送symbol)

[
{
"symbol": "BTCUSDT",
"price": "6000.01",
"time": 1589437530011
}
]

代码示例

cURL

# Single symbol
curl -s "https://api.prex.world/fapi/v1/ticker/price?symbol=BTCUSDT"

# All symbols
curl -s "https://api.prex.world/fapi/v1/ticker/price"

Python

import requests

base_url = "https://api.prex.world"

# Single symbol
response = requests.get(f"{base_url}/fapi/v1/ticker/price", params={"symbol": "BTCUSDT"})
data = response.json()
print(f"{data['symbol']}: {data['price']}")

# All symbols
response = requests.get(f"{base_url}/fapi/v1/ticker/price")
for ticker in response.json()[:5]:
print(f"{ticker['symbol']}: {ticker['price']}")