[Blotter-commits] r511 - in pkg: blotter/R quantstrat/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 23 18:51:50 CET 2010


Author: braverock
Date: 2010-12-23 18:51:50 +0100 (Thu, 23 Dec 2010)
New Revision: 511

Modified:
   pkg/blotter/R/chart.Posn.R
   pkg/quantstrat/R/orders.R
Log:
- pass dots for prefer and tz of xts creation

Modified: pkg/blotter/R/chart.Posn.R
===================================================================
--- pkg/blotter/R/chart.Posn.R	2010-12-23 14:14:20 UTC (rev 510)
+++ pkg/blotter/R/chart.Posn.R	2010-12-23 17:51:50 UTC (rev 511)
@@ -13,7 +13,7 @@
 
     require(quantmod)
     Prices=get(Symbol)
-    if(!is.OHLC(Prices)) Prices=getPrice(Prices)
+    if(!is.OHLC(Prices)) Prices=getPrice(Prices, ...=...)
     freq = periodicity(Prices)
     switch(freq$scale,
             seconds = { mult=1 },

Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R	2010-12-23 14:14:20 UTC (rev 510)
+++ pkg/quantstrat/R/orders.R	2010-12-23 17:51:50 UTC (rev 511)
@@ -24,8 +24,9 @@
 #' @param portfolio text name of the portfolio to associate the order book with
 #' @param symbols a list of identfiers of the instruments to be contained in the Portfolio.  The name of any associated price objects (xts prices, usually OHLC) should match these
 #' @param initDate date (ISO8601) prior to the first close price given in mktdata, used to initialize the order book with a dummy order
+#' @param \dots any other passthrough parameters
 #' @export
-initOrders <- function(portfolio=NULL, symbols=NULL, initDate = '1999-12-31')
+initOrders <- function(portfolio=NULL, symbols=NULL, initDate = '1999-12-31', ...)
 {
     # NOTE we could store all of these in one object, but I think that might get big
     orders<- try(getOrderBook(portfolio),silent=TRUE)
@@ -35,7 +36,7 @@
         orders<-list()
         orders[[portfolio]]<-list()
     }
-    ordertemplate<-xts(as.matrix(t(c(0,NA,"init","long",0,"closed",as.character(as.POSIXct(initDate)),1,0))),order.by=as.POSIXct(initDate))
+    ordertemplate<-xts(as.matrix(t(c(0,NA,"init","long",0,"closed",as.character(as.POSIXct(initDate)),1,0))),order.by=as.POSIXct(initDate), ...=...)
     colnames(ordertemplate) <- c("Order.Qty","Order.Price","Order.Type","Order.Side","Order.Threshold","Order.Status","Order.StatusTime","Order.Set","Txn.Fees")
 
     if(is.null(symbols)) {
@@ -74,7 +75,6 @@
     #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(!any(names(orderbook[[portfolio]]) == symbol)) stop(paste("symbol",symbol,"does not exist in portfolio",portfolio,"having symbols",names(orderbook[[portfolio]])))
     ordersubset<-orderbook[[portfolio]][[symbol]]
 



More information about the Blotter-commits mailing list