带有日内数据的Quantstrat WFA

时间:2016-06-29 14:42:36

标签: r quantstrat

我已经让WFA在全天的GBPUSD 30分钟数据上运行,并且遇到了一些需要解决的事情。第一个是我相信save函数需要更改以从字符串中删除时间(如here所示,作为github上R-Finance / quantstrat repo上的pull请求)。 walk.forward函数抛出此错误:

Error in gzfile(file, "wb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "wb") :
  cannot open compressed file 'wfa.GBPUSD.2002-10-21 00:30:00.2002-10-23 23:30:00.RData', probable reason 'Invalid argument'

第二种情况是罕见的情况,它最终会在数据集上调用runSum,其行数少于您测试的时间段(n)。这是traceback()

8: stop("Invalid 'n'")
7: runSum(x, n)
6: runMean(x, n)
5: (function (x, n = 10, ...) 
   {
       ma <- runMean(x, n)
       if (!is.null(dim(ma))) {
       colnames(ma) <- "SMA"
   }
   return(ma)
   })(x = Cl(mktdata)[, 1], n = 25)
4: do.call(indFun, .formals)
3: applyIndicators(strategy = strategy, mktdata = mktdata, parameters = parameters, 
   ...)
2: applyStrategy(strategy, portfolios = portfolio.st, mktdata = symbol[testing.timespan]) at custom.walk.forward.R#122
1: walk.forward(strategy.st, paramset.label = "WFA", portfolio.st = portfolio.st, 
   account.st = account.st, period = "days", k.training = 3, 
   k.testing = 1, obj.func = my.obj.func, obj.args = list(x = quote(result$apply.paramset)), 
   audit.prefix = "wfa", anchored = FALSE, verbose = TRUE)

用于创建Luxor Demo的扩展GBPUSD数据包括一个错误的日期(2002/10/27),只有1个观察值导致了这个问题。我还可以预见,在Crude这样的仪器上测试更长的信号周期时,这是一个问题,他们在周日晚上(UTC)只有几个交易时间。

鉴于我纯粹一直在使用相同(扩展)的日内数据集来跟踪Luxor演示,这些是真正的问题还是由于软件包更新等引起的?

向QS的作者报告这些事情的首选方式是什么,并找出是否/何时可以进行修复?

SessionInfo()

R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                       LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] quantstrat_0.9.1739           foreach_1.4.3                 blotter_0.9.1741              PerformanceAnalytics_1.4.4000 FinancialInstrument_1.2.0     quantmod_0.4-5                TTR_0.23-1                   
[8] xts_0.9.874                   zoo_1.7-13                   

loaded via a namespace (and not attached):
[1] compiler_3.3.0   tools_3.3.0      codetools_0.2-14 grid_3.3.0       iterators_1.0.8  lattice_0.20-33 

1 个答案:

答案 0 :(得分:0)

quantstrat在github上: https://github.com/braverock/quantstrat

应通过github问题报告问题和补丁。