我正在通过Guy Yollins量子演示和他的例子。我将以下几行代码粘贴到R:
中library(blotter)
currency("USD")
get("USD",envir=.instrument)
stock("SPY",currency="USD",multiplier=1)
get("SPY",envir=.instrument)
getSymbols('SPY', from='1998-01-01', to='2011-07-31', adjust=T)
SPY=to.monthly(SPY, indexAt='endof')
SPY$SMA10m <- SMA(Cl(SPY), 10)
#Initialize portfolio and account
b.strategy <- "bFaber"
initPortf(b.strategy,'SPY', initDate='1997-12-31')
initAcct(b.strategy,portfolios=b.strategy, initDate='1997-12-31', initEq=1e6)
全部来自他的演讲。然后我想列出所有变量:
ls(.blotter)
ls(.instrument)
输出如下:
> ls(.blotter)
[1] "account.bFaber" "portfolio.bFaber"
> ls(.instrument)
Error in as.environment(pos) :
no item called ".instrument" on the search list
In addition: Warning message:
In ls(.instrument) : ‘.instrument’ in Zeichenkette konvertiert
我错过了什么?为什么.instrument无效?