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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 27 23:52:30 CEST 2012


Author: opentrades
Date: 2012-06-27 23:52:30 +0200 (Wed, 27 Jun 2012)
New Revision: 1077

Modified:
   pkg/quantstrat/R/ruleOrderProc.R
   pkg/quantstrat/R/rules.R
Log:
* fixed midnight timestamp / timespan format bug in rules.R
* promoted warning() for orderside/qty-sign of exit/all orders in ruleOrderProc.R to stop() condition



Modified: pkg/quantstrat/R/ruleOrderProc.R
===================================================================
--- pkg/quantstrat/R/ruleOrderProc.R	2012-06-27 21:48:51 UTC (rev 1076)
+++ pkg/quantstrat/R/ruleOrderProc.R	2012-06-27 21:52:30 UTC (rev 1077)
@@ -97,8 +97,7 @@
                 orderside<-ordersubset[ii, "Order.Side"]
                 if(((orderQty>0 && orderside=='long') || (orderQty<0 && orderside=='short')))
                 {
-                    warning('trying to exit/all position but orderQty sign is wrong')
-                    orderQty = 0		
+                    stop('trying to exit/market/all position but orderQty sign does not match orderside')
                 }
             }
             orderQty<-as.numeric(orderQty)

Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R	2012-06-27 21:48:51 UTC (rev 1076)
+++ pkg/quantstrat/R/rules.R	2012-06-27 21:52:30 UTC (rev 1077)
@@ -667,7 +667,7 @@
                         } else {
                             #(mktdata, portfolio, symbol, timestamp, slippageFUN=NULL)
                             if (isTRUE(path.dep)){
-                                timespan<-paste("::",timestamp,sep='')
+				timespan <- format(index(mktdata)[curIndex], "::%Y-%m-%d %H:%M:%S %OS6")
                             } else timespan=NULL
                             ruleOrderProc(portfolio=portfolio, symbol=symbol, mktdata=mktdata, timespan=timespan, ...)
                         }



More information about the Blotter-commits mailing list