VaR answers a quantile question; expected shortfall answers the severity question beyond that quantile.
Core mechanism
Historical methods resample observed returns, parametric methods impose a distributional approximation, and Monte Carlo simulates a chosen process. Expected shortfall averages losses in the selected tail rather than discarding their magnitude.
Practical workflow
Set horizon, confidence level, P&L definition and data-cleaning policy; compare approaches; then test stability and explain differences in tails, correlations and distribution assumptions.
Key details
*Keywords: value at risk java, expected shortfall java, delta normal var java, delta gamma cornish fisher java, historical simulation var java, var backtest kupiec christoffersen java*
Feature F3. The pieces were already in the box — a scenario DSL that moves a compiled kernel and re-prices, and an adjoint sweep that returns the sensitivity vector — so this is the thin estimator and backtest layer that turns them into VaR / ES numbers.
Every figure is a positive loss at confidence alpha (e.g. 0.99). Multi-day numbers scale the one-day standard deviation by sqrt(horizonDays).
quadraticCumulants(delta, gamma, sigma) diagonalises Sigma^{1/2} Gamma Sigma^{1/2} (reusing the Jacobi eigensolver from F4's Pca), which turns the quadratic form into a sum of independent a_i y_i + 0.5 b_i y_i^2 terms. The first four cumulants then have closed forms, and the loss quantile comes from a fourth-order Cornish-Fisher expansion. With Gamma = 0 the skew and kurtosis vanish and the result is identical to deltaNormal — a test pins that.
The chi-square reference distributions for one and two degrees of freedom have closed-form survival functions (2 (1 - Phi(sqrt s)) and exp(-s/2)), so there is no incomplete-gamma dependency.
Scope and review point
The three methods are illustrative alternatives, not interchangeable production standards. Data history, liquidity, non-linearity and stressed periods matter materially.