Problem with yf.Ticker("XXXX").quarterly_income_stmt

Hello Everyone



Has anyone seen this error running the Fundamental (#7) notebook in the “Getting Market Data….” Module?


Define the yfinance stock ticker

stock_yf_ticker = yf.Ticker(‘AAPL’)

Get the quarterly income statement from yfinance

income_data_yfinance = stock_yf_ticker.quarterly_income_stmt.T

income_data_yfinance.

.

.

File ~/.conda/envs/quantra_py/lib/python3.9/site-packages/yfinance/data.py:311, in TickerData.get_json_data_stores(self, sub_page, proxy)

    308     keys += response_gh.text.splitlines()

    310 # Decrypt!

–> 311 stores = decrypt_cryptojs_aes_stores(data, keys)

    312 if stores is None:

    313     # Maybe Yahoo returned old format, not encrypted

    314     if "context" in data and "dispatcher" in data["context"]:



File ~/.conda/envs/quantra_py/lib/python3.9/site-packages/yfinance/data.py:162, in decrypt_cryptojs_aes_stores(data, keys)

    160             pass

    161     if not success:

–> 162         raise Exception("yfinance failed to decrypt Yahoo data response")

    164 decoded_stores = json.loads(plaintext)

    165 return decoded_stores



Exception: yfinance failed to decrypt Yahoo data response



The error message is rather terse

Hi Alain,



This looks like a yfinance library issue. yfinance is a third-party library and is not maintained by QuantInsti. We have observed that these issues usually get fixed within a few weeks. You can track the discussion on this GitHub link for this specific issue. We will also monitor the same and update the notebooks as soon as the issue gets resolved. However, in the meantime you can try getting data from some alternate sources. 



Thanks,

Akshay

Hi Akshay,



That is wth I surmised too , thanks for confirming :slight_smile:



Will monitor as suggested.



Have a nice day.



Alain