[Blotter-commits] r1248 - pkg/quantstrat/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 13 20:44:14 CET 2012


Author: opentrades
Date: 2012-11-13 20:44:14 +0100 (Tue, 13 Nov 2012)
New Revision: 1248

Modified:
   pkg/quantstrat/R/paramsets.R
Log:
- introduced combine function
- converted result list in named list using portfolio names



Modified: pkg/quantstrat/R/paramsets.R
===================================================================
--- pkg/quantstrat/R/paramsets.R	2012-11-11 22:38:43 UTC (rev 1247)
+++ pkg/quantstrat/R/paramsets.R	2012-11-13 19:44:14 UTC (rev 1248)
@@ -370,7 +370,22 @@
     symbol.list <- as.list(.getSymbols)
     symbol.names <- names(.getSymbols)
 
+    combine <- function(...)
+    {
+        args <- list(...)
+
+        results <- list()
+        for(i in 1:length(args))
+        {
+            result <- args[[i]]
+
+            results[[result$portfolio.st]] <- result
+        }
+        return(results)
+    }
+
     results <- foreach(param.combo=iter(param.combos,by='row'), .packages='quantstrat',
+        .combine=combine, .multicombine=TRUE, .maxcombine=100,
         .export=c(env.functions, 'env.blotter', 'env.instrument', 'env.strategy', 'symbol.list', symbol.names)) %dopar%
     {
         if(verbose) print(param.combo)



More information about the Blotter-commits mailing list