Skip to content
Prev 8505 / 15274 Next

QuantStrat Using ^NYA

Hi All,

First, hats off to all involved in the quantstrat and related projects - very impressive stuff.

I ran the bbands.R example from the demo using the supplied stock.str = 'IBM' and the program ran to completion without a problem. However, when I tried to run the the demo script with stock.str = '^NYA' the program couldn't find the stock data. Looks like the symbol in the portfolio retains the leading '^' but the getSymbol brings in the data and uses NYA as the symbol.

The following shows the input and error message
[1] "USD"
[1] "X.NYA"
[1] "bbands"
[1] "bbands"
+ arguments = list(HLC = quote(HLC(mktdata)), maType='SMA'))
+ arguments = list(columns=c("Close","up"),relationship="gt"),label="Cl.gt.UpperBand")
+ arguments = list(columns=c("Close","dn"),relationship="lt"),label="Cl.lt.LowerBand")
+ arguments = list(columns=c("High","Low","mavg"),relationship="op"),label="Cross.Mid")
[1] "NYA"
Error in get(symbol) : object '^NYA' not found
[1] "strat execution time:"
Time difference of 0.00999999 secs
Error in get(Symbol, envir = as.environment(.GlobalEnv)) : 
  object '^NYA' not found
In addition: Warning messages:
1: In getInstrument(symbol) :
  instrument ^NYA not found, please create it first.
2: In getInstrument(Symbol) :
  instrument ^NYA not found, please create it first.
3: In .updatePosPL(Portfolio = pname, Symbol = as.character(symbol),  :
  Instrument ^NYA  not found, things may break
Any insights would be appreciated.

Dan Avery
   
________________________________________