When I use get_timeseries to get Future's close price, I choose to use t FOR loop to get a list of contracts' data, but sometimes the get_timeseries returns TIMEOUT. Even if I set a 1 second time.sleep for each loop. How can I make sure that the get_timeseries can work well?
My code is like this:
for i in range(len(ric_list)):
try:
data = ek.get_timeseries([ric_list[i]], fields=["CLOSE"], start_date=before, end_date=today, interval='daily', count=10000)
except:
data = pd.DataFrame(columns=[ric_list[i]])
data_set = pd.concat([data_set,data],axis=1)
time.sleep(1)