Ad

Get_historical_klines() Missing 1 Required Positional Argument: 'start_str'

- 1 answer

I'm trying to get historical data; however upon executing the code:

def get_data():
    historical_data = client.get_historical_klines(symbol=config.SYMBOL, interval=Client.KLINE_INTERVAL_1MINUTE, limit=100, klines_type=HistoricalKlinesType.SPOT)
    print(historical_data)

I get the error:

historical_data = client.get_historical_klines(symbol=config.SYMBOL, interval=Client.KLINE_INTERVAL_1MINUTE, limit=100, klines_type=HistoricalKlinesType.SPOT)
TypeError: get_historical_klines() missing 1 required positional argument: 'start_str'

What seems to be wrong? Thanks!

Ad

Answer

You have to provide how much historical data you need. This is made with a 'start_str'. For example :

'1 day ago UTC'
'1 hour ago UTC'

So you shoud use the function like that:

klines = client.get_historical_klines(SYMBOL, Client.KLINE_INTERVAL_15MINUTE , "1 day ago UTC")
Ad
source: stackoverflow.com
Ad