yfinance: yfinance 0.1.*: Unable to load ticker information

  • Info about your system: yfinance version: ‘0.1.90’
    • operating system: -windows
  • Simple code that reproduces your problem
ticker = 'AAPL'
print('ticker: %s'%(ticker))
yf_info = yf.Ticker(ticker)
bs = yf_info.balance_sheet
print(bs)
  • The error message Returns empty array: when I print bs Empty DataFrame Columns: [Open, High, Low, Close, Adj Close, Volume] Index: []

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 22
  • Comments: 51 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Same problem for me on all stocks it seems. I get {'regularMarketPrice': None, 'preMarketPrice': None, 'logo_url': ''} for any info

They are encrypting the store data (it seems with AES) using crypto-js library.

Deobfuscated code is doing something like this:

var key = PBKDF2.create({ keySize: 8 }).compute(t._cs, JSON.parse(t._cr))
var plaintext = AES.decrypt("U2FsdGVk...", key)
var decoded = JSON.parse(decodeURIComponent(plaintext)

I’ll continue deobfuscation, it seems I will be able to provide some working code sample soon.

Having similar issue, when trying to print regularMarketPrice and volume. printing yf.Ticker(ticker).info returns: {‘regularMarketPrice’: None, ‘preMarketPrice’: None, ‘logo_url’: ‘’, trailingPegRatio’:None} and print(yf.Ticker(‘AAPL’).info[‘volume’]) returns KeyError for ‘volume’

New release out that fixes this - 0.1.92

Same problem for me

Looks like Yahoo has encoded the data stores embedded in HTML that yfinance relied upon. E.g.

Before (via my session cache):

root.App || (root.App = {});
root.App.now = 1671025861087;
root.App.main = {"context":{"dispatcher":{"stores":{"PageStore":{"currentPageName":"quote", ...

After

> root.App || (root.App = {});
> root.App.now = 1671275144853;
> root.App.main = {"context":{"dispatcher":{"stores":"U2FsdGVkX18NwmzwZgyLozYcI3uwl2EXN\u002FWBnsSt9vGtBRZGAIiUIqV9mS1LKBRe42L1I1VjxC1qsKQ9g8KP4qeGBkrL28E0AG14...

Anyone able to decode this?

Same here. Problem seems to have started today, perhaps some issue with Yahoo or API.

Thanks for all the hard work guys. 0.1.93 confirmed behaving the same as prior

First time I have ever seen the open source collaboration process in action. Powerful. Thanks all. Especially @Rogach

@ValueRaider Seems I have a solution in PR #1253

This is the wrong place for PIP issues. Try here

New release 0.1.93, fixes Ticker.shares

Here’s the fully working example. Runs in NodeJS, has a dependency on crypto-js library.

var fs = require("fs");
var CryptoJS = require("crypto-js");

// replace the values with fresh values from root.App.main
var _cs = '7758ce68c359';
var _cr = '{"words":[1750977242,1882992877,448740864,329742483],"sigBytes":16}';
// place the root.App.main.context.dispatcher.stores into encrypted-stores.txt file
var stores = fs.readFileSync("encrypted-stores.txt", "utf8");

var key = CryptoJS.algo.PBKDF2.create({ keySize: 8 }).compute(_cs, JSON.parse(_cr)).toString();
var plaintext = CryptoJS.AES.decrypt(stores, key);
var decoded = JSON.parse(decodeURIComponent(escape(CryptoJS.enc.Latin1.stringify(plaintext))));

console.log(decoded);

I have to run now, don’t have the time to convert this to python, sorry.

@Travis-Barton good point. I’ve restored the balancesheet API and added a small summary changelog near top of README

Hello, I could make use of the help of more experienced people. I cannot retrieve info anymore, typically I get {‘regularMarketPrice’: None, ‘preMarketPrice’: None, ‘logo_url’: ‘’, ‘trailingPegRatio’: 2.164}. I tried to update yfinance to 0.1.93 using pip install yfinance --upgrade --no-cache-dir but only 0.1.87 was installed. I thank you in advance for your assistance.

New release 0.1.93, fixes Ticker.shares

Just checked -

+.shares +.financials +.quarterly_financials +.balance_sheet +.quarterly_balancesheet +.cashflow +.quarterly_cashflow +.dividends +.earnings +.quarterly_earnings +.recommendations

Everything seems to work fine with 0.1.93 again - thx for great work

@ValueRaider I think I found the problem! yf.version is returning 0.1.90.

had to restart visual studio code, heh… basic troubleshooting ftw?

Only thing which i recognized which was not working for me, was that i was not able to get the number of shares.

Good spot. I can fix this.

Everything seems to work fine with 0.1.92.

Only thing which i recognized which was not working for me, was that i was not able to get the number of shares.

e.g.

msft.shares

I tried to port but give up. None of the examples I found use a “words” array as the salt, most assume the salt is embedded in the encrypted text. Example