简体   繁体   English

使用 Python 提取币安期货数据(ETHUSDT 季刊 0625)

[英]Extracting Binance Futures Data with Python (ETHUSDT Quarterly 0625)

I am trying to extract price information: "ETHUSDT Quarterly 0625" from Binance using the Python API.我正在尝试使用 Python API 从 Binance 提取价格信息:“ETHUSDT Quarterly 0625”。

I am able to extract ETHUSDT data using: https://www.binance.com/en/futures/ethusdt我可以使用以下方法提取 ETHUSDT 数据: https ://www.binance.com/en/futures/ethusdt

symbol = "ETHUSDT"

# get timestamp of earliest date data is available
timestamp = client._get_earliest_valid_timestamp(symbol, '1d')

# request historical candle (or klines) data
bars = client.get_historical_klines(symbol, '1d', timestamp, limit=500)

However when I change symbol to "ETHUSDT Quarterly 0625" It will not work, I have looked everywhere for the symbol for the quarterly future data but I cannot find the symbol.但是,当我将符号更改为“ETHUSDT Quarterly 0625”时,它不起作用,我到处寻找季度未来数据的符号,但找不到该符号。 https://www.binance.com/en/futures/ethusdt_quarter https://www.binance.com/en/futures/ethusdt_quarter

symbol = "ETHUSDT Quarterly 0625"

# get timestamp of earliest date data is available
timestamp = client._get_earliest_valid_timestamp(symbol, '1d')

# request historical candle (or klines) data
bars = client.get_historical_klines(symbol, '1d', timestamp, limit=500)

I have tried many many possible combinations of the symbol to make it work but it won't Does anyone know how to either get the futures quarterly data another way?我已经尝试了许多可能的符号组合来使其工作,但它不会有人知道如何以另一种方式获取期货季度数据吗? or know the symbol.或知道符号。 Thanks谢谢

There are two functions get_historical_klines this will only give data of spot market.有两个函数get_historical_klines这只会给出现货市场的数据。 There is also a function get_futures_historical_klines this will give you what you are looking for.还有一个函数get_futures_historical_klines这会给你你正在寻找的东西。 Also please check out the documentation as this varies of futures and coin.也请查看文档,因为这是不同的期货和硬币。 Also the symbol structure works differently on API rather than on exchange .此外,符号结构在 API 上的工作方式与在 exchange 上不同

Try get_tickers() or get_futures_tickers() to get available symbols尝试get_tickers()get_futures_tickers()以获取可用符号

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM