I'm trying to get from binance the historical futures prices of the futures contract that expires on the 31st of December 2021.
I have figured this out for perps but am struggling with a futures contract with a delivery date. The code for the perps is below
df = pd.DataFrame(client.futures_historical_klines(
symbol='BTCUSDT',
interval='1d',
start_str='2021-06-01',
end_str='2021-06-30'
))
I assumed that replacing the symbol with BTCUSD_211231 or BTCUSDT_211231 would have done the trick, but unfortunately I get the below error message:
BinanceAPIException: APIError(code=-1121): Invalid symbol.
Any help is much appreciated!
Thanks