data.cumret {StockDistFit}R Documentation

Compute Cumulative Returns of a Vector.

Description

This function takes a vector of asset returns and computes the cumulative wealth generated over time, assuming that the initial wealth was initial_eq.

Usage

data.cumret(df_ret, initial_eq)

Arguments

df_ret

an xts object of asset returns, with dates as rownames.

initial_eq

a numeric value representing the initial wealth.

Value

An xts object of wealth generated over time.

See Also

weekly_return, monthly_return, annual_return

Examples


# Compute cumulative returns of an asset vector
library(quantmod)
asset_returns_xts <- xts(c(29.2, 30.0, 36.2, 30.4, 38.5, -35.6, 34.5),
                         order.by = as.Date(c("2023-05-01", "2023-05-02", "2023-05-03",
                                               "2023-05-04", "2023-05-05", "2023-05-06",
                                               "2023-05-07")))
data.cumret(asset_returns_xts, initial_eq = 100)



[Package StockDistFit version 1.0.0 Index]