Yfinance API is no longer working for fundamentals data as the encryption key has changed

Course Name: Getting Market Data: Stocks, Crypto, News & Fundamental, Section No: 8, Unit No: 1, Unit type: Notebook

Hi Vijay,



It is recommended to run the command 'pip install --upgrade yfinance' as mentioned at the beginning of the notebook. You can convert the cell from Raw NBConvert to a Code cell and restart the kernel. This way you can avoid errors due to any change(s) in the yfinance API.



Thanks.

While generally updating would work, in this case the issue cannot be solved with package update right now as the issue is currently open and has been since early Feb 2023 :Exception: yfinance failed to decrypt Yahoo data response · Issue #1407 · ranaroussi/yfinance · GitHub

If you have a solution to this please let me know. 

regards,

-VJ

 


Hello Vijay,
You are right, updating yfinance won't work here for this error. However, you could use yahooquery, another package just like yfinance accessing the Yahoo API, and is faster than yfinance. Example:

pip install yahooquery

from yahooquery import Ticker
aapl = Ticker('aapl')
aapl.balance_sheet() 

You can find documentation here: https://pypi.org/project/yahooquery/1.1.0/ to use different dictionaries and dataframes it has to offer to give your required information.

thanks Anudeep