[Blotter-commits] r49 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 13 05:57:44 CET 2009


Author: peter_carl
Date: 2009-01-13 05:57:43 +0100 (Tue, 13 Jan 2009)
New Revision: 49

Modified:
   pkg/R/getBySymbol.R
Log:
- added 'Symbols' attribute for specifying symbol subsets


Modified: pkg/R/getBySymbol.R
===================================================================
--- pkg/R/getBySymbol.R	2009-01-12 04:54:16 UTC (rev 48)
+++ pkg/R/getBySymbol.R	2009-01-13 04:57:43 UTC (rev 49)
@@ -1,5 +1,5 @@
 `getBySymbol` <-
-function(Portfolio, Attribute, Date=NULL)
+function(Portfolio, Attribute, Symbols = NULL, Date=NULL)
 { # @author Peter Carl
 
     # DESCRIPTION:
@@ -23,7 +23,10 @@
         Date = time(Portfolio[[1]]$posPL[Date])
     table = xts(NULL, order.by=Date) 
       ## Need a reference time index
-    symbols=names(Portfolio)
+    if(is.null(Symbols))
+        symbols=names(Portfolio)
+    else
+        symbols = Symbols
     for (i in 1:length(symbols)) 
         table = merge(table, Portfolio[[i]]$posPL[Date,Attribute,drop=FALSE])
     colnames(table) = symbols



More information about the Blotter-commits mailing list