I'm using an API to get financial data. And I'm using Python. There is a limitation of 120 days per call so I'm doing a loop to make those calls and then concatenate the pandas dataframes that I get in each call. I started by creating a list with all the dates I need. And the list has 39 dates, so my final dataset should be the junction of 38 smaller dataframes. The list is called todas_as_datas_UNIX.
The problem is, that in the end I only get the dataframe with the last 120 days, so it's not storing the other intervals.
My code is:
data_intermedio = pd.DataFrame(columns = ['timestamp','gmtoffset','datetime','open','high','low','close','volume'])
for i in range(len(todas_as_datas_UNIX)-1):
intermedio = pd.DataFrame(call.get_prices_intraday("TSLA", interval = '1m', from_= todas_as_datas_UNIX[i], to= todas_as_datas_UNIX[i+1] ))
data = pd.concat([data_intermedio, intermedio])
I don't have a lot of experience with append/concatenate data frames so I think I'm missing something. Can someone help me? Thank you so much!