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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 24 22:15:47 CET 2010


Author: braverock
Date: 2010-02-24 22:15:45 +0100 (Wed, 24 Feb 2010)
New Revision: 259

Modified:
   pkg/quantstrat/R/rules.R
Log:
- always pass mktdata into ruleProc fn

Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R	2010-02-24 20:40:24 UTC (rev 258)
+++ pkg/quantstrat/R/rules.R	2010-02-24 21:15:45 UTC (rev 259)
@@ -124,6 +124,13 @@
             # see 'S Programming p. 67 for this matching
             fun<-match.fun(rule$name)
             
+            nargs <-list(...)
+            if(length(nargs)==0) nargs=NULL
+            if (length('...')==0 | is.null('...')) {
+                rm('...')
+                nargs=NULL
+            }
+            
             .formals  <- formals(fun)
             onames <- names(.formals)
             rule$arguments$timestamp=timestamp
@@ -178,18 +185,18 @@
             switch( type ,
                     pre = {
                         if(length(strategy$rules[[type]])>=1){
-                            ruleProc(strategy$rules$pre,timestamp=timestamp, path.dep=path.dep)    
+                            ruleProc(strategy$rules$pre,timestamp=timestamp, path.dep=path.dep, mktdata=mktdata)    
                         }
                     },
                     risk = {
                         if(length(strategy$rules$risk)>=1){
-                            ruleProc(strategy$rules$risk,timestamp=timestamp, path.dep=path.dep)    
+                            ruleProc(strategy$rules$risk,timestamp=timestamp, path.dep=path.dep, mktdata=mktdata)    
                         }       
                     },
                     order = {
                         if(isTRUE(hold)) next()
                         if(length(strategy$rules[[type]])>=1) {
-                            ruleProc(strategy$rules[[type]],timestamp=timestamp, path.dep=path.dep)
+                            ruleProc(strategy$rules[[type]],timestamp=timestamp, path.dep=path.dep, mktdata=mktdata)
                         } else {
                             #(mktdata, portfolio, symbol, timestamp, slippageFUN=NULL)
                             ruleOrderProc(portfolio=portfolio, symbol=symbol, mktdata=mktdata, timestamp=timestamp)
@@ -198,13 +205,13 @@
                     rebalance =, exit = , enter = {
                         if(isTRUE(hold)) next()    
                         if(length(strategy$rules[[type]])>=1) {
-                            ruleProc(strategy$rules$risk,timestamp=timestamp, path.dep=path.dep)
+                            ruleProc(strategy$rules[[type]],timestamp=timestamp, path.dep=path.dep, mktdata=mktdata)
                         }      
                     },
                     post = {
                         #TODO do we processfor hold here, or not?
                         if(length(strategy$rules$post)>=1) {
-                            ruleProc(strategy$rules$post,timestamp=timestamp, path.dep=path.dep)    
+                            ruleProc(strategy$rules$post,timestamp=timestamp, path.dep=path.dep, mktdata=mktdata)    
                         }
                     }
             ) # end switch            



More information about the Blotter-commits mailing list