Since December 16, 2022 yfinance version incl. 1.90 does not work

2.3k Views Asked by At

Using as an example msft, I get: import yfinance as yf msft = yf.Ticker("MSFT") msft.info

As the result I only get the last four items from info, which also happens on other stocks. msft.balance_sheet, msft.financials also do not show any results. Only .dividends seems to work

Since the recent version suddenly stopped working, I changed to version 1.90 without success. I am working with Anaconda/jupyter and Visual Studio Code, both showing same results.

Thanks for any suggestion/help Jochen

1

There are 1 best solutions below

0
cheerfuldevelop On

Same here.

To examine the issue, I tried to scrape data from Yahoo Finance manually and it worked.

This gives me hope that the module yfinance will function again soon.

Maybe the code of the website was changed due to maintenance or implementing new features. They introduced new data boxes for dividend announcements recently.

Here is the Python code I used (Windows 10 Professional, Anaconda, Python Spyder, Python 3.7.4):

import requests
from bs4 import BeautifulSoup

page = requests.get('https://finance.yahoo.com/quote/MSFT/cash-flow?p=MSFT', headers={'USER-AGENT': "Mozilla/5.0"})
soup = BeautifulSoup(page.text, 'html.parser')

spans = soup.find_all('span')
for i in range(len(spans)):
    print(spans[i].contents)