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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 13 17:57:40 CET 2010


Author: braverock
Date: 2010-11-13 17:57:40 +0100 (Sat, 13 Nov 2010)
New Revision: 446

Modified:
   pkg/quantstrat/R/traderules.R
Log:
- make sure order price sent to addOrder is numeric
- export getPosQty

Modified: pkg/quantstrat/R/traderules.R
===================================================================
--- pkg/quantstrat/R/traderules.R	2010-11-13 16:56:26 UTC (rev 445)
+++ pkg/quantstrat/R/traderules.R	2010-11-13 16:57:40 UTC (rev 446)
@@ -123,7 +123,7 @@
             }
         }
         if(!is.null(orderqty) & !orderqty == 0 & !is.null(orderprice)){
-            addOrder(portfolio=portfolio, symbol=symbol, timestamp=timestamp, qty=orderqty, price=orderprice, ordertype=ordertype, side=orderside, threshold=threshold, status="open", replace=replace , delay=delay, tmult=tmult, ...=..., TxnFees=TxnFees)
+            addOrder(portfolio=portfolio, symbol=symbol, timestamp=timestamp, qty=orderqty, price=as.numeric(orderprice), ordertype=ordertype, side=orderside, threshold=threshold, status="open", replace=replace , delay=delay, tmult=tmult, ...=..., TxnFees=TxnFees)
         }
     }
 }
@@ -202,6 +202,7 @@
 #' @param symbol identifier of the instrument to place orders for.  The name of any associated price objects (xts prices, usually OHLC) should match these
 #' @param timestamp timestamp coercible to POSIXct that will be the time the order will be inserted on 
 #' @seealso \code{\link{addPosLimit}},\code{\link{osMaxPos}}
+#' @export
 getPosLimit <- function(portfolio, symbol, timestamp){
     portf<-getPortfolio(portfolio)
     # try to get on timestamp, otherwise find the most recent



More information about the Blotter-commits mailing list