Description Usage Arguments Implementation
View source: R/cumulative_return.R
Various functions for aggregating returns. cumulative_return()
calculates
a vector of cumulative returns. total_return()
returns the total return
over the period.
1 2 3 | cumulative_return(.r, type = "arithmetic")
total_return(.r, type = "arithmetic")
|
.r |
A vector of returns. |
type |
Either |
Arithmetic returns are compounded as:
(1 + r_1)(1 + r_2) ... (1 + r_n) - 1
Log returns are compounded as:
r_1 + r_2 + ... + r_n
total_return()
is the last value of the cumulative return.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.