简体   繁体   中英

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.

I am able to extract ETHUSDT data using: 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. 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. There is also a function get_futures_historical_klines this will give you what you are looking for. 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 .

Try get_tickers() or get_futures_tickers() to get available symbols

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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