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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 22 04:13:56 CET 2012


Author: opentrades
Date: 2012-11-22 04:13:56 +0100 (Thu, 22 Nov 2012)
New Revision: 1262

Modified:
   pkg/quantstrat/R/ruleRevoke.R
   pkg/quantstrat/R/rules.R
Log:
added timespan indices to dindex list



Modified: pkg/quantstrat/R/ruleRevoke.R
===================================================================
--- pkg/quantstrat/R/ruleRevoke.R	2012-11-22 02:43:21 UTC (rev 1261)
+++ pkg/quantstrat/R/ruleRevoke.R	2012-11-22 03:13:56 UTC (rev 1262)
@@ -25,8 +25,6 @@
     pos <- getPosQty(portfolio, symbol, timestamp)
     if(pos == 0)
     {
-        #if(is.null(orderset)) orderset=NA
-
         updateOrders(portfolio=portfolio, 
                   symbol=symbol, 
                   timespan=timespan,

Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R	2012-11-22 02:43:21 UTC (rev 1261)
+++ pkg/quantstrat/R/rules.R	2012-11-22 03:13:56 UTC (rev 1262)
@@ -272,7 +272,11 @@
                     if(isTRUE(rule$path.dep)){ # only apply to path dependent rule
                         # check for sigcol, sigval, otherwise use all
                         if(is.null(rule$arguments$sigcol) | is.null(rule$arguments$sigval) ){
-                            assign.dindex(1:length(Dates))
+                            if(is.null(rule$timespan)) {
+                                assign.dindex(1:length(Dates))
+                            } else {
+                                assign.dindex(c(get.dindex(), which(.index(mktdata) %in% .index(mktdata[rule$timespan]))))
+                            }
                         } else {
                             if(is.null(rule$timespan)) {
                                 assign.dindex(c(get.dindex(),which(mktdata[,rule$arguments$sigcol] == rule$arguments$sigval)))



More information about the Blotter-commits mailing list