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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 3 19:14:30 CET 2012


Author: opentrades
Date: 2012-12-03 19:14:30 +0100 (Mon, 03 Dec 2012)
New Revision: 1272

Modified:
   pkg/quantstrat/R/ruleOrderProc.R
Log:
prefer bug fix by michaelnewell: prefer settings in rules now correctly overrule prefer setting in applyStrategy()



Modified: pkg/quantstrat/R/ruleOrderProc.R
===================================================================
--- pkg/quantstrat/R/ruleOrderProc.R	2012-11-28 19:02:51 UTC (rev 1271)
+++ pkg/quantstrat/R/ruleOrderProc.R	2012-12-03 18:14:30 UTC (rev 1272)
@@ -54,7 +54,7 @@
     if(is.null(timestamp)) return()
     orderbook <- getOrderBook(portfolio)
     ordersubset <- orderbook[[portfolio]][[symbol]]
-    
+
     # get open orders
     OpenOrders.i=NULL
     #TODO calculate timespan here?
@@ -67,6 +67,7 @@
     if (!(length(OpenOrders.i)>=1)){
         return(NULL)  
     } else {
+    	
         mktdataTimestamp <- mktdata[timestamp]
         # only keep the last observation per time stamp
         if( NROW(mktdataTimestamp) > 1 ) mktdataTimestamp <- last(mktdataTimestamp)
@@ -80,6 +81,9 @@
             txnprice=NULL
 
             txnfees=ordersubset[ii,"Txn.Fees"]
+            
+            orderPrefer=ordersubset[ii, "Prefer"]
+            if(!orderPrefer=="") prefer=orderPrefer
 
             orderPrice <- as.numeric(ordersubset[ii,"Order.Price"])
 



More information about the Blotter-commits mailing list