AcctReturns | R Documentation |
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:
r_{t}=\frac{V_{t}}{V_{t-1}+C_{t}}-1
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:
1+r=\prod_{t=1}^{T}(1+r_{t})=\prod_{t=1}^{T}\frac{V_{t}}{V_{t-1}+C_{t}}
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}+\sum_{t}C_{t}\times W_{t}}
where C
- total external cash flows within a month,
C_{t}
- external cashflow at time t
,
W_{t}=\frac{TD-D_{t}}{TD}
- 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"),
...
)
Account |
string name of the account to generate returns for |
Dates |
xts style ISO 8601 date subset to retrieve, default NULL (all dates) |
Portfolios |
concatenated string vector for portfolio names to retrieve returns on, default NULL (all portfolios) |
method |
Used to select between time-weighted and linked modified Dietz returns. May be any of:
By default time-weighted is selected |
... |
any other passthru parameters (like |
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
PortfReturns
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.