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
896 stars 214 forks source link

Stock Splits #103

Closed hariravi closed 2 years ago

hariravi commented 2 years ago

Hi All,

This seems to be a new issue, but suddenly when I scrape the data, the prices are no longer adjusting for stock splits (which is strange because as of a few weeks ago stock splits seemed to be taken care of).

For instance, when I call the get_historical_price_data for AAPL from 2020-02-12 to 2020-02-19, the values are as follows (and regardless of whether I used close or adjusted close, the split was not corrected): {'2020-02-12': '327.20001220703125', '2020-02-13': '324.8699951171875', '2020-02-14': '324.95001220703125', '2020-02-18': '79.75', '2020-02-19': '80.90499877929688'}

One way of fixing this is calling the get_key_statistics_data() function and finding the most recent split and manually adjusting, but it seems like this behavior was unnecessary until about a week or so ago, perhaps Yahoo Finance themselves made some adjustments?

Thank you very much for the feedback and excellent repo!

hariravi commented 2 years ago

I'm actually at a bit of a loss, because the apple split was on 2020-08-31 based on 'lastSplitDate', but it seems like the split occurred on 02-18 based on the scraped data ... I think yahoo finance recently made a change/hopefully they fix it.

hariravi commented 2 years ago

Nevermind, it seems like this is a yahoo finance issue, as seen here as well: https://github.com/ranaroussi/yfinance/issues/906