I am using Eikon API to get daily data on an index constituents over a large period of time (10-20 years), but I keep receiving "Backend error. 400 Bad Request". I think it might be because of a request limit, since the code works smoothly for small data ranges. This is the part of code where it fails:
RIC = '.OEX' def get_tickers_by_date(RIC, date): data, _ = ek.get_data(f"0#{RIC}({date})", ["TR.CompanyName"]) all_tickers = list(data.Instrument) return all_tickers #start and end date start_date = str(20100101) end_date = str(20230531) dates = [str(i).split(' ')[0] for i in pd.date_range(start_date, end_date)] all_data = {} for i, date in enumerate(dates): all_data[date] = get_tickers_by_date(RIC, date) if i % 100 == 0: print(f"Processed date {date}, iteration {i}")
Is there a more efficient way of getting the desired data over a long data range?