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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 28 19:23:31 CET 2012


Author: braverock
Date: 2012-11-28 19:23:30 +0100 (Wed, 28 Nov 2012)
New Revision: 1269

Modified:
   pkg/quantstrat/R/applyStrategy.rebalancing.R
Log:
- apply rebalance rule(s) after applyRules.  this is slower, will revert, but wanted it in svn for reference

Modified: pkg/quantstrat/R/applyStrategy.rebalancing.R
===================================================================
--- pkg/quantstrat/R/applyStrategy.rebalancing.R	2012-11-27 14:08:30 UTC (rev 1268)
+++ pkg/quantstrat/R/applyStrategy.rebalancing.R	2012-11-28 18:23:30 UTC (rev 1269)
@@ -144,17 +144,19 @@
                     applyRules(portfolio=portfolio, symbol=symbol, strategy=s, mktdata=md_subset, Dates=NULL, indicators=sret$indicators, signals=sret$signals, parameters=parameters,  ..., path.dep=TRUE)
                     #)
                 }
-                
+            } #end loop over symbols for this sub-period
+            
                 #ret[[portfolio]][[symbol]]<-sret
                 
-                #now call the rebalancing rules
-                #to nest different rebalancing periods, we need to check if the pindex 'i' is in specific rebalance_on periods
-                # specifically, we need to check if *this* index is in st$plist$period
-                for(period in names(st$plist)){
-                    if(pindex[i] %in% st$plist[[period]]){
-                        #this index is a rebalancing index for period
-                        #call the rebalance rules for this period
-                        #still need to separate the rules by rebalancing period, this will call them all
+            #now call the rebalancing rules
+            #to nest different rebalancing periods, we need to check if the pindex 'i' is in specific rebalance_on periods
+            # specifically, we need to check if *this* index is in st$plist$period
+            for(period in names(st$plist)){
+                if(pindex[i] %in% st$plist[[period]]){
+                    #this index is a rebalancing index for period
+                    #call the rebalance rules for this period
+                    #still need to separate the rules by rebalancing period, this will call them all
+                    for (symbol in symbols){
                         ruleProc(s$rules$rebalance,
                                 timestamp=pindex[i], 
                                 path.dep=TRUE, 
@@ -166,7 +168,7 @@
                                 symbol=symbol)
                     }
                 }
-            } #end loop over symbols for this sub-period
+            }
         }
         
         # updateStrat



More information about the Blotter-commits mailing list