I’m trying to return historical klines but the API does not return anything at all.
This is my code:
from binance import Client, ThreadedWebsocketManager
import pandas as pd
import nest_asyncio
nest_asyncio.apply()
import time
b_KEY = "x"
b_SECRET = "x"
client = Client(b_KEY, b_SECRET, testnet=True)
acct = client.get_account()
df = pd.DataFrame(client.get_historical_klines(symbol='BTCUSDT', interval='1d', start_str='2023-01-01', end_str='2023-12-31', limit=1000))
print(df)
and this is the output:
Empty DataFrame
Columns: []
Index: []
Some extra info:
getting rid of the start and end times results in only the last 7 days of data being returned.
Thanks for any help in advance.
New contributor
Caleb Aryee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.