[R-SIG-Finance] quantmod package documentation
Andreas Voellenklee
wotuzu17 at gmail.com
Thu Nov 3 20:05:05 CET 2011
Hello,
I have some questions about the quantmod package documentation and the
function getSymbols.
1) altough I have quantmod_0.3-17 installed, the documentation says
it's version 0.3-8 from 2007-11-20. Maybe someone of the developer
group fix this?
2) I've seen code that uses a undocumented parameter adjust=TRUE in
getSymbols. I thought this would be a convenient way to retrieve and
adjust prices in one line of code, but the result is somewhat
surprising.
Let's compare these three different snippets:
Version 1:
> getSymbols("C") # retrieve unadjusted prices
[1] "C"
> head(C)
C.Open C.High C.Low C.Close C.Volume C.Adjusted
2007-01-03 55.66 56.28 54.72 55.25 2282100 499.32
2007-01-04 55.25 56.15 54.72 55.06 1658700 497.60
2007-01-05 55.00 55.05 54.46 54.77 1317900 494.98
2007-01-08 54.60 55.15 54.30 55.05 1236900 497.51
2007-01-09 55.01 55.15 54.19 54.57 1963000 493.17
2007-01-10 54.27 54.49 53.95 54.13 1744900 489.20
Version 2:
> getSymbols("C", adjust=TRUE) # retrieve adjusted prices
[1] "C"
> head(C)
C.Open C.High C.Low C.Close C.Volume C.Adjusted
2007-01-03 191.1241 193.2530 187.8963 189.7162 6646032 499.32
2007-01-04 189.7162 192.8066 187.8963 189.0638 4830539 497.60
2007-01-05 188.8578 189.0295 187.0036 188.0680 3838046 494.98
2007-01-08 187.4843 189.3729 186.4542 189.0295 3602155 497.51
2007-01-09 188.8921 189.3729 186.0764 187.3813 5716735 493.17
2007-01-10 186.3511 187.1066 185.2523 185.8704 5081575 489.20
Version 3:
> getSymbols("C") # retrieve unadjusted prices
> assign("C", adjustOHLC(get("C"),use.Adjusted=TRUE)) # adjust prices using quantmod::adjustOHLC
> head(C)
C.Open C.High C.Low C.Close C.Volume C.Adjusted
2007-01-03 503.0254 508.6286 494.5301 499.32 2282100 499.32
2007-01-04 499.3171 507.4508 494.5273 497.60 1658700 497.60
2007-01-05 497.0586 497.5105 492.1784 494.98 1317900 494.98
2007-01-08 493.4432 498.4137 490.7319 497.51 1236900 497.51
2007-01-09 497.1464 498.4117 489.7358 493.17 1963000 493.17
2007-01-10 490.4653 492.4535 487.5732 489.20 1744900 489.20
Does anybody know what the parameter adjust in Version 2 is supposed
to adjust? And why it's not documented?
Thanks,
Andreas
More information about the R-SIG-Finance
mailing list