【问题标题】:Error when using the getOptionChain() function in R with parameter 'Exp'在 R 中使用带有参数“Exp”的 getOptionChain() 函数时出错
【发布时间】:2017-07-02 18:38:18
【问题描述】:

当使用带有 par 'exp' 的 getOptionChain() 函数时,我收到以下错误,例如

 getOptionChain("AAPL",Exp=NULL) or getOptionChain("AAPL",Exp="2017"):

上面的代码产生了这个错误:

getOptionChain("AAPL", Exp = "2017") 中的错误:未使用的参数 (Exp = "2017")

不带任何参数的调用只会从雅虎检索 2 个不同的到期日期。
我正在使用:
R 版本 3.2.3 (2015-12-10) 平台:x86_64-w64-mingw32/x64(64位) quantmod_0.4-9

任何意见和建议将不胜感激

【问题讨论】:

  • 如果你使用“Exp”-参数,日期格式必须是ISO-8601 style。即日期:“2017-07-03”。 AAPL 使用“Exp = NULL”时,我得到 17 个选项系列。

标签: r options quantmod


【解决方案1】:

在 CRAN (0.4-10) 上使用当前版本的 quantmod 时没有出错。也许您需要升级?

R> aapl.opt <- quantmod::getOptionChain("AAPL", Exp = "2017")
R> names(aapl.opt)
 [1] "Jul.07.2017" "Jul.14.2017" "Jul.21.2017" "Jul.28.2017" "Aug.04.2017"
 [6] "Aug.11.2017" "Aug.18.2017" "Sep.15.2017" "Oct.20.2017" "Nov.17.2017"
[11] "Dec.15.2017"
R> packageVersion("quantmod")
[1] '0.4.10'

【讨论】:

  • 更新后运行正常。谢谢你的建议。
猜你喜欢
  • 2017-10-28
  • 2018-06-14
  • 1970-01-01
  • 2014-08-28
  • 2012-10-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多