Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yahoo Finance OHLC data are split adjusted, but its dividends data are not #253

Closed
dcbarnard opened this issue Oct 31, 2018 · 1 comment
Closed
Assignees

Comments

@dcbarnard
Copy link

dcbarnard commented Oct 31, 2018

After an email exchange, Josh has asked me to open this issue:

Background

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.

Example

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[2]>
debug: yahoo.URL <- .yahooURL(Symbol.name, from.posix, to.posix, "1d",
   "div", handle)
Browse[2]>
debug: curl::curl_download(yahoo.URL, destfile = tmp, quiet = !verbose,
   handle = handle$ch)
Browse[2]>
debug: fr <- read.csv(tmp)
Browse[2]>
debug: fr <- xts(fr[, 2], as.Date(fr[, 1]))
Browse[2]>
debug: colnames(fr) <- paste(Symbol.name, "div", sep = ".")
Browse[2]> yahoo.URL
[1] "https://query2.finance.yahoo.com/v7/finance/download/CF?period1=0&period2=1540857600&interval=1d&events=div&crumb=FvEtMwCpG0o"
Browse[2]> 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):

2015-06-17 63.336
2015-06-18 64.250
2015-06-19 63.240

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.

@joshuaulrich joshuaulrich self-assigned this Oct 31, 2018
@eddelbuettel
Copy link

(Maybe reformat the headers in the above: use ### or #### or just bold.)

@joshuaulrich joshuaulrich added this to the Release 0.4-14 milestone Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants