[Blotter-commits] r1713 - pkg/quantstrat/demo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Nov 11 20:49:55 CET 2015
Author: bodanker
Date: 2015-11-11 20:49:55 +0100 (Wed, 11 Nov 2015)
New Revision: 1713
Modified:
pkg/quantstrat/demo/luxor.8.walk.forward.R
Log:
Get luxor.8 closer to running
It seems unlikely this demo ever worked as committed. Even after
ensuring robustbase and PerformanceAnalytics are installed, changing
period="days" (since there isn't enough data for period="months"), and
running the luxor.5 demo before running luxor.8, there's still an error
caused by an attempt to calculate a 40+ period SMA on ~20 observations.
I'm not sure how to fix that last issue, but these seem like enough
changes for one commit. :)
See R-Forge issue #6258.
Modified: pkg/quantstrat/demo/luxor.8.walk.forward.R
===================================================================
--- pkg/quantstrat/demo/luxor.8.walk.forward.R 2015-11-02 17:48:45 UTC (rev 1712)
+++ pkg/quantstrat/demo/luxor.8.walk.forward.R 2015-11-11 19:49:55 UTC (rev 1713)
@@ -12,6 +12,7 @@
source(paste0(path.package("quantstrat"),"/demo/luxor.include.R"))
source(paste0(path.package("quantstrat"),"/demo/luxor.getSymbols.R"))
+source(paste0(path.package("quantstrat"),"/demo/luxor.5.strategy.ordersets.R"))
### foreach and doMC
@@ -19,6 +20,13 @@
require(doMC)
registerDoMC(cores=8)
+### robustbase and PerformanceAnalytics
+
+if (!requireNamespace("robustbase", quietly=TRUE))
+ stop("package 'robustbase' required, but not installed")
+if (!requireNamespace("PerformanceAnalytics", quietly=TRUE))
+ stop("package 'PerformanceAnalytics' required, but not installed")
+
### blotter
initPortf(portfolio.st, symbols='GBPUSD', initDate=initDate, currency='USD')
@@ -68,7 +76,20 @@
### walk.forward
-r <- walk.forward(strategy.st, paramset.label='WFA', portfolio.st=portfolio.st, account.st=account.st, period='months', k.training=3, k.testing=1, obj.func=my.obj.func, obj.args=list(x=quote(result$apply.paramset)), user.func=ess, user.args=list('account.st'=account.st, 'portfolio.st'=portfolio.st), audit.prefix='wfa', anchored=FALSE, verbose=TRUE)
+r <- 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)),
+ user.func=ess,
+ user.args=list('account.st'=account.st, 'portfolio.st'=portfolio.st),
+ audit.prefix='wfa',
+ anchored=FALSE,
+ verbose=TRUE)
### analyse
More information about the Blotter-commits
mailing list