cumulative_return: Cumulative returns

Description Usage Arguments Implementation

View source: R/cumulative_return.R

Description

Various functions for aggregating returns. cumulative_return() calculates a vector of cumulative returns. total_return() returns the total return over the period.

Usage

1
2
3
cumulative_return(.r, type = "arithmetic")

total_return(.r, type = "arithmetic")

Arguments

.r

A vector of returns.

type

Either "arithmetic" or "log" returns.

Implementation

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.


DavisVaughan/tidyfinance documentation built on May 24, 2019, 8:46 p.m.