I need help in explaining a discrepancy in dividend adjusted prices using quantmod::adjustOHLC
.
Get adjusted and unadjusted prices for AAPL:
library(quantmod)
getSymbols("AAPL")
AAPL.adjusted <- adjustOHLC(AAPL, adjust=c("dividend"), symbol.name="AAPL")
Last dividend for AAPL was on 2016-08-04 for 0.57 cents.
div <- getDividends("AAPL", from = "1900-01-01")
tail(div)
# [,1]
# 2015-05-07 0.52
# 2015-08-06 0.52
# 2015-11-05 0.52
# 2016-02-04 0.52
# 2016-05-05 0.57
# 2016-08-04 0.57
For the period 5/5/2016 through 8/3/2016, when adjustOHLC
when called to adjust only for dividends my expectation is for it to deduct 0.57 cents from OHLC prices for these dates.
But, I don't see an exact difference of 0.57 cents when computing differences between unadjusted and adjusted closing prices.
div <- coredata(AAPL["2016-05-05/2016-08-03"][,"AAPL.Close"] -
AAPL.adjusted["2016-05-05/2016-08-03"][,"AAPL.Close"])
hist(div)
In the plotted histogram, most prices are not close to 0.57.
Looking into code of adjustOHLC
, computed adjustment factors are
identical for the interested date range
div <- getDividends("AAPL", from = "1900-01-01")
splits <- getSplits("AAPL", from = "1900-01-01")
div <- div * 1/adjRatios(splits=merge(splits, index(div)))[, 1]
ratios <- adjRatios(splits, div, Cl(AAPL))
length(ratios["2016-05-05/2016-08-03"][, "Div"])
# [1] 63
table(ratios["2016-05-05/2016-08-03"][, "Div"])
# 0.994611967155573
# 63
Why there is so much variation in differences of unadjusted and adjusted closing prices?