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"))