[Blotter-commits] r501 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Dec 15 22:27:22 CET 2010
Author: braverock
Date: 2010-12-15 22:27:22 +0100 (Wed, 15 Dec 2010)
New Revision: 501
Modified:
pkg/quantstrat/R/orders.R
Log:
- apply patch to non-unique grep bug in getOrders suggested by Aleksandr Rudnev < alex <dot> rudnev<at> gmail <dot> com > as an improvement over grep()
Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R 2010-12-15 19:44:47 UTC (rev 500)
+++ pkg/quantstrat/R/orders.R 2010-12-15 21:27:22 UTC (rev 501)
@@ -74,7 +74,8 @@
#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)))
+ if(!any(names(orderbook[[portfolio]]) == symbol)) stop(paste("symbol",symbol,"does not exist in portfolio",portfolio,"having symbols",names(orderbook[[portfolio]])))
ordersubset<-orderbook[[portfolio]][[symbol]]
#data quality checks
More information about the Blotter-commits
mailing list