ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
13k stars 2.3k forks source link

Why only limited history data can be downloaded for certain stocks? #737

Closed prRZ5F4LXZ closed 1 year ago

prRZ5F4LXZ commented 3 years ago

For some stocks (FSBC is one, but there should be other stocks that are problematic), the history data is incomplete. Does anybody know what is wrong? Is there a bug in the yahoo REST API? Thanks.

>>> import yfinance as yf
>>> t = yf.Ticker('FSBC')
>>> data = t.history(period='max')
>>> data
                 Open       High        Low      Close   Volume  Dividends  Stock Splits
Date
2021-05-04  20.000000  20.000000  20.000000  20.000000      100          0             0
2021-05-05  23.250000  25.459999  23.000000  24.250000  2211300          0             0
2021-05-06  24.010000  24.340000  23.830000  24.340000   210500          0             0
2021-05-07  24.490000  24.990000  24.059999  24.900000   196100          0             0
2021-05-10  25.150000  26.430000  24.900000  25.500000   153400          0             0
2021-05-11  25.750000  26.650000  25.242001  25.750000   140400          0             0
2021-05-12  25.799999  26.393000  23.930000  24.790001   145100          0             0
2021-05-13  24.600000  26.559999  24.400000  24.940001   124700          0             0
2021-05-14  24.820000  25.400000  24.760000  24.920000    23600          0             0
2021-05-17  25.110001  26.230000  25.110001  26.000000    11300          0             0
2021-05-18  26.320000  26.900000  25.181999  25.930000    73200          0             0
2021-05-19  26.120001  26.610001  25.155001  26.299999    66200          0             0
2021-05-20  26.370001  26.930000  26.320000  26.750000    82700          0             0
2021-05-21  26.809999  26.921000  26.167999  26.600000    13900          0             0
2021-05-24  26.860001  26.860001  25.629999  26.290001    54200          0             0
2021-05-25  26.250000  27.000000  26.000000  26.320000    23800          0             0
2021-05-26  26.530001  26.530001  25.660000  25.959999    21200          0             0
2021-05-27  25.799999  26.940001  25.799999  25.950001    16000          0             0
2021-05-28  26.299999  26.760000  25.750000  26.340000    21400          0             0
2021-06-01  26.799999  27.160000  25.750000  25.750000    56400          0             0
2021-06-02  25.750000  25.920000  24.760000  25.000000   111800          0             0
2021-06-03  24.950001  25.200001  24.440001  24.580000    91400          0             0
2021-06-04  24.879999  25.120001  24.709999  25.120001    28600          0             0
2021-06-07  25.240000  26.590000  25.174999  26.010000   114400          0             0
2021-06-08  26.010000  26.350000  25.440001  25.820000    73200          0             0
2021-06-09  25.780001  26.450001  25.059999  25.700001    86300          0             0
2021-06-10  25.629999  26.750000  25.212000  26.480000    78900          0             0
2021-06-11  26.469999  27.600000  25.730000  27.219999    94800          0             0
2021-06-14  27.299999  28.170000  27.120001  27.270000    97400          0             0
2021-06-15  27.010000  27.600000  26.705000  27.580000    83500          0             0
2021-06-16  27.549999  28.190001  26.559999  27.400000   170800          0             0
2021-06-17  27.500000  28.295000  27.010000  27.290001   154732          0             0
sfavorite commented 3 years ago

The stock you mentioned (FSBC) just started trading in May of 2021 - there is no older data.

If you aren't getting the results you expect lookup the stock on Yahoo Finance to check your expectations. It will help maintainers greatly before posting of issues.

prRZ5F4LXZ commented 3 years ago

No. That is wrong. Tradingview shows a much longer history.

https://www.tradingview.com/chart/?symbol=NASDAQ%3AFSBC

sfavorite commented 3 years ago

If Yahoo is wrong the issue should be posted with Yahoo, not here.

If you check the NASDAQ for this stock you will see they have the same time frame as Yahoo Finance (link posted above) and yfinance. Checking the Five Star Bancorp website you will see under investor relations they IPOed in May of 2021 matching what Yahoo Finance shows.

You will have to check with Tradingview about the price history they show which is clearly wrong.

No matter which site is correct, Yahoo Finance or Trading View, that isn't a yfinance issue. It is a problem with the data sources.

prRZ5F4LXZ commented 3 years ago

I see this, which is much less than other tickers (such as MSFT).

>>> import yfinance as yf
>>> ticker = yf.Ticker('GFNSZ')
>>> ticker.info
{'previousClose': 28.6, 'regularMarketOpen': 28.8074, 'twoHundredDayAverage': 26.646202, 'trailingAnnualDividendYield': None, 'payoutRatio': None, 'volume24Hr': None, 'regularMarketDayHigh': 28.8074, 'navPrice': None, 'averageDailyVolume10Day': 9300, 'totalAssets': None, 'regularMarketPreviousClose': 28.6, 'fiftyDayAverage': 28.203142, 'trailingAnnualDividendRate': None, 'open': 28.8074, 'toCurrency': None, 'averageVolume10days': 9300, 'expireDate': None, 'yield': None, 'algorithm': None, 'dividendRate': None, 'exDividendDate': None, 'beta': None, 'circulatingSupply': None, 'startDate': None, 'regularMarketDayLow': 28.68, 'priceHint': 2, 'currency': 'USD', 'regularMarketVolume': 513, 'lastMarket': None, 'maxSupply': None, 'openInterest': None, 'marketCap': None, 'volumeAllCurrencies': None, 'strikePrice': None, 'averageVolume': 19907, 'priceToSalesTrailing12Months': None, 'dayLow': 28.68, 'ask': 28.95, 'ytdReturn': None, 'askSize': 1100, 'volume': 513, 'fiftyTwoWeekHigh': 28.951, 'forwardPE': None, 'maxAge': 1, 'fromCurrency': None, 'fiveYearAvgDividendYield': None, 'fiftyTwoWeekLow': 24.81, 'bid': 28.68, 'tradeable': False, 'dividendYield': None, 'bidSize': 1800, 'dayHigh': 28.8074, 'exchange': 'NGM', 'shortName': 'General Finance Corporation - 7', 'exchangeTimezoneName': 'America/New_York', 'exchangeTimezoneShortName': 'EDT', 'isEsgPopulated': False, 'gmtOffSetMilliseconds': '-14400000', 'quoteType': 'EQUITY', 'symbol': 'GFNSZ', 'messageBoardId': 'finmb_24821932', 'market': 'us_market', 'regularMarketPrice': 28.68, 'logo_url': ''}

It seems that there is no much information about GFNSZ on the following page. So this is also a yahoo finance data source problem?

https://finance.yahoo.com/quote/GFNSZ/profile?p=GFNSZ

Do you know where to report problems about yahoo finance?

When profile data in yahoo finance is missing, what is the second best free alternative to yahoo finance to get the info (I am looking for sector & industry info at this moment)?

sfavorite commented 3 years ago

I am sorry I don't know how to file issues with Yahoo.

I want to help limit yfinance issues page to yfinance specific issues - the maintainers have enough to do :smiley: but MSFT is a much older company so more data.

You can find lots of stock information on the free tier at Financial Modeling Prep or Quandl which also has a free tier if Yahoo Finance doesn't fit your needs.