Risk
Value at risk, expected shortfall, covariance, drawdown risk and portfolio optimization.
Measure tail risk with historical, parametric and Monte Carlo VaR and expected shortfall, explain P&L with Taylor expansions, and construct portfolios with mean-variance, risk parity, hierarchical risk parity and Black–Litterman. Research-hygiene tools guard against overfitting.
Try it live
Common APIs
fn
valueAtRiskVaR (positive loss magnitude) for a single return/P&L series.fnvalueAtRiskReportFull VaR + CVaR report for a single return/P&L series.fnexpectedShortfallConditional VaR / expected shortfall (positive loss magnitude), with the same `.explain()`.fnportfolioVaRSee the reference for its full contract.fnstressTestStress a positions book across scenarios (H11 report): per-scenario and per-position P&L.fntaylorPnlGreeks-Taylor P&L of a single position's Greeks under a scenario (per unit).fnmeanVarianceSee the reference for its full contract.fnriskParityEqual-risk-contribution (risk parity) portfolio.fnhrpHierarchical Risk Parity portfolio (correlation-distance clustering + recursive bisection).fnblackLittermanBlack-Litterman (1992): blend a market-equilibrium prior on expected returns with subjective views to get a posterior `μ_BL` and covariance, then mean-variance-optimize.fndeflatedSharpeRatioDeflated Sharpe Ratio (Bailey & López de Prado 2014): the PSR evaluated against the *expected maximum* Sharpe that `N` independent trials would produce by chance, so selecting the best of a parameter sweep is penalised.fnkellySee the reference for its full contract.Complete API reference
Browse all public exports, types, and feature imports below.