Open VincentDuf opened 2 years ago
No one ? @sammchardy Even when I pre-create a DataFrame with 5 empty columns (or with one row) I still get the error... is it coming from the binance side or is it pandas ?
Thanks
Not sure if this is too late, but I'm pretty sure this error is returned for delisted pairs. The Binance api can return an empty dict for these pairs, so the dataframe is empty in these instances and therefore has 0 columns. When you try to assign 5 column names (in new_df.columns = ['Time','open','high','low','close']) to a 0 column dataframe Pandas throws out this error.
katkoe This is not true, i get the same error after looping through 5-100 times using only btcusdt
If you know another soulution i would love to hear it, thanks!
Has anyone solved this yet?
asset,interval,lookback are global variable so no issue with that just that i think there is no stream of datasets to pd from binance api even though the api is up and running i tested the api by calling (info = client.get_account())
Hi, I'm trying to get the daily data from all BUSD and USDT pairs from Binance over the past 2 years.
Here is the main function I use to get these data:
And how I want to save those dataframe inside a SQLite database:
Weirdly when I execute this line alone:
new_df = pd.DataFrame(client.get_historical_klines(ticker,"1d","1 Jan, 2020"))
There is no error. But when I run it inside a loop I get this error over and over:
ValueError: Length mismatch: Expected axis has 0 elements, new values have 5 elements
Despite some research on stackoverflow or other site I still don't get the error... if anyone can help me.
Thanks :)
[EDIT]: It seems that it happens for certain pairs, regularly but I still don't get why. It also seems to be an issue about the number of columns of my dataframe but I don't get why some are an issue and not other... As a result I have only 4 over 300 pairs that are properly saved which is very few...