[R-SIG-Finance] quantmod getOptionChain failing on one character symbol
Marc Delvaux
mdelvaux at gmail.com
Mon Aug 2 17:42:22 CEST 2010
While working on a script comparing options across a large number of
symbols, I hit a problem where symbols that are one character long
(specifically I was trying "C", "F" and "T") generate an error for
getOptionChain(). This was true for both a Linux and Windows system.
Below is an example for the Windows system, I upgraded quantmod from
R-forge to get a working getOptionChain() after the change in option
naming convention.
> Options <- getOptionChain("AAPL")
> str(Options)
List of 3
$ calls : num [1:41, 1:7] 140 145 150 155 160 165 170 175 180 185 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:41] "AAPL100821C00140000" "AAPL100821C00145000"
"AAPL100821C00150000" "AAPL100821C00155000" ...
.. ..$ : chr [1:7] "Strike" "Last" "Chg" "Bid" ...
$ puts : num [1:37, 1:7] 140 145 150 155 160 165 170 175 180 185 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:37] "AAPL100821P00140000" "AAPL100821P00145000"
"AAPL100821P00150000" "AAPL100821P00155000" ...
.. ..$ : chr [1:7] "Strike" "Last" "Chg" "Bid" ...
$ symbol: chr "AAPL"
> Options <- getOptionChain("C")
Error in calls[, 2] : incorrect number of dimensions
> Options <- getOptionChain("T")
Error in getOptionChain.yahoo(Symbols = "T") : subscript out of bounds
> Options <- getOptionChain("F")
Error in calls[, 2] : incorrect number of dimensions
> sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] quantmod_0.3-14 TTR_0.20-2 Defaults_1.1-1 xts_0.7-4
zoo_1.7-0
loaded via a namespace (and not attached):
[1] grid_2.11.1 lattice_0.18-8 tools_2.11.1
More information about the R-SIG-Finance
mailing list