[Blotter-commits] r777 - in pkg/blotter: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 13 16:00:53 CEST 2011


Author: gsee
Date: 2011-09-13 16:00:52 +0200 (Tue, 13 Sep 2011)
New Revision: 777

Modified:
   pkg/blotter/DESCRIPTION
   pkg/blotter/R/chart.Posn.R
   pkg/blotter/R/updatePosPL.R
Log:
 - env argument can now be passed to updatePortf.  Thanks to Charlie Friedemann pointing out problem.
 - do not require Symbol to be passed to chart.Posn


Modified: pkg/blotter/DESCRIPTION
===================================================================
--- pkg/blotter/DESCRIPTION	2011-09-13 02:22:14 UTC (rev 776)
+++ pkg/blotter/DESCRIPTION	2011-09-13 14:00:52 UTC (rev 777)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Tools for transaction-oriented trading systems
     development.
-Version: 0.8.3
+Version: 0.8.4
 Date: $Date$
 Author: Peter Carl, Brian G. Peterson
 Maintainer: Brian G. Peterson <brian at braverock.com>

Modified: pkg/blotter/R/chart.Posn.R
===================================================================
--- pkg/blotter/R/chart.Posn.R	2011-09-13 02:22:14 UTC (rev 776)
+++ pkg/blotter/R/chart.Posn.R	2011-09-13 14:00:52 UTC (rev 777)
@@ -4,7 +4,7 @@
 #' @note Expect changes to this function, since the underlying charts are experimental functions in quantmod.
 #'
 #' @param Portfolio string identifying the portfolio to chart
-#' @param Symbol string identifying the symbol to chart
+#' @param Symbol string identifying the symbol to chart. If missing, the first symbol found in the \code{Portfolio} portfolio will be used
 #' @param Dates xts ISO 8601 style subsetting
 #' @param \dots any other passthru parameters to \code{\link[quantmod]{chart_Series}}
 #' @export
@@ -12,7 +12,7 @@
 { # @author Peter Carl
     pname<-Portfolio
     Portfolio<-getPortfolio(pname)
-
+    if (missing(Symbol)) Symbol <- names(Portfolio$symbols)[[1]]
     # FUNCTION
 
     require(quantmod)

Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2011-09-13 02:22:14 UTC (rev 776)
+++ pkg/blotter/R/updatePosPL.R	2011-09-13 14:00:52 UTC (rev 777)
@@ -22,9 +22,12 @@
 	    warning(paste("Instrument",Symbol," not found, things may break"))
 		tmp_instr<-list(currency="USD",multiplier=1)
     }
-	
-	if(is.null(Prices)){
-		prices=getPrice(get(Symbol, envir=as.environment(.GlobalEnv)),...=...)
+    dargs <- list(...)
+    if(!is.null(dargs$env)) {env <- dargs$env} else env=.GlobalEnv
+    if(!is.null(dargs$symbol)) {symbol<-dargs$symbol} else symbol=NULL
+    if(!is.null(dargs$prefer)) {prefer<-dargs$prefer} else prefer=NULL
+    if(is.null(Prices)){
+		prices=getPrice(get(Symbol, pos=env), symbol=symbol, prefer=prefer)
 	} else {
         prices=Prices
     }



More information about the Blotter-commits mailing list