Tools for portfolio construction and risk analytics, including
mean-variance optimization, conditional value at risk (expected shortfall)
minimization, risk parity, regime clustering, correlation analysis,
Monte Carlo simulation, and option pricing. Includes utilities for
portfolio evaluation, clustering, and risk reporting. Methods are based
in part on Markowitz (1952)
Portfolio analytics and simulation toolkit in R. Includes:
library(finlabR)
# load example dataset
prices <- get_example_prices()
rets <- calc_returns(prices[, -1])
# returns matrix (rows = time, cols = assets)
min_var <- mvo_min_variance(rets)
frontier <- mvo_efficient_frontier(rets, n = 30)
max_sharpe <- mvo_max_sharpe(rets, rf = 0.02)
cvar <- cvar_minimize(rets, alpha = 0.95)
rp <- risk_parity_weights(stats::cov(rets))
varcvar <- var_cvar(rets, alpha = 0.95)
# limit order book demo
book <- simulate_orderbook(n_steps = 200, p0 = 100)
lob_features <- extract_features(book)
# run source('runme.R') for Shiny App
See REFERENCE.md in the repository for the full list of functions and usage examples.
#file <- system.file("extdata/runme.R", package = "finlabR")
#source(file)
shiny::runApp(system.file("shiny/finlabR-dashboard", package = "finlabR"))