[Blotter-commits] r742 - in pkg/blotter: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 25 23:12:43 CEST 2011
Author: braverock
Date: 2011-08-25 23:12:43 +0200 (Thu, 25 Aug 2011)
New Revision: 742
Modified:
pkg/blotter/DESCRIPTION
pkg/blotter/NAMESPACE
pkg/blotter/R/calcPortfWgt.R
pkg/blotter/R/calcPosAvgCost.R
pkg/blotter/R/calcTxnAvgCost.R
pkg/blotter/R/calcTxnValue.R
pkg/blotter/R/getByPortf.R
pkg/blotter/R/getBySymbol.R
pkg/blotter/R/getPortfAcct.R
pkg/blotter/R/getPortfolio.R
pkg/blotter/R/getPosAvgCost.R
pkg/blotter/R/initPosPL.R
pkg/blotter/R/initSummary.R
pkg/blotter/R/initTxn.R
pkg/blotter/R/tradeStats.R
pkg/blotter/R/updatePortf.R
pkg/blotter/R/updatePosPL.R
pkg/blotter/man/PortfReturns.Rd
pkg/blotter/man/addDiv.Rd
pkg/blotter/man/addPortfInstr.Rd
pkg/blotter/man/addTxn.Rd
pkg/blotter/man/addTxns.Rd
pkg/blotter/man/blotter-package.Rd
pkg/blotter/man/calcPortfWgt.Rd
pkg/blotter/man/calcPosAvgCost.Rd
pkg/blotter/man/calcTxnAvgCost.Rd
pkg/blotter/man/calcTxnValue.Rd
pkg/blotter/man/chart.Posn.Rd
pkg/blotter/man/chart.Reconcile.Rd
pkg/blotter/man/chart.Spread.Rd
pkg/blotter/man/dailyTxnPL.Rd
pkg/blotter/man/extractTxns.Rd
pkg/blotter/man/getAccount.Rd
pkg/blotter/man/getByPortf.Rd
pkg/blotter/man/getBySymbol.Rd
pkg/blotter/man/getEndEq.Rd
pkg/blotter/man/getPortfAcct.Rd
pkg/blotter/man/getPortfolio.Rd
pkg/blotter/man/getPos.Rd
pkg/blotter/man/getPosAvgCost.Rd
pkg/blotter/man/getPosQty.Rd
pkg/blotter/man/getTxns.Rd
pkg/blotter/man/initAcct.Rd
pkg/blotter/man/initPortf.Rd
pkg/blotter/man/initPosPL.Rd
pkg/blotter/man/initSummary.Rd
pkg/blotter/man/initTxn.Rd
pkg/blotter/man/pennyPerShare.Rd
pkg/blotter/man/tradeStats.Rd
pkg/blotter/man/updateAcct.Rd
pkg/blotter/man/updateEndEq.Rd
pkg/blotter/man/updatePortf.Rd
pkg/blotter/man/updatePosPL.Rd
Log:
- update roxygen/Rd documentation to get closer to passing R CMD check
- bump version
Modified: pkg/blotter/DESCRIPTION
===================================================================
--- pkg/blotter/DESCRIPTION 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/DESCRIPTION 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,28 +1,60 @@
Package: blotter
Type: Package
-Title: Tools for transaction-oriented trading systems development.
-Version: 0.8
+Title: Tools for transaction-oriented trading systems
+ development.
+Version: 0.8.1
Date: $Date$
Author: Peter Carl, Brian G. Peterson
Maintainer: Brian G. Peterson <brian at braverock.com>
-Description: Transaction infrastructure for defining instruments,
- transactions, portfolios and accounts for trading systems and
- simulation. Provides portfolio support for multi-asset class and
- multi-currency portfolios. Still in heavy development.
+Description: Transaction infrastructure for defining
+ instruments, transactions, portfolios and accounts for
+ trading systems and simulation. Provides portfolio
+ support for multi-asset class and multi-currency
+ portfolios. Still in heavy development.
License: GPL
LazyLoad: yes
-Depends: R (>= 2.11.1), xts (>= 0.7-6.17), quantmod (>= 0.3-14),
+Depends:
+ R (>= 2.11.1),
+ xts (>= 0.7-6.17),
+ quantmod (>= 0.3-14),
FinancialInstrument
-Suggests: PerformanceAnalytics, Hmisc, RUnit
-Contributors: Lance Levenson, Ben McCann, Joshua Ulrich, Wolfgang Wu,
+Suggests:
+ PerformanceAnalytics,
+ Hmisc,
+ RUnit
+Contributors: Lance Levenson, Ben McCann, Joshua Ulrich,
+ Wolfgang Wu,
URL: https://r-forge.r-project.org/projects/blotter/
Copyright: (c) 2008-2011
-Collate: 'addPortfInstr.R' 'addTxn.R' 'calcPortfWgt.R'
- 'calcPosAvgCost.R' 'calcTxnAvgCost.R' 'calcTxnValue.R'
- 'chart.Posn.R' 'chart.Reconcile.R' 'chart.Spread.R'
- 'extractTests.R' 'getAccount.R' 'getByPortf.R' 'getBySymbol.R'
- 'getEndEq.R' 'getPortfAcct.R' 'getPortfolio.R' 'getPosAvgCost.R'
- 'getPosQty.R' 'getPos.R' 'getTxn.R' 'initAcct.R' 'initPortf.R'
- 'initPosPL.R' 'initSummary.R' 'initTxn.R' 'PortfReturns.R'
- 'tradeStats.R' 'updateAcct.R' 'updateEndEq.R' 'updatePortf.R'
+Collate:
+ 'addPortfInstr.R'
+ 'addTxn.R'
+ 'calcPortfWgt.R'
+ 'calcPosAvgCost.R'
+ 'calcTxnAvgCost.R'
+ 'calcTxnValue.R'
+ 'chart.Posn.R'
+ 'chart.Reconcile.R'
+ 'chart.Spread.R'
+ 'extractTests.R'
+ 'getAccount.R'
+ 'getByPortf.R'
+ 'getBySymbol.R'
+ 'getEndEq.R'
+ 'getPortfAcct.R'
+ 'getPortfolio.R'
+ 'getPosAvgCost.R'
+ 'getPosQty.R'
+ 'getPos.R'
+ 'getTxn.R'
+ 'initAcct.R'
+ 'initPortf.R'
+ 'initPosPL.R'
+ 'initSummary.R'
+ 'initTxn.R'
+ 'PortfReturns.R'
+ 'tradeStats.R'
+ 'updateAcct.R'
+ 'updateEndEq.R'
+ 'updatePortf.R'
'updatePosPL.R'
Modified: pkg/blotter/NAMESPACE
===================================================================
--- pkg/blotter/NAMESPACE 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/NAMESPACE 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,25 +1,25 @@
+export(addDiv)
export(addPortfInstr)
export(addTxn)
-export(pennyPerShare)
-export(addDiv)
export(chart.Posn)
export(chart.Reconcile)
export(chart.Spread)
+export(dailyEqPL)
+export(dailyStats)
+export(dailyTxnPL)
export(extractTxns)
export(getAccount)
export(getEndEq)
export(getPortfolio)
-export(is.portfolio)
+export(getPos)
export(getPosQty)
-export(getPos)
export(getTxns)
export(initAcct)
export(initPortf)
+export(is.portfolio)
+export(pennyPerShare)
export(PortfReturns)
export(tradeStats)
-export(dailyTxnPL)
-export(dailyEqPL)
-export(dailyStats)
export(updateAcct)
export(updateEndEq)
export(updatePortf)
Modified: pkg/blotter/R/calcPortfWgt.R
===================================================================
--- pkg/blotter/R/calcPortfWgt.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/calcPortfWgt.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -6,9 +6,11 @@
#' @param Portfolio a portfolio object structured with initPortf()
#' @param Symbols an instrument identifier for a symbol included in the portfolio
#' @param Dates dates to return the calculation over formatted as xts range
-#' @param denominator
-#' @param Account
-calcPortfWgt <- function(Portfolio, Symbols = NULL, Dates = NULL, denominator = c('Gross.Value', 'Net.Value', 'Long.Value', 'Short.Value'), Account = NULL)
+#' @param denominator string describing the deniminator, see usage
+#' @param Account an Account object containing Portfolio summaries
+calcPortfWgt <- function(Portfolio, Symbols = NULL, Dates = NULL,
+ denominator = c('Gross.Value', 'Net.Value', 'Long.Value', 'Short.Value'),
+ Account = NULL)
{ # @author Peter Carl
# FUNCTION
Modified: pkg/blotter/R/calcPosAvgCost.R
===================================================================
--- pkg/blotter/R/calcPosAvgCost.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/calcPosAvgCost.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -6,6 +6,7 @@
#' @param TxnValue total value of the transaction, including fees
#' @param PosQty total units (shares) of the resulting position
#' @param ConMult multiplier from instrument data
+#' @rdname calcPosAvgCost
.calcPosAvgCost <- function(PrevPosQty, PrevPosAvgCost, TxnValue, PosQty, ConMult=1)
{ # @author Peter Carl
if(PosQty == 0)
Modified: pkg/blotter/R/calcTxnAvgCost.R
===================================================================
--- pkg/blotter/R/calcTxnAvgCost.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/calcTxnAvgCost.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -3,6 +3,7 @@
#' @param TxnQty total units (shares) of the transaction
#' @param ConMult multiplier from instrument data
#' @return TxnAvgCost: unit normalized (per share) cost implied by the transaction
+#' @rdname calcTxnAvgCost
.calcTxnAvgCost <- function(TxnValue, TxnQty, ConMult=1)
{ # @author Peter Carl
TxnAvgCost = TxnValue/(TxnQty*ConMult)
Modified: pkg/blotter/R/calcTxnValue.R
===================================================================
--- pkg/blotter/R/calcTxnValue.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/calcTxnValue.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -4,6 +4,7 @@
#' @param TxnFees fees associated with the transaction, e.g. commissions
#' @param ConMult multiplier from instrument data
#' @return TxnValue: total dollar value of the transaction, including fees
+#' @rdname calcTxnValue
.calcTxnValue <- function(TxnQty, TxnPrice, TxnFees, ConMult=1)
{ # @author Peter Carl
TxnValue = TxnQty * TxnPrice * ConMult - TxnFees
Modified: pkg/blotter/R/getByPortf.R
===================================================================
--- pkg/blotter/R/getByPortf.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/getByPortf.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -10,8 +10,9 @@
#' 'Realized.PL', 'Unrealized.PL', or 'Trading.PL'
#' @param Account an Account object containing Portfolio summaries
#' @param Attribute column name to be assembled for each symbol
-#' @param Dates
+#' @param Dates dates to return the calculation over formatted as xts range
#' @return regular xts object of values by portfolio
+#' @rdname getByPortf
.getByPortf <- function(Account, Attribute, Dates=NULL)
{ # @author Peter Carl
Modified: pkg/blotter/R/getBySymbol.R
===================================================================
--- pkg/blotter/R/getBySymbol.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/getBySymbol.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -8,10 +8,11 @@
#' 'Pos.Qty', 'Pos.Value', 'Txn.Value', 'Realized.PL', 'Unrealized.PL',or 'Trading.PL'
#' @param Portfolio a portfolio object containing transactions
#' @param Attribute column name to be assembled for each symbol
-#' @param Dates
-#' @param Symbols
-#' @param native
+#' @param Symbols an instrument identifier for a symbol included in the portfolio
+#' @param Dates dates to return the calculation over formatted as xts range
+#' @param native whether to use the currency of the portfolio, or convert, default FALSE
#' @return regular xts object of values by symbol
+#' @rdname getBySymbol
.getBySymbol <- function(Portfolio, Attribute, Dates=NULL, Symbols=NULL, native=FALSE)
{ # @author Peter Carl
Modified: pkg/blotter/R/getPortfAcct.R
===================================================================
--- pkg/blotter/R/getPortfAcct.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/getPortfAcct.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -2,6 +2,7 @@
#' @param Account account string
#' @param Portfolio portfolio string
#' @param Dates date subset as an xts style ISO 8601 string
+#' @rdname getPortfAcct
.getPortfAcct <- function(Account,Portfolio, Dates=NULL) #should symbol subsets be supported too? probably not.
{ # @author Brian Peterson
acct<-suppressWarnings(try(get(paste("account",Account,sep='.'),envir=.blotter),silent=TRUE))
Modified: pkg/blotter/R/getPortfolio.R
===================================================================
--- pkg/blotter/R/getPortfolio.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/getPortfolio.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -26,6 +26,7 @@
#' string \code{x} and tested. Otherwise, the object passed will be tested.
#'
#' @param x an object or string to be tested as a portfolio
+#' @param \dots any other passthru parameters
#' @seealso \code{\link{getPortfolio}}
#' @export
is.portfolio <- function(x,...)
Modified: pkg/blotter/R/getPosAvgCost.R
===================================================================
--- pkg/blotter/R/getPosAvgCost.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/getPosAvgCost.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -5,6 +5,7 @@
#' @param Symbol an instrument identifier for a symbol included in the portfolio
#' @param Date timestamp as of which to have the most recent position
#' @return Numeric value of the average cost of the current position
+#' @rdname getPosAvgCost
.getPosAvgCost <- function(Portfolio, Symbol, Date)
{ # @author Peter Carl
pname<-Portfolio
Modified: pkg/blotter/R/initPosPL.R
===================================================================
--- pkg/blotter/R/initPosPL.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/initPosPL.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -9,6 +9,7 @@
#' @param initPosQty initial position, default is zero
#' @param initConMult initial contract multiplier, default is one(1)
#' @param initCcyMult initial currency multiplier, default is one(1)
+#' @rdname initPosPL
.initPosPL <- function(initDate="1950-01-01", ..., initPosQty=0, initConMult=1, initCcyMult=1) #TODO add other init values to function as well for cost basis
{ # @author Peter Carl
posPL <- xts( as.matrix(t(c(initPosQty,initConMult,initCcyMult,0,0,0,0,0,0,0,0))), order.by=as.POSIXct(initDate, ...=...), ...=... )
Modified: pkg/blotter/R/initSummary.R
===================================================================
--- pkg/blotter/R/initSummary.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/initSummary.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,6 +1,7 @@
#' initialize the summary table used in portfolio and account lists
#' @param initDate date prior to the first close price given, used to contain initial account equity and initial position
#' @param \dots any other passthrough parameters
+#' @rdname initSummary
.initSummary <- function(initDate="1950-01-01",...)
{ # @author Brian Peterson
summary <- xts( as.matrix(t(rep(0,9))), order.by=as.POSIXct(initDate,...=...), ...=... )
Modified: pkg/blotter/R/initTxn.R
===================================================================
--- pkg/blotter/R/initTxn.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/initTxn.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -5,6 +5,7 @@
#' @param initPosQty initial position, default is zero
#' @param \dots any other passthrough parameters
#' @return Constructs multi-column xts object used to store transactions
+#' @rdname initTxn
.initTxn <- function(initDate="1950-01-01", initPosQty=0, ...)
{ # @author Peter Carl
## TODO: Add 'Txn.Type' column
Modified: pkg/blotter/R/tradeStats.R
===================================================================
--- pkg/blotter/R/tradeStats.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/tradeStats.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -33,7 +33,7 @@
#' @aliases dailyStats
#' @param Portfolios portfolio string
#' @param Symbols character vector of symbol strings, default NULL
-#' @param uses for dailyStats, determines whether numbers are calculated from trades or equity curve
+#' @param use for dailyStats, determines whether numbers are calculated from trades or equity curve
#' @author Lance Levenson
#' @export
#' @note
@@ -181,6 +181,7 @@
#' @param Symbols character vector of symbol strings
#' @param drop.time remove time component of POSIX datestamp (if any), default TRUE
#' @author Brian G. Peterson
+#' @seealso tradeStats
#' @export
dailyTxnPL <- function(Portfolios, Symbols, drop.time=TRUE)
{
@@ -223,6 +224,7 @@
return(ret)
}
+#' @rdname dailyTxnPL
#' @export
dailyEqPL <- function(Portfolios, Symbols, drop.time=TRUE)
{
@@ -267,6 +269,7 @@
return(ret)
}
+#' @rdname tradeStats
#' @export
dailyStats <- function(Portfolios,use=c('Equity','Txns'))
{
Modified: pkg/blotter/R/updatePortf.R
===================================================================
--- pkg/blotter/R/updatePortf.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/updatePortf.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -13,7 +13,7 @@
#' @param Symbols character vector identifying symbols to update the portfolio for, default NULL
#' @param Dates xts-style ISO-8601 time range to run updatePortf over, default NULL (will use times from Prices
#' @param Prices optional xts object containing prices and timestamps to mark the book on, default NULL
-#' @param dots any other passthrough parameters
+#' @param \dots any other passthrough parameters
#' @export
#' @callGraph
updatePortf <- function(Portfolio, Symbols=NULL, Dates=NULL, Prices=NULL, ...)
Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/R/updatePosPL.R 2011-08-25 21:12:43 UTC (rev 742)
@@ -8,6 +8,7 @@
#' @param \dots any other passthru parameters
#' @return Regular time series of position information and PL
#' @author Peter Carl, Brian Peterson
+#' @rdname updatePosPL
.updatePosPL <- function(Portfolio, Symbol, Dates=NULL, Prices=NULL, ConMult=NULL, ...)
{ # @author Peter Carl, Brian Peterson
rmfirst=FALSE
Modified: pkg/blotter/man/PortfReturns.Rd
===================================================================
--- pkg/blotter/man/PortfReturns.Rd 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/man/PortfReturns.Rd 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,22 +1,46 @@
\name{PortfReturns}
\alias{PortfReturns}
-\title{Calculate portfolio instrument returns...}
-\usage{PortfReturns(Account, method=c("contribution"), ..., Dates, Portfolios)}
-\description{Calculate portfolio instrument returns}
-\details{This function (for now) calculates return on initial equity for each instrument
-in the portfolio or portfolios that make up an account. These columns will be additive
-to return on capital of each portfolio, or of the entire account.
+\title{Calculate portfolio instrument returns}
+\usage{
+ PortfReturns(Account, method = c("contribution"), ...,
+ Dates = NULL, Portfolios = NULL)
+}
+\arguments{
+ \item{Account}{string name of the account to generate
+ returns for}
-This function exists because of R/Finance community requests by Mark Breman and Thomas Bolton}
-\note{TODO handle portfolio and account in different currencies (not hard, just not done)
+ \item{method}{for now, only 'contribution' is supported}
-TODO explicitly handle portfolio weights
+ \item{\dots}{any other passthru parameters (like
+ \code{native} for \code{.getBySymbol}}
-TODO provide additional methods of calculating returns
+ \item{Dates}{xts style ISO 8601 date subset to retrieve,
+ default NULL (all dates)}
-TODO support additions and withdrawals to available capital}
-\arguments{\item{Account}{string name of the account to generate returns for}
-\item{method}{for now, only 'contribution' is supported}
-\item{\dots}{any other passthru parameters (like \code{native} for \code{.getBySymbol}}
-\item{Dates}{xts style ISO 8601 date subset to retrieve, default NULL (all dates)}
-\item{Portfolios}{concatenated string vector for portfolio names to retrieve returns on, default NULL (all portfolios)}}
+ \item{Portfolios}{concatenated string vector for
+ portfolio names to retrieve returns on, default NULL (all
+ portfolios)}
+}
+\description{
+ This function (for now) calculates return on initial
+ equity for each instrument in the portfolio or portfolios
+ that make up an account. These columns will be additive
+ to return on capital of each portfolio, or of the entire
+ account.
+}
+\details{
+ This function exists because of R/Finance community
+ requests by Mark Breman and Thomas Bolton
+}
+\note{
+ TODO handle portfolio and account in different currencies
+ (not hard, just not done)
+
+ TODO explicitly handle portfolio weights
+
+ TODO provide additional methods of calculating returns
+
+ TODO support additions and withdrawals to available
+ capital
+}
+
Modified: pkg/blotter/man/addDiv.Rd
===================================================================
--- pkg/blotter/man/addDiv.Rd 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/man/addDiv.Rd 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,18 +1,43 @@
\name{addDiv}
\alias{addDiv}
\title{Add cash dividend transactions to a portfolio.}
-\usage{addDiv(Portfolio, Symbol, TxnDate, DivPerShare, ..., TxnFees=0,
- ConMult, verbose=TRUE)}
-\description{Add cash dividend transactions to a portfolio.}
-\details{Adding a cash dividend does not affect position quantity, like a split would.}
-\note{# TODO add TxnTypes to $txn table
+\usage{
+ addDiv(Portfolio, Symbol, TxnDate, DivPerShare, ...,
+ TxnFees = 0, ConMult = NULL, verbose = TRUE)
+}
+\arguments{
+ \item{Portfolio}{A portfolio name that points to a
+ portfolio object structured with
+ \code{\link{initPortf}}.}
-# TODO add AsOfDate}
-\arguments{\item{Portfolio}{A portfolio name that points to a portfolio object structured with \code{\link{initPortf}}.}
-\item{Symbol}{An instrument identifier for a symbol included in the portfolio, e.g., IBM.}
-\item{TxnDate}{Transaction date as ISO 8601, e.g., '2008-09-01' or '2010-01-05 09:54:23.12345'.}
-\item{DivPerShare}{The amount of the cash dividend paid per share or per unit quantity.}
-\item{\dots}{Any other passthrough parameters.}
-\item{TxnFees}{Fees associated with the transaction, e.g. commissions. See Details.}
-\item{verbose}{If TRUE (default) the function prints the elements of the transaction in a line to the screen, e.g., "2007-01-08 IBM 50 @ 77.6". Suppress using FALSE.}
-\item{ConMult}{Contract or instrument multiplier for the Symbol if it is not dened in an instrument specication.}}
+ \item{Symbol}{An instrument identifier for a symbol
+ included in the portfolio, e.g., IBM.}
+
+ \item{TxnDate}{Transaction date as ISO 8601, e.g.,
+ '2008-09-01' or '2010-01-05 09:54:23.12345'.}
+
+ \item{DivPerShare}{The amount of the cash dividend paid
+ per share or per unit quantity.}
+
+ \item{\dots}{Any other passthrough parameters.}
+
+ \item{TxnFees}{Fees associated with the transaction, e.g.
+ commissions. See Details.}
+
+ \item{verbose}{If TRUE (default) the function prints the
+ elements of the transaction in a line to the screen,
+ e.g., "2007-01-08 IBM 50 @ 77.6". Suppress using FALSE.}
+
+ \item{ConMult}{Contract or instrument multiplier for the
+ Symbol if it is not dened in an instrument specication.}
+}
+\description{
+ Adding a cash dividend does not affect position quantity,
+ like a split would.
+}
+\note{
+ # TODO add TxnTypes to $txn table
+
+ # TODO add AsOfDate
+}
+
Modified: pkg/blotter/man/addPortfInstr.Rd
===================================================================
--- pkg/blotter/man/addPortfInstr.Rd 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/man/addPortfInstr.Rd 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,9 +1,19 @@
\name{addPortfInstr}
\alias{addPortfInstr}
-\title{add an instrument to a portfolio...}
-\usage{addPortfInstr(Portfolio, symbols, ...)}
-\description{add an instrument to a portfolio}
-\details{thanks to WolfGang Wu for making this function more usable}
-\arguments{\item{Portfolio}{portfolio identifier string}
-\item{symbols}{character vector of symbols to add to the portfolio}
-\item{\dots}{any other passthru parameters}}
+\title{add an instrument to a portfolio}
+\usage{
+ addPortfInstr(Portfolio, symbols, ...)
+}
+\arguments{
+ \item{Portfolio}{portfolio identifier string}
+
+ \item{symbols}{character vector of symbols to add to the
+ portfolio}
+
+ \item{\dots}{any other passthru parameters}
+}
+\description{
+ thanks to WolfGang Wu for making this function more
+ usable
+}
+
Modified: pkg/blotter/man/addTxn.Rd
===================================================================
--- pkg/blotter/man/addTxn.Rd 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/man/addTxn.Rd 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,31 +1,64 @@
\name{addTxn}
\alias{addTxn}
\title{Add transactions to a portfolio.}
-\usage{addTxn(Portfolio, Symbol, TxnDate, TxnQty, TxnPrice, ..., TxnFees=0,
- ConMult, verbose=TRUE)}
-\description{Add transactions to a portfolio.}
-\details{When a trade or adjustment is made to the Portfolio, the addTxn function
-calculates the value and average cost of the transaction, the change in
-position, the resulting positions average cost, and any realized profit
-or loss (net of fees) from the transaction. Then it stores the transaction
-and calculations in the Portfolio object.
+\usage{
+ addTxn(Portfolio, Symbol, TxnDate, TxnQty, TxnPrice, ...,
+ TxnFees = 0, ConMult = NULL, verbose = TRUE)
+}
+\arguments{
+ \item{Portfolio}{A portfolio name that points to a
+ portfolio object structured with \code{initPortf()}}
-Fees are indicated as negative values and will be subtracted from the
-transaction value. TxnFees can either be a fixed amount, or a function
-in which case the function is evaluated to
-determine the fee amount.
-The \code{pennyPerShare} function provides a simple example of a transaction cost
-function.}
-\note{The addTxn function will eventually also handle other transaction types,
-such as adjustments for corporate actions or expire/assign for options.}
-\seealso{\code{\link{addTxns}}, \code{\link{pennyPerShare}}, \code{\link{initPortf}}}
-\author{Peter Carl}
-\arguments{\item{Portfolio}{A portfolio name that points to a portfolio object structured with \code{initPortf()}}
-\item{Symbol}{An instrument identifier for a symbol included in the portfolio, e.g., "IBM"}
-\item{TxnDate}{Transaction date as ISO 8601, e.g., '2008-09-01' or '2010-01-05 09:54:23.12345'}
-\item{TxnQty}{Total units (such as shares or contracts) transacted. Positive values indicate a 'buy'; negative values indicate a 'sell'}
-\item{TxnPrice}{Price at which the transaction was done}
-\item{\dots}{Any other passthrough parameters}
-\item{TxnFees}{Fees associated with the transaction, e.g. commissions., See Details}
-\item{ConMult}{Contract/instrument multiplier for the Symbol if it is not dened in an instrument specication}
-\item{verbose}{If TRUE (default) the function prints the elements of the transaction in a line to the screen, e.g., "2007-01-08 IBM 50 @ 77.6". Suppress using FALSE.}}
+ \item{Symbol}{An instrument identifier for a symbol
+ included in the portfolio, e.g., "IBM"}
+
+ \item{TxnDate}{Transaction date as ISO 8601, e.g.,
+ '2008-09-01' or '2010-01-05 09:54:23.12345'}
+
+ \item{TxnQty}{Total units (such as shares or contracts)
+ transacted. Positive values indicate a 'buy'; negative
+ values indicate a 'sell'}
+
+ \item{TxnPrice}{Price at which the transaction was done}
+
+ \item{\dots}{Any other passthrough parameters}
+
+ \item{TxnFees}{Fees associated with the transaction, e.g.
+ commissions., See Details}
+
+ \item{ConMult}{Contract/instrument multiplier for the
+ Symbol if it is not dened in an instrument specication}
+
+ \item{verbose}{If TRUE (default) the function prints the
+ elements of the transaction in a line to the screen,
+ e.g., "2007-01-08 IBM 50 @ 77.6". Suppress using FALSE.}
+}
+\description{
+ When a trade or adjustment is made to the Portfolio, the
+ addTxn function calculates the value and average cost of
+ the transaction, the change in position, the resulting
+ positions average cost, and any realized profit or loss
+ (net of fees) from the transaction. Then it stores the
+ transaction and calculations in the Portfolio object.
+}
+\details{
+ Fees are indicated as negative values and will be
+ subtracted from the transaction value. TxnFees can either
+ be a fixed amount, or a function in which case the
+ function is evaluated to determine the fee amount. The
+ \code{pennyPerShare} function provides a simple example
+ of a transaction cost function.
+}
+\note{
+ The addTxn function will eventually also handle other
+ transaction types, such as adjustments for corporate
+ actions or expire/assign for options.
+}
+\author{
+ Peter Carl
+}
+\seealso{
+ \code{\link{addTxns}}, \code{\link{pennyPerShare}},
+ \code{\link{initPortf}}
+}
+
Modified: pkg/blotter/man/addTxns.Rd
===================================================================
--- pkg/blotter/man/addTxns.Rd 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/man/addTxns.Rd 2011-08-25 21:12:43 UTC (rev 742)
@@ -1,13 +1,37 @@
\name{addTxns}
\alias{addTxns}
-\title{Add multiple transactions to a portfolio...}
-\usage{addTxns(Portfolio, Symbol, TxnData, verbose=TRUE, ..., ConMult)}
-\description{Add multiple transactions to a portfolio}
-\seealso{\code{\link{addTxn}}, \code{\link{initPortf}}}
-\note{TODO figure out if we can fully vectorize this function to make it faster}
-\arguments{\item{Portfolio}{A portfolio name that points to a portfolio object structured with \code{\link{initPortf}}}
-\item{Symbol}{An instrument identifier for a symbol included in the portfolio, e.g., "IBM"}
-\item{TxnData}{An xts object containing all required txn fields}
-\item{\dots}{Any other passthrough parameters}
-\item{verbose}{If TRUE (default) the function prints the elements of the transaction in a line to the screen, e.g., "2007-01-08 IBM 50 @ 77.6". Suppress using FALSE.}
-\item{ConMult}{Contract or instrument multiplier for the Symbol if it is not dened in an instrument specication}}
+\title{Add multiple transactions to a portfolio}
+\usage{
+ addTxns(Portfolio, Symbol, TxnData, verbose = TRUE, ...,
+ ConMult = NULL)
+}
+\arguments{
+ \item{Portfolio}{A portfolio name that points to a
+ portfolio object structured with \code{\link{initPortf}}}
+
+ \item{Symbol}{An instrument identifier for a symbol
+ included in the portfolio, e.g., "IBM"}
+
+ \item{TxnData}{An xts object containing all required txn
+ fields}
+
+ \item{\dots}{Any other passthrough parameters}
+
+ \item{verbose}{If TRUE (default) the function prints the
+ elements of the transaction in a line to the screen,
+ e.g., "2007-01-08 IBM 50 @ 77.6". Suppress using FALSE.}
+
+ \item{ConMult}{Contract or instrument multiplier for the
+ Symbol if it is not dened in an instrument specication}
+}
+\description{
+ Add multiple transactions to a portfolio
+}
+\note{
+ TODO figure out if we can fully vectorize this function
+ to make it faster
+}
+\seealso{
+ \code{\link{addTxn}}, \code{\link{initPortf}}
+}
+
Modified: pkg/blotter/man/blotter-package.Rd
===================================================================
--- pkg/blotter/man/blotter-package.Rd 2011-08-25 21:08:51 UTC (rev 741)
+++ pkg/blotter/man/blotter-package.Rd 2011-08-25 21:12:43 UTC (rev 742)
@@ -6,28 +6,80 @@
Portfolio and transaction infrastructure for trading
}
\description{
-Transaction-oriented infrastructure for constructing transactions, portfolios and accounts for trading systems and simulation. Provides support for multi-asset class and multi-currency portfolios for backtesting and other financial research. Still in heavy development.
+Transaction-oriented infrastructure for constructing transactions, portfolios
+and accounts for trading systems and simulation. Provides support for
+multi-asset class and multi-currency portfolios for backtesting and other
+financial research. Still in heavy development.
}
\details{
-The blotter package provides infrastructure for developing trading systems and managing portfolios in R. Although the name might suggest a smaller scope, blotter provides functions for tracking trades and positions in portfolios, calculating profit-and-loss by position and portfolio, and tracking performance in a capital account.
+The blotter package provides infrastructure for developing trading systems and
+managing portfolios in R. Although the name might suggest a smaller scope,
+blotter provides functions for tracking trades and positions in portfolios,
+calculating profit-and-loss by position and portfolio, and tracking performance
+in a capital account.
-Blotter works with a companion package, \code{\link[FinancialInstrument:FinancialInstrument-package]{FinancialInstrument}}, that defines meta-data for tradeable contracts (referred to as "instruments", e.g., stocks, futures, options, etc.), so that blotter can support multi-asset portfolios, derivatives and multiple currencies. As used here, instruments are objects that define contract specifications for a tradable contract, such as IBM common stock. These objects include descriptive information and attributes that help identify and value the contract.
+Blotter works with a companion package,
+\code{\link[FinancialInstrument:FinancialInstrument-package]{FinancialInstrument
+}}, that defines meta-data for tradeable contracts (referred to as
+"instruments", e.g., stocks, futures, options, etc.), so that blotter can
+support multi-asset portfolios, derivatives and multiple currencies. As used
+here, instruments are objects that define contract specifications for a tradable
+contract, such as IBM common stock. These objects include descriptive
+information and attributes that help identify and value the contract.
-Blotter's scope is focused on the heirarchy of how transactions accumulate into positions, then into portfolios and an account. 'Transactions' are typically trades in an instrument - an amount bought or sold at a price and time. But other transaction types include splits, dividends, expirations, assignments, etc. (some of which are implemented currently, others are not).
+Blotter's scope is focused on the heirarchy of how transactions accumulate into
+positions, then into portfolios and an account. 'Transactions' are typically
+trades in an instrument - an amount bought or sold at a price and time. But
+other transaction types include splits, dividends, expirations, assignments,
+etc. (some of which are implemented currently, others are not).
-Those transactions are aggregated into 'positions'. Positions are held in a 'portfolio' that contains positions in several instruments. Positions are valued regularly (usually daily) using the price history associated with each instrument. That results in a position profit-and-loss (or PnL) statement that can be aggregated across the portfolio.
+Those transactions are aggregated into 'positions'. Positions are held in a
+'portfolio' that contains positions in several instruments. Positions are
+valued regularly (usually daily) using the price history associated with each
+instrument. That results in a position profit-and-loss (or PnL) statement that
+can be aggregated across the portfolio.
-Portfolios are associated with an 'account'. An account is modeled as a cash account where investments, withdrawals, management fees, and other capital account changes are made.
+Portfolios are associated with an 'account'. An account is modeled as a cash
+account where investments, withdrawals, management fees, and other capital
+account changes are made.
-The package also contains functions to help users evaluate portfolios, including charts and graphs to help with visualization. A small selection of post-trade metrics has been added recently, and is likely to change and expand as we hear more about what people want to calculate.
+The package also contains functions to help users evaluate portfolios, including
+charts and graphs to help with visualization. A small selection of post-trade
+metrics has been added recently, and is likely to change and expand as we hear
+more about what people want to calculate.
-Blotter's functions build and manipulate objects that are stored in an environment named ".blotter" rather than the global environment, \code{.GlobalEnv}. Objects may be listed using \code{ls(envir=.blotter)}. See \code{\link{environment}} for more detail.
+Blotter's functions build and manipulate objects that are stored in an
+environment named ".blotter" rather than the global environment,
+\code{.GlobalEnv}. Objects may be listed using \code{ls(envir=.blotter)}. See
+\code{\link{environment}} for more detail.
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/blotter -r 742
More information about the Blotter-commits
mailing list