-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Labels
Description
Hi, thank you for the really useful library!
My code:
data = yf.download(' '.join(TICKERS), start=START_DATE, end=END_DATE,
group_by='ticker')Sometimes during the downloading of the historical data, I can see some errors like:
- ACHN: No data found, symbol may be delisted
- BID: No data found, symbol may be delisted
- ECA: No data found, symbol may be delisted
So, I suggest we add retry option to try download the data one more time in case it failed.
Now I'm doing this workaround in my code:
data = yf.download(' '.join(TICKERS), start=START_DATE, end=END_DATE,
group_by='ticker')
tickers_to_retry = []
for ticker in TICKERS:
download_success = [r for r in data[ticker]['Close'] if r > 0]
if download_success:
CASHED_DATA[ticker] = {'close': [r for r in data[ticker]['Close']],
'row_data': data[ticker],
'low': [r for r in data[ticker]['Low']],
'high': [r for r in data[ticker]['High']]}
else:
tickers_to_retry.append(ticker)
if tickers_to_retry:
data = yf.download(' '.join(tickers_to_retry), start=START_DATE, end=END_DATE,
group_by='ticker')
for ticker in tickers_to_retry:
download_success = [r for r in data[ticker]['Close'] if r > 0]
if download_success:
CASHED_DATA[ticker] = {'close': [r for r in data[ticker]['Close']],
'row_data': data[ticker],
'low': [r for r in data[ticker]['Low']],
'high': [r for r in data[ticker]['High']]}So it is better to have retry inside the library and do them automatically at least once.
clemstar