calc_metrics_3funds: Calculate Performance Metrics for 3-Fund Portfolios with...

Description Usage Arguments Value Examples

View source: R/calc_metrics_3funds.R

Description

Useful for assessing the characteristics of 3-fund portfolios.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
calc_metrics_3funds(
  gains = NULL,
  metrics = c("mean", "sd"),
  tickers = NULL,
  ...,
  step = 1,
  prices = NULL,
  benchmark = "SPY",
  ref.tickers = NULL
)

Arguments

gains

Data frame with a date variable named Date and one column of gains for each fund.

metrics

Character vector specifying metrics to calculate. See ?calc_metrics for choices.

tickers

Character vector of ticker symbols, where the first three are are a 3-fund set, the next three are another, and so on.

...

Arguments to pass along with tickers to load_gains.

step

Numeric value specifying fund allocation increments.

prices

Data frame with a date variable named Date and one column of prices for each fund.

benchmark

Character string specifying which fund to use as a benchmark for metrics that require one.

ref.tickers

Character vector of ticker symbols to include.

Value

Data frame with performance metrics for each portfolio at each allocation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# Calculate CAGR and max drawdown for UPRO/VBLTX/VWEHX
df <- calc_metrics_3funds(metrics = c("cagr", "mdd"), tickers = c("UPRO", "VBLTX", "VWEHX"))
head(df)

# To plot, just pipe into plot_metrics_3funds
df %>%
  plot_metrics_3funds()

# Or bypass calc_metrics_3funds altogether
plot_metrics_3funds(formula = cagr ~ mdd, tickers = c("UPRO", "VBLTX", "VWEHX"))

## End(Not run)

vandomed/stocks documentation built on July 22, 2020, 3:25 a.m.