小编Faz*_*eng的帖子

Binance API如何计算24小时内的priceChangePercent

我正在开发自己的应用程序,我想在其中检索 24 小时内的价格数据。我已阅读币安提供的文档:https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md

然后,我尝试使用链接https://api.binance.com/api/v1/ticker/24hr?symbol=BTCUSDT获取24 小时股票价格变化统计数据。响应是:

{
  "symbol": "BTCUSDT",
  "priceChange": "111.60000000",
  "priceChangePercent": "1.314",
  "weightedAvgPrice": "8563.97044287",
  "prevClosePrice": "8491.29000000",
  "lastPrice": "8604.60000000",
  "lastQty": "0.40675900",
  "bidPrice": "8602.69000000",
  "bidQty": "0.02000000",
  "askPrice": "8610.79000000",
  "askQty": "0.13200000",
  "openPrice": "8493.00000000",
  "highPrice": "8763.36000000",
  "lowPrice": "8298.00000000",
  "volume": "26054.86683400",
  "quoteVolume": "223133109.45927182",
  "openTime": 1526170656448,
  "closeTime": 1526257056448,
  "firstId": 42721797,
  "lastId": 42939912,
  "count": 218116
}
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试使用此链接加载Kline/Candlestick 数据时: https://api.binance.com/api/v1/klines?symbol=BNBBTC&interval=15m&startTime=1526170656448&endTime=1526257056448(其中startTimeendTime设置为完全相同的)与上面响应中的openTimecloseTime相同)。结果是:

[
  [
    1526171400000, // Open time
    "0.00154030", // Open
    "0.00154560", // High
    "0.00153600", // …
Run Code Online (Sandbox Code Playgroud)

api statistics binance

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

api ×1

binance ×1

statistics ×1