简体   繁体   English

币安期货市场的最新价格 API 和 Python

[英]Last price from FUTURES market on Binance API with Python

I am using the API endpoint https://api.binance.com/api/v1/ticker/24hr?symbol= to get last price info for markets, but I need the data for the FUTURES market, as sometimes there can be a big spread between the spot and futures last price.我正在使用 API 端点https://api.binance.com/api/v1/ticker/24hr?symbol=获取市场的最新价格信息,但我需要期货市场的数据,因为有时可能会有现货和期货最新价格之间的巨大价差。

How can I get this data point?我怎样才能得到这个数据点?

Using binance-python lib and python 3.使用 binance-python 库和 python 3.

Use this endpoint to get the last price of the Pair in the futures market https://fapi.binance.com/fapi/v1/ticker/24hr?symbol= <SYMBOL_NAME>.使用此端点获取 Pair 在期货市场的最新价格https://fapi.binance.com/fapi/v1/ticker/24hr?symbol= <SYMBOL_NAME>。

Example:例子:

https://fapi.binance.com/fapi/v1/ticker/24hr?symbol=BNBUSDT https://fapi.binance.com/fapi/v1/ticker/24hr?symbol=BNBUSDT

Check this documentation link for more information查看此文档链接以获取更多信息

For people who want to use binance-futures-connector-python to get the latest price of a symbol, you may use the following code.对于想要使用binance-futures-connector-python获取交易品种最新价格的人,您可以使用以下代码。

from binance.um_futures import UMFutures

um_futures_client = UMFutures()
print(um_futures_client.ticker_price("BTCUSDT")) # returns something like {'symbol': 'BTCUSDT', 'price': '22774.80', 'time': 1674457064454}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Binance API Python 上设置止盈止损的市场期货订单? - How to place a market futures order with take profit and stop loss on Binance API Python? Python / Binance API - 如何从 API 抓取 Binance Leaderboard 期货 position? - Python / Binance API - How to scrape Binance Leaderboard futures position from API? Python Binance - 如何使用 websocket 获取期货交易的最后价格? - Python Binance - How to get the last PRICES traded in futures with websocket? 如何使用 python-binance 下达带有止盈和止损的期货市场订单 - How to place a Futures Market order with Take Profit and Stop Loss using python-binance WebSocket 获取期货实时价格 Binance - WebSocket Get Futures Realtime Price Binance python 币安 api order_market_buy 和 order_market_sell 的问题 - problem with python binance api order_market_buy and order_market_sell 如何调用币安/futures/data/openInterestHist Market Data Endpoint? - How to call Binance /futures/data/openInterestHist Market Data Endpoint? 如何使用 python-binance 下期货市场订单:APIError(code=-1111): Precision is over the maximum defined for this assets - How to place a futures market order using python-binance: APIError(code=-1111): Precision is over the maximum defined for this asset 如何使用“获取历史 Kline/Candlesticks”function 从 python-binance 获得最后一个说 20 个“收盘价”值? - How do you get the last say 20 "Close price" values from python-binance using the "Get Historical Kline/Candlesticks" function? Binance API 开期货交易的正确方法? - Binance API proper way to open a futures trade?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM