View source: R/extract_performance.R
extract_statistics | R Documentation |
Computes the portfolio statistics for each period being considered.
extract_statistics(.data)
.data |
A |
A tibble
with 7 new columns: .weights
, .return
and .volatility
,
.skewness
and .kurtosis
, .value_at_risk
and .expected_shortfall
.
stocks <- tibble::tibble( time = as.Date('2009-01-01') + 0:99, X = rnorm(100, 0, 1), Y = rnorm(100, 0, 2), Z = rnorm(100, 0, 4) ) roll <- construct_rolling_infrastructure(stocks, .initial = 50) rebal <- construct_rebalance_infrastructure(roll) # Mean Variance Strategy mu_sigma <- function(.data) { list(mu = colMeans(.data), sigma = stats::cov(.data)) } optimal <- rebalance_portfolio(rebal, mu_sigma, .strategy = "mean_variance") extract_statistics(optimal)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.