[R-SIG-Finance] does quantmod::adjustOHLC adust for dividends?
Vivek Rao
vivekrao4 at yahoo.com
Fri Jun 2 16:45:19 CEST 2017
(I tried sending this message before joining the group, but it was held for moderation.)
It appears that the adjustOHLC function of the quantmod package does not create an .Adjusted field
that reflects dividends.
The code
library("quantmod")
sym <- "IBM"
START.DATE = "2016-01-01"
div <- getDividends(sym,auto.assign=FALSE,from=START.DATE)
xx <- getSymbols(sym, from=START.DATE, src="yahoo", auto.assign=FALSE)
xx.a <- adjustOHLC(xx)
xx.uA <- adjustOHLC(xx, use.Adjusted=TRUE)
cat("\ndiv\n")
print(head(div))
cat("\nxx\n")
print(head(xx))
cat("\nxx.a\n")
print(head(xx.a))
cat("\nxx.uA\n")
print(head(xx.uA))
produces the output below. I'd expect that IBM.Adjusted field to have different values
at the beginning of the period, depending on whether one adjusts for dividends.
div
IBM.div
2016-02-08 1.3
2016-05-06 1.4
2016-08-08 1.4
2016-11-08 1.4
2017-02-08 1.4
2017-05-08 1.5
xx
IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
2016-01-04 135.60 135.97 134.24 135.95 5229400 135.95
2016-01-05 136.76 136.89 134.85 135.85 3924800 135.85
2016-01-06 134.38 135.58 133.62 135.17 4310900 135.17
2016-01-07 133.70 135.02 132.43 132.86 7025800 132.86
2016-01-08 133.18 133.82 131.32 131.63 4762700 131.63
2016-01-11 131.81 133.82 131.76 133.23 4974400 133.23
xx.a
IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
2016-01-04 135.60 135.97 134.24 135.95 5229400 135.95
2016-01-05 136.76 136.89 134.85 135.85 3924800 135.85
2016-01-06 134.38 135.58 133.62 135.17 4310900 135.17
2016-01-07 133.70 135.02 132.43 132.86 7025800 132.86
2016-01-08 133.18 133.82 131.32 131.63 4762700 131.63
2016-01-11 131.81 133.82 131.76 133.23 4974400 133.23
xx.uA
IBM.Open IBM.High IBM.Low IBM.Close IBM.Volume IBM.Adjusted
2016-01-04 135.60 135.97 134.24 135.95 5229400 135.95
2016-01-05 136.76 136.89 134.85 135.85 3924800 135.85
2016-01-06 134.38 135.58 133.62 135.17 4310900 135.17
2016-01-07 133.70 135.02 132.43 132.86 7025800 132.86
2016-01-08 133.18 133.82 131.32 131.63 4762700 131.63
2016-01-11 131.81 133.82 131.76 133.23 4974400 133.23
Vivek Rao
More information about the R-SIG-Finance
mailing list