[R-SIG-Finance] does quantmod::adjustOHLC adust for dividends?
Ilya Kipnis
ilya.kipnis at gmail.com
Fri Jun 2 16:47:20 CEST 2017
That's a function of yahoo data no longer adjusting for dividends.
On Fri, Jun 2, 2017 at 10:45 AM, Vivek Rao via R-SIG-Finance <
r-sig-finance at r-project.org> wrote:
> (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
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list