[R-SIG-Finance] quantstrat and nonstandard column names in the price series
Vladimir Egorin
vegorin at yahoo.com
Thu Feb 10 15:58:10 CET 2011
I continued with your example to see if I could figure out
how to add another symbol to the portfolio, and generate
orders for that symbol from a signal that is based on a
different symbol. I didn't get far unfortunately; in the
context of the previous example, I created a different
time series :
# copy the original series and create a second ticker
TU = xts(values, as.Date(alldates))
colnames(TU) <- 'TU'
# Then added it to the portfolio
currency("USD")
symbols =
c("FV","TU")
for(symbol in symbols){ # establish trade-able
instruments
stock(symbol, currency="USD",multiplier=1)
}
Then I sourced the resulting script in R. It went through some dates
apparently, and then died:
[1] "setup completed"
Warning in max(i) : no non-missing arguments to max; returning -Inf
[1] "2011-01-07 FV -1000 @ 117.9922"
[1] "2011-01-13 FV 1000 @ 118.2734"
[1] "2011-01-13 FV -1000 @ 118.2734"
[1] "2011-01-19 FV 1000 @ 118.2344"
[1] "2011-01-19 FV -1000 @ 118.2344"
[1] "2011-01-20 FV 1000 @ 117.6562"
[1] "2011-01-20 FV 1000 @ 117.6562"
[1] "2011-01-25 FV -1000 @ 118.2422"
[1] "2011-01-25 FV -1000 @ 118.2422"
[1] "2011-01-27 FV 1000 @ 118.2891"
[1] "2011-01-27 FV -1000 @ 118.2891"
[1] "2011-02-01 FV 1000 @ 118.0703"
[1] "2011-02-01 FV 1000 @ 118.0703"
Warning in min(dindex[dindex > curIndex]) :
no non-missing arguments to min; returning Inf
Error in getPrice(mktdata, prefer = "FV") :
subscript out of bounds, no price was discernible from the data
--
Thanks, Vladimir
More information about the R-SIG-Finance
mailing list