[Blotter-commits] r37 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Dec 23 13:38:53 CET 2008
Author: peter_carl
Date: 2008-12-23 13:38:53 +0100 (Tue, 23 Dec 2008)
New Revision: 37
Added:
pkg/R/getByPortf.R
Removed:
pkg/R/getByPortfolio.R
Log:
- changed function name for consistency
Copied: pkg/R/getByPortf.R (from rev 27, pkg/R/getByPortfolio.R)
===================================================================
--- pkg/R/getByPortf.R (rev 0)
+++ pkg/R/getByPortf.R 2008-12-23 12:38:53 UTC (rev 37)
@@ -0,0 +1,42 @@
+`getByPortf` <-
+function(Account, Attribute, Date=NULL)
+{ # @author Peter Carl
+
+ # DESCRIPTION:
+ # Retrieves calculated attributes for each portfolio in the account
+ # from the portfolio summary table. Assembles into a portfolio-by-time table
+
+ # Inputs
+ # Account: an Account object containing Portfolio summaries
+ # Attribute: column name to be assembled for each symbol, any of:
+ # 'Long.Value', 'Short.Value', 'Net.Value', 'Gross.Value', 'Txn.Fees',
+ # 'Realized.PL', 'Unrealized.PL', or 'Trading.PL'
+
+ # Outputs
+ # regular xts object of values by portfolio
+
+ # FUNCTION
+ if(is.null(Date)) # if no date is specified, get all available dates
+ Date = time(Account[[2]])
+ else
+ Date = time(Account[[2]][Date])
+ table = xts(NULL, order.by=Date)
+ ## Need a reference time index
+ portfolios=names(Account)[-1]
+ for (i in 1:length(portfolios))
+ table = merge(table, Account[[i+1]][Date,Attribute,drop=FALSE])
+ colnames(table) = portfolios
+ return(table)
+}
+
+###############################################################################
+# Blotter: Tools for transaction-oriented trading systems development
+# for R (see http://r-project.org/)
+# Copyright (c) 2008 Peter Carl and Brian G. Peterson
+#
+# This library is distributed under the terms of the GNU Public License (GPL)
+# for full details see the file COPYING
+#
+# $Id: $
+#
+###############################################################################
Property changes on: pkg/R/getByPortf.R
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: pkg/R/getByPortfolio.R
===================================================================
--- pkg/R/getByPortfolio.R 2008-12-23 04:13:14 UTC (rev 36)
+++ pkg/R/getByPortfolio.R 2008-12-23 12:38:53 UTC (rev 37)
@@ -1,42 +0,0 @@
-`getByPortfolio` <-
-function(Account, Attribute, Date=NULL)
-{ # @author Peter Carl
-
- # DESCRIPTION:
- # Retrieves calculated attributes for each portfolio in the account
- # from the portfolio summary table. Assembles into a portfolio-by-time table
-
- # Inputs
- # Account: an Account object containing Portfolio summaries
- # Attribute: column name to be assembled for each symbol, any of:
- # 'Long.Value', 'Short.Value', 'Net.Value', 'Gross.Value', 'Txn.Fees',
- # 'Realized.PL', 'Unrealized.PL', or 'Trading.PL'
-
- # Outputs
- # regular xts object of values by portfolio
-
- # FUNCTION
- if(is.null(Date)) # if no date is specified, get all available dates
- Date = time(Account[[2]])
- else
- Date = time(Account[[2]][Date])
- table = xts(NULL, order.by=Date)
- ## Need a reference time index
- portfolios=names(Account)[-1]
- for (i in 1:length(portfolios))
- table = merge(table, Account[[i+1]][Date,Attribute,drop=FALSE])
- colnames(table) = portfolios
- return(table)
-}
-
-###############################################################################
-# Blotter: Tools for transaction-oriented trading systems development
-# for R (see http://r-project.org/)
-# Copyright (c) 2008 Peter Carl and Brian G. Peterson
-#
-# This library is distributed under the terms of the GNU Public License (GPL)
-# for full details see the file COPYING
-#
-# $Id: $
-#
-###############################################################################
More information about the Blotter-commits
mailing list