[Blotter-commits] r569 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Mar 8 21:31:57 CET 2011
Author: braverock
Date: 2011-03-08 21:31:57 +0100 (Tue, 08 Mar 2011)
New Revision: 569
Modified:
pkg/quantstrat/R/orders.R
Log:
- explicitly set prefer
Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R 2011-03-08 19:15:54 UTC (rev 568)
+++ pkg/quantstrat/R/orders.R 2011-03-08 20:31:57 UTC (rev 569)
@@ -466,10 +466,10 @@
} else if(isBBOmktdata){
# check side/qty
if(orderQty > 0){ # positive quantity 'buy'
- if(orderPrice >= as.numeric(getPrice(mktdataTimestamp,prefer='offer'))){
+ if(orderPrice >= as.numeric(getPrice(mktdataTimestamp,prefer='ask'))){
# price we're willing to pay is higher than the offer price, so execute at the prevailing price
#txnprice = orderPrice
- txnprice = as.numeric(getPrice(mktdataTimestamp,prefer=prefer)) #presumes unique timestamps
+ txnprice = as.numeric(getPrice(mktdataTimestamp,prefer='ask')) #presumes unique timestamps
txnprice = orderPrice
txntime = timestamp
} else next()
@@ -477,7 +477,7 @@
if(orderPrice <= as.numeric(getPrice(mktdataTimestamp,prefer='bid'))){
# we're willing to sell at a better price than the bid, so execute at the prevailing price
# txnprice = orderPrice
- txnprice = as.numeric(getPrice(mktdataTimestamp,prefer=prefer)) #presumes unique timestamp
+ txnprice = as.numeric(getPrice(mktdataTimestamp,prefer='bid')) #presumes unique timestamp
txntime = timestamp
} else next()
}
More information about the Blotter-commits
mailing list