AcctReturns: Calculate account returns

Description Usage Arguments Value Note Author(s) References See Also


Similar to the PortfReturns function, but gives returns for the entire account and takes into account external cashflows. External cashflows are defined as contributions to or withdrawals from the account. Allows selecting between time-weighted returns and linked modified Dietz approach. If time-weighted method is selected, returns at time t are computed using:


where V_{t} - account value at time t, C_{t} - cashflow at time t. The implicit assumption made here is that the cash flow is available for the portfolio manager to invest from the beginning of the day. These returns then can be chain linked with geometric compounding (for instance using Return.cumulative function from the PerformanceAnalytics package) to yield cumulative multi-period returns:


In the case if there were no cashflows, the result reduces to simple one-period returns. Time-weighted returns has also an interpretation in terms of unit value pricing. If Modified Dietz method is selected, monthly returns are computed taking into account cashflows within each month:

r = \frac{V_{t}-V_{t-1}-C}{V_{t-1}+∑_{t}C_{t}\times W_{t}}

where C - total external cash flows within a month, C_{t} - external cashflow at time t,


- weighting ratio to be applied to external cashflow on day t, TD - total number of days within the month, D_{t} - number of days since the beginning of the month including weekends and public holidays. Finally monthly Modified Dietz returns can also be linked geometrically.


AcctReturns(Account, Dates = NULL, Portfolios = NULL,
  method = c("timeweighted", "dietz"), ...)



string name of the account to generate returns for


xts style ISO 8601 date subset to retrieve, default NULL (all dates)


concatenated string vector for portfolio names to retrieve returns on, default NULL (all portfolios)


Used to select between time-weighted and linked modified Dietz returns. May be any of:

  • timeweighted

  • dietz

By default time-weighted is selected


any other passthru parameters (like native for .getBySymbol


returns xts with account returns


TODO handle portfolio and account in different currencies (not hard, just not done)

TODO explicitly handle portfolio weights

TODO support additions and withdrawals to available capital


Brian Peterson, Andrii Babii


Christopherson, Jon A., Carino, David R., Ferson, Wayne E. Portfolio Performance Measurement and Benchmarking. McGraw-Hill. 2009. Chapter 5
Bacon, C. Practical Portfolio Performance Measurement and Attribution. Wiley. 2004. Chapter 2

See Also


blotter documentation built on April 15, 2017, 9:41 a.m.