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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 26 16:22:56 CEST 2013


Author: opentrades
Date: 2013-05-26 16:22:55 +0200 (Sun, 26 May 2013)
New Revision: 1472

Modified:
   pkg/quantstrat/R/paramsets.R
Log:
- doRedis timeout patch, thanks to Kent Huxsey



Modified: pkg/quantstrat/R/paramsets.R
===================================================================
--- pkg/quantstrat/R/paramsets.R	2013-05-21 17:18:49 UTC (rev 1471)
+++ pkg/quantstrat/R/paramsets.R	2013-05-26 14:22:55 UTC (rev 1472)
@@ -460,9 +460,31 @@
         clone.portfolio(portfolio.st, result$portfolio.st)
         clone.orderbook(portfolio.st, result$portfolio.st)
 
+        if(exists('redisGetContext'))
+        {
+            # assume we are using a doRedis parallel backend
+            # store the context, and close the connection
+            # patch to prevent timeout on large data sets
+            #
+            # thanks to Kent Hoxsey for this workaround
+
+            redisContext <- redisGetContext()
+            redisClose()
+        }
+
         strategy <- install.param.combo(strategy, param.combo, paramset.label)
         applyStrategy(strategy, portfolios=result$portfolio.st, mktdata=mktdata, verbose=verbose)
 
+        if(exists('redisContext'))
+        {
+            # assume redisContext contains preserved context
+            # restore doRedis connection
+            #
+            # thanks to Kent Hoxsey for this workaround
+
+            redisConnect(host=redisContext$host)
+        }
+
         if(calc == 'slave')
         {
             updatePortf(result$portfolio.st, Dates=paste('::',as.Date(Sys.time()),sep=''), Prices=mktdata)



More information about the Blotter-commits mailing list