I have seen that fast info when passed a ticker that is not currently available, an error occurs due to the reading of non-existing parameters, in this case, currency.
Simple code that reproduces your problem
import yfinance as yf
stock = yf.Ticker("FDQ.BE")
stock.get_fast_info() # same with stock.fast_info
Debug log
Traceback (most recent call last):
File "/home/user/code/src/functions.py", line 11, in get_info_data
fast_info = stock.get_fast_info()
File "/home/user/code/venv/lib/python3.10/site-packages/yfinance/scrapers/quote.py", line 165, in getitem
return getattr(self, k)
File "/home/user/code/venv/lib/python3.10/site-packages/yfinance/scrapers/quote.py", line 255, in currency
self._currency = md["currency"]
KeyError: 'currency'
Bad data proof
I think it could be easily solved by doing .get() of the dictionary. Knowing that all the response parameters have a default value of None, the get() would make them keep the None value and return a dictionary with those parameters to None as the user expects instead of throwing an error.
Describe bug
I have seen that fast info when passed a ticker that is not currently available, an error occurs due to the reading of non-existing parameters, in this case, currency.
Simple code that reproduces your problem
import yfinance as yf
stock = yf.Ticker("FDQ.BE")
stock.get_fast_info() # same with stock.fast_info
Debug log
Traceback (most recent call last): File "/home/user/code/src/functions.py", line 11, in get_info_data fast_info = stock.get_fast_info() File "/home/user/code/venv/lib/python3.10/site-packages/yfinance/scrapers/quote.py", line 165, in getitem return getattr(self, k) File "/home/user/code/venv/lib/python3.10/site-packages/yfinance/scrapers/quote.py", line 255, in currency self._currency = md["currency"] KeyError: 'currency'
Bad data proof
I think it could be easily solved by doing .get() of the dictionary. Knowing that all the response parameters have a default value of None, the get() would make them keep the None value and return a dictionary with those parameters to None as the user expects instead of throwing an error.
yfinance
version0.2.40
Python version
3.10.12
Operating system
Ubuntu 22.04