I am using a get_timeseries() function in a loop over a long list of stocks and get different errors depending on context (I am aware of the reasons for the errors):
- No data available for the requested data range.
- Client Error: Too many requests, please try again later
Is there a way to handle these errors differently? For example, I want skip the iteration that returns "no data available" and completely stop the loop execution if "too many requests" error shows, something like this
for ticker in ticker_list:
try:
prices = ek.get_timeseries(ticker, interval = 'daily)
except NoDataAvailableError:
continue
except ClientError:
break