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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 14 01:30:15 CEST 2014


Author: bodanker
Date: 2014-09-14 01:30:14 +0200 (Sun, 14 Sep 2014)
New Revision: 1631

Modified:
   pkg/quantstrat/R/paramsets.R
Log:
- Attempt to fix bug #5790; thanks to Jonathan Owen for the report and patch


Modified: pkg/quantstrat/R/paramsets.R
===================================================================
--- pkg/quantstrat/R/paramsets.R	2014-09-06 20:39:44 UTC (rev 1630)
+++ pkg/quantstrat/R/paramsets.R	2014-09-13 23:30:14 UTC (rev 1631)
@@ -402,6 +402,7 @@
 
     env.functions <- c('clone.portfolio', 'clone.orderbook', 'install.param.combo')
     env.instrument <- as.list(FinancialInstrument:::.instrument)
+    symbols <- names(getPortfolio(portfolio.st)$symbols)
 
     if(is.null(audit))
         .audit <- new.env()
@@ -454,7 +455,7 @@
         .verbose=verbose, .errorhandling='pass',
         .packages=c('quantstrat', packages),
         .combine=combine, .multicombine=TRUE, .maxcombine=max(2,nrow(param.combos)),
-        .export=c(env.functions, 'env.instrument'), ...)
+        .export=c(env.functions, symbols), ...)
     # remove all but the param.combo iterator before calling %dopar%
     # this allows us to pass '...' through foreach to the expression
     fe$args <- fe$args[1]
@@ -480,6 +481,9 @@
 
         list2env(env.instrument, envir=FinancialInstrument:::.instrument)
 
+        for (sym in symbols)
+          assign(sym, get(sym), .GlobalEnv)
+
         put.portfolio(portfolio.st, portfolio)
         put.account(account.st, account)
         put.orderbook(portfolio.st, orderbook)



More information about the Blotter-commits mailing list