powered by
Useful for comparing metrics for several investments. The first investment is used as the benchmark if requested metrics require one.
metrics(tickers = NULL, ..., gains = NULL, prices = NULL, perf.metrics = c("mean", "sd", "growth", "cagr", "mdd", "sharpe", "sortino", "alpha", "beta", "r.squared", "pearson", "spearman", "auto.pearson", "auto.spearman"))
Character vector of ticker symbols that Yahoo! Finance recognizes, if you want to download data on the fly.
Arguments to pass along with tickers to load_gains.
tickers
load_gains
Numeric matrix with 1 column of gains for each investment (can be a vector if there is only one).
Numeric matrix with 1 column of prices for each investment (can be a vector if there is only one).
Character vector specifying metrics to calculate.
List containing:
Numeric matrix named perf.metrics with performance metrics.
perf.metrics
Numeric matrix named cor.mat with correlation matrix for gains for the various investments.
cor.mat
Ryan, J.A. and Ulrich, J.M. (2017) quantmod: Quantitative Financial Modelling Framework. R package version 0.4-12, https://CRAN.R-project.org/package=quantmod.
# NOT RUN { # Calculate performance metrics for SSO and UPRO, using SPY as benchmark # for alpha and beta metrics1 <- metrics(tickers = c("SPY", "SSO", "UPRO")) # } # NOT RUN { # }
Run the code above in your browser using DataLab