Description Usage Arguments Value References Examples
Useful for visualizing the performance of individual funds. For 2- and 3-fund
portfolios, see plot_metrics_2funds
and plot_metrics_3funds
.
To visualize any combination of single funds and 2- and 3-fund portfolios,
see link{plot_metrics_123}
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
metrics |
"Long" data frame with Fund column and column for each metric
you want to plot. Typically the result of a prior call to
|
formula |
Formula specifying what to plot, e.g. |
tickers |
Character vector of ticker symbols that Yahoo! Finance recognizes, if you want to download data on the fly. |
... |
Arguments to pass along with |
gains |
Data frame with one column of gains for each investment and a date variable named Date. |
prices |
Data frame with one column of prices for each investment and a date variable named Date. |
benchmark |
Character string specifying which fund to use as a benchmark for metrics that require one. |
y.benchmark |
Character string specifying which fund to use as benchmark for y-axis metric. |
x.benchmark |
Character string specifying which fund to use as benchmark for x-axis metric. |
plotly |
Logical value for whether to convert the
|
title |
Character string. |
base_size |
Numeric value. |
label_size |
Numeric value. |
ticklabel_size |
Numeric value. |
return |
Character string specifying what to return. Choices are
|
Depending on return
, a ggplot
, a data frame
with the source data, or a list containing both.
Jeffrey A. Ryan and Joshua M. Ulrich (2019). quantmod: Quantitative Financial Modelling Framework. R package version 0.4-15. https://CRAN.R-project.org/package=quantmod
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# Plot Sharpe ratio for FANG stocks
plot_metrics(formula = sharpe ~ ., tickers = fang)
# Create previous plot in step-by-step process with pipes
fang %>%
load_gains() %>%
calc_metrics("sharpe") %>%
plot_metrics(. ~ sharpe)
# Plot CAGR vs. max drawdown for SPY and BRK-B
plot_metrics(formula = cagr ~ mdd, tickers = c("SPY", "BRK-B"))
# Create previous plot in step-by-step process with pipes
c("SPY", "BRK-B") %>%
load_gains() %>%
calc_metrics("cagr", "mdd") %>%
plot_metrics(cagr ~ mdd)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.