【发布时间】:2018-09-18 02:37:14
【问题描述】:
我对 R 比较陌生,发现它对我的编码之旅非常宝贵,所以首先:感谢所有贡献者!
我正在编写一些关于期权交易的代码,但我遇到了一些 RQuantLib 函数的问题。我正在尝试使用“美国/纽约证券交易所”日历“添加”日期。如果您运行下面的代码,您可以看到 businessDaysBetween 函数中的值与预期不符(注意返回的日期和天数或作为参数):
library(RQuantLib)
# This shows there is only one business day between the dates using the "UnitedStates/NYSE" calendar
businessDaysBetween(calendar = "UnitedStates/NYSE", from = as.Date("2010-06-20"), to = as.Date("2010-06-22"))
# And this next line of code should advance the date to "2010-06-22" but doesn't...
advance(calendar = "UnitedStates/NYSE", dates = as.Date("2010-06-20"), n = 1, timeUnit = 0)
任何帮助都将不胜感激!
最好的,
L
【问题讨论】:
-
您也可以将您的解决方案添加为答案(而不是作为问题的编辑)
标签: r