import yfinance as yf
try:
data = yf.download(tickers=all_symbols[:50], start=start, end=end, group_by="ticker")
except:
pass
Seems like that should hide all exceptions thrown by yfinance, but when a ticker name isn't found, I always get exceptions cluttering up my Jupyter notebook. how do i get them to stop appearing?
Exception in thread Thread-333:
Traceback (most recent call last):
File "/Users/jason/anaconda3/lib/python3.7/site-packages/yfinance/__init__.py", line 313, in history
quotes = self._parse_quotes(data["chart"]["result"][0])
File "/Users/jason/anaconda3/lib/python3.7/site-packages/yfinance/__init__.py", line 162, in _parse_quotes
timestamps = data["timestamp"]
KeyError: 'timestamp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jason/anaconda3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/Users/jason/anaconda3/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/Users/jason/anaconda3/lib/python3.7/site-packages/multitasking/__init__.py", line 102, in _run_via_pool
return callee(*args, **kwargs)
File "/Users/jason/anaconda3/lib/python3.7/site-packages/yfinance/__init__.py", line 470, in _download_one_threaded
period, interval, prepost, proxy)
File "/Users/jason/anaconda3/lib/python3.7/site-packages/yfinance/__init__.py", line 483, in _download_one
proxy=proxy)
File "/Users/jason/anaconda3/lib/python3.7/site-packages/yfinance/__init__.py", line 316, in history
raise ValueError(self.ticker, err_msg)
ValueError: ('ACCP', 'No data found for this date range, symbol may be delisted')
The exceptions are in separate threads, which is why you are not catching and suppressing them. It's also why the remaining results continue to download properly.
Your primary issue is that you have bad data, and fixing that bad data will solve your problem. ACCP has not had it's IPO yet, it may never as its been in the works for at least 3 years.
You have a few options: