Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Yahoo Finance OHLC data are split adjusted, but its dividends data are not #253
After an email exchange, Josh has asked me to open this issue:
quantmod assumes that the dividend data returned by Yahoo Finance is already back-adjusted for splits. See commit e4401fb.
Yahoo Finance has changed its reporting of pre-split dividend data
It looks like Yahoo Finance is now returning the raw dividend data, unadjusted for subsequent stock splits, and quantmod may need to be adjusted in order to reflect Yahoo Finance's current approach to reporting (unadjusted) pre-split dividends.
I know that CF Industries (NYSE:CF) split its stock 5:1 effective 2015-06-18, and that it paid dividends for all of 2015 at the rate of $1.50/share prior to the split and $0.30/share after the split.
This is how Yahoo Finance reports CF's dividend data for 2015:
Browse> debug: yahoo.URL <- .yahooURL(Symbol.name, from.posix, to.posix, "1d", "div", handle) Browse> debug: curl::curl_download(yahoo.URL, destfile = tmp, quiet = !verbose, handle = handle$ch) Browse> debug: fr <- read.csv(tmp) Browse> debug: fr <- xts(fr[, 2], as.Date(fr[, 1])) Browse> debug: colnames(fr) <- paste(Symbol.name, "div", sep = ".") Browse> yahoo.URL  "https://query2.finance.yahoo.com/v7/finance/download/CF?period1=0&period2=1540857600&interval=1d&events=div&crumb=FvEtMwCpG0o" Browse> fr['2015'] [,1] 2015-02-12 1.5 2015-05-13 1.5 2015-08-12 0.3 2015-11-12 0.3
These data confirm that Yahoo Finance is not reporting CF's pre-split dividends on a split-adjusted basis. If it were, all of the reported amounts in 2015 would be $0.30/share.
But Yahoo Finance is reporting pre-split OHLC on an inconsistent, split-adjusted basis
Although Yahoo Finance is not reporting CF's pre-split dividend data on a split-adjusted basis, as shown in the example above, it is reporting CF's pre-split OHLC data on a split-adjusted basis. This can be seen by applying getSymbols("CF"), which shows that Yahoo Finance is reporting the following closing prices for CF on the three trading days centered around CF's 5:1 stock split (effective 2015-06-18):
These data confirm that Yahoo Finance is reporting CF's pre-split OHLC prices on a split-adjusted basis, which is inconsistent with its reporting of CF's pre-split dividends (without adjusting for the split) as shown above.
Yahoo Finance also appears to be using its (inconsistently) reported pre-split OHLC data and pre-split dividend data in calculating and reporting incorrect pre-split adjusted closing prices
Although I calculate my own adjusted closing prices using Tiingo data and TTR::adjRatios(), and do not rely on Yahoo Finance's reported adjusted closing prices, I notice -- when I compare (x) my own calculated pre-split adjusted closing prices (as well as the pre-split adjusted closing prices reported by CapitalIQ and Bloomberg) with (y) the pre-split adjusted closing prices reported by Yahoo Finance -- that the Yahoo Finance pre-split adjusted closing prices are materially different.
Essentially, Yahoo appears to be mixing apples and oranges, using pre-split dividends that have not been adjusted for the split (and therefore loom 5X larger) to modify pre-split closing prices that have been adjusted for the split. The result is over-modification, and therefore incorrect reported adjusted closing prices. The error increases as you go backwards in time over the pre-split period, and encounter additional pre-split quarterly dividends that have not been adjusted retroactively for the split.