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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 15 20:03:40 CET 2010


Author: braverock
Date: 2010-12-15 20:03:40 +0100 (Wed, 15 Dec 2010)
New Revision: 498

Modified:
   pkg/quantstrat/R/orders.R
Log:
- fix non-unique grep bug in getOrders reported by Aleksandr Rudnev < alex <dot> rudnev<at> gmail <dot> com >

Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R	2010-12-14 19:27:56 UTC (rev 497)
+++ pkg/quantstrat/R/orders.R	2010-12-15 19:03:40 UTC (rev 498)
@@ -74,7 +74,7 @@
     #if(is.null(timespan)) stop("timespan must be an xts style timestring")
     # get order book
     orderbook <- getOrderBook(portfolio)
-    if(!length(grep(symbol,names(orderbook[[portfolio]])))==1) stop(paste("symbol",symbol,"does not exist in portfolio",portfolio,"having symbols",names(orderbook)))
+    if(!length(grep(symbol,names(orderbook[[portfolio]])))>=1) stop(paste("symbol",symbol,"does not exist in portfolio",portfolio,"having symbols",names(orderbook)))
     ordersubset<-orderbook[[portfolio]][[symbol]]
 
     #data quality checks
@@ -131,7 +131,8 @@
 #' be useful for reporting on when stops have been triggered.
 #' 
 #' We have also modeled a 'stoptrailing' order, which may be used to model dynamic limit-based entry or exit.  
-#' If you set \code{tmult=TRUE} on a stoptrailing order, the size of the threshold will be set as a 
+#' If you set \code{tmult=TRUE} on a stoptrailing 
+order, the size of the threshold will be set as a 
 #' difference between the multiplier times the price and the current price at order entry.  in this way, a 10%
 #' trailing entry (exit) will not change in size from the current price as the price changes.  It is effectively 
 #' converted to a scalar at order entry.  While this functionality could change in the future, 



More information about the Blotter-commits mailing list