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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 21 03:52:25 CET 2012


Author: opentrades
Date: 2012-11-21 03:52:24 +0100 (Wed, 21 Nov 2012)
New Revision: 1258

Modified:
   pkg/quantstrat/R/rules.R
Log:
fixed inconsistency where rules.R was setting lte and gte for OHLC, whereas ruleOrderProc counted with lt and gt; remains mostly undetected
but in some cases it lead to dindex pointing to a timestamp that did not meet fill requirements, with weird effects in orderbook



Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R	2012-11-21 02:28:48 UTC (rev 1257)
+++ pkg/quantstrat/R/rules.R	2012-11-21 02:52:24 UTC (rev 1258)
@@ -364,6 +364,7 @@
                             col<-first(colnames(mktdata)[has.Ask(mktdata,which=TRUE)])
                         } else if (isOHLCmktdata) {
                             col<-first(colnames(mktdata)[has.Hi(mktdata,which=TRUE)])
+                            relationship="gt" #look for places where Mkt Bid >= our Ask
                         } else { #univariate or something built with fn_SpreadBuilder  
                             col<-first(colnames(mktdata)[grep(prefer, colnames(mktdata))])
                             # perhaps we need a has.Price check
@@ -375,6 +376,7 @@
                             col<-first(colnames(mktdata)[has.Bid(mktdata,which=TRUE)])
                         } else if (isOHLCmktdata) {
                             col<-first(colnames(mktdata)[has.Lo(mktdata,which=TRUE)])
+                            relationship="lt" #look for places where Mkt Ask <= our Bid
                         } else {
                             col<-first(colnames(mktdata)[grep(prefer, colnames(mktdata))])
                         }    
@@ -416,6 +418,7 @@
                             col<-first(colnames(mktdata)[has.Ask(mktdata,which=TRUE)])
                         } else if (isOHLCmktdata) {
                             col<-first(colnames(mktdata)[has.Lo(mktdata,which=TRUE)])
+                            relationship="lt" #look for places where Mkt Ask <= our Bid
                         } else {
                             col<-first(colnames(mktdata)[grep(prefer, colnames(mktdata))])
                         }    
@@ -427,6 +430,7 @@
                             col<-first(colnames(mktdata)[has.Bid(mktdata,which=TRUE)])
                         } else if (isOHLCmktdata) {
                             col<-first(colnames(mktdata)[has.Hi(mktdata,which=TRUE)])
+                            relationship="gt" #look for places where Mkt Bid >= our Ask
                         } else {
                             col<-first(colnames(mktdata)[grep(prefer, colnames(mktdata))])
                         }    



More information about the Blotter-commits mailing list