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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 5 00:12:07 CET 2014


Author: bodanker
Date: 2014-03-05 00:12:04 +0100 (Wed, 05 Mar 2014)
New Revision: 1586

Modified:
   pkg/quantstrat/R/ruleOrderProc.R
Log:
- avoid throwing warnings when handling time in force in ruleOrderProc


Modified: pkg/quantstrat/R/ruleOrderProc.R
===================================================================
--- pkg/quantstrat/R/ruleOrderProc.R	2014-02-23 01:48:16 UTC (rev 1585)
+++ pkg/quantstrat/R/ruleOrderProc.R	2014-03-04 23:12:04 UTC (rev 1586)
@@ -68,13 +68,13 @@
   tif.xts <- ordersubset[OpenOrders.i, 'Time.In.Force']
   if(any(!tif.xts==''))
   {
-    if (class(index(ordersubset))=='Date')
+    if (any(indexClass(ordersubset)=='Date'))
         tif <- as.Date(tif.xts)
     else
     {
         tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%0S')
-        if(is.na(tif))
-		tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%S')
+        tif.na <- is.na(tif)
+		tif[tif.na] <- strptime(tif.xts[tif.na], format='%Y-%m-%d %H:%M:%S')
     }
 
     #check which ones should be expired



More information about the Blotter-commits mailing list