Notebook Exception

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

this line:

# Get the quarterly income statement from yfinance
income_data_yfinance = stock_yf_ticker.quarterly_income_stmt.T
income_data_yfinance

will always get a: 

Exception: yfinance failed to decrypt Yahoo data response

running this notebook online btw

tried running local but I get the same exception, it might be related to yfinance, has enybody experienced this before? 

Hello Sebastian,

Many people have experienced this issue. It has been open since Feb 2023 and hasn't been solved yet. The reason for this issue is that Yahoo has encoded the data stores embedded in HTML that yfinance relied upon.

Until this issue gets resolved, 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.income_statement("q")  #Pass 'q' to get quarterly data, pass nothing to get annual data



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.