0

嗨,我正在尝试从 Ilya Kipnis 的“Quantstrat I 的基本要素”中复制代码。我加载了以下代码:

 require(quantstrat)
 require(PerformanceAnalytics)
 initDate="1990-01-01"
 from="2003-01-01"
 to="2012-12-31"
 options(width=70)

 options("getSymbols.warning4.0"=FALSE)
 currency=('USD')
 Sys.setenv(TZ="UTC")

 symbols<- c("XLB","XLE","XLF","XLP".....
  if(!"XLB" %in% ls()) { 
  suppressMessages(getSymbols(symbols, from=from, to=to, src="yahoo",    adjust=TRUE))  
  }

 stock(symbols, currency="USD", multiplier=1)

但得到以下错误?

  Error in instrument(primary_id = primary_id, currency = currency,   multiplier = multiplier,  : 
  currency USD must be defined first

任何帮助,将不胜感激

4

1 回答 1

2

定义货币

currency(‘USD’)应该使用而不是

currency=(‘USD’)如你上面的代码

于 2015-02-15T14:06:57.463 回答