gpt4 book ai didi

java - 如何使用币安 API,通过代码简单的获取价格

转载 作者:行者123 更新时间:2023-12-04 11:51:44 27 4
gpt4 key购买 nike

我只想从响应中得到一对。而且我真的不明白我应该如何传递我的参数。
说明说:

Symbol price ticker


GET /api/v3/ticker/price


Latest price for a symbol or symbols.


Weight: 1 for a single symbol; 2 when the symbol parameter is omitted


Parameters:


Name Type Mandatory Description


symbol STRING NO -


If the symbol is not sent, prices for all symbols will be returned in an array."


我能够获得响应正文中的所有符号,但无法获得一个。
我已经尝试过(在 Postman 中)这些端点:
  • https://api.binance.com/api/v3/ticker/price/btcusdt
  • https://api.binance.com/api/v3/ticker/price/symbol=btcusdt
  • https://api.binance.com/api/v3/ticker/price/?symbol=btcusdt

  • 这是整个 API 的链接: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#24hr-ticker-price-change-statistics那么,哪个端点是正确的? postman result

    最佳答案

  • https://api.binance.com/api/v3/ticker/price/?symbol=btcusdt

  • 您必须在没有 / 的情况下使用 Query
    和币安的/api/v3/ticker/price 端点需要符号查询为 Upper case .
    所以你必须要求如下 https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT

    关于java - 如何使用币安 API,通过代码简单的获取价格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65864645/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com