JECSand / yahoofinancials

A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
https://pypi.python.org/pypi/yahoofinancials
MIT License
899 stars 214 forks source link

ValueError: read of closed file from blank yahoofinance page #74

Closed dalder1 closed 1 year ago

dalder1 commented 4 years ago

When I call get_historical_price_data on a group of stocks if there is trouble returning any one of the stock's data I get this error and the program stops.

I am using the sp500 stocks and through trial and error have found that there are two stocks that cause this error because they have blank yahoofinance pages. The stocks are "BF.B" and "BRK.B".

What I am looking for is a way for the call to progress, so that when it finds these errored stocks it recognizes they error but then still continues on. I am thinking a try except block could fix this but am not familiar with the library codebase.

I also see that there was an issue like this a while back but it is closed so I assume this is a new issue

sylvandb commented 4 years ago

The yahoo ticker seems to be BF-B and BRK-B (a dash not a dot). This applies also to other companies with multiple share classes such as RDS.

dalder1 commented 4 years ago

Awesome thank a lot