Docs / nablatensor-risk / com.nablatensor.risk
final class
ValueAtRisk
Value at Risk and Expected Shortfall by the three standard routes:
- Historical / full-revaluation — an empirical quantile of a
PnlVector. Feed it a bootstrapped-scenario revaluation and this is full-revaluation VaR; feed it a window of realised daily P&L and it is historical-simulation VaR. - Delta-normal —
z_alpha * sqrt(s' Sigma s), the variance-covariance method, exact for a linear portfolio and a Gaussian risk-factor move. - Delta-gamma Cornish-Fisher — the quadratic P&L
delta' x + 0.5 x' Gamma xhas a skewed, fat-tailed distribution; its first four cumulants are computed in closed form and the quantile comes from a Cornish-Fisher expansion.
Every result is a positive loss quoted at confidence alpha (e.g. 0.99). Multi-day figures use the square-root-of-time scaling the caller supplies via horizonDays (a one-day covariance times sqrt(horizonDays)).
Methods
Empirical VaR: the alpha-quantile of the loss sample, linearly interpolated.
Empirical Expected Shortfall: the mean loss in the (1 - alpha) tail beyond VaR.
Delta-normal from a Sensitivities vector and an explicit factor order.
Cumulants of Q = delta' x + 0.5 x' Gamma x for x ~ N(0, Sigma). Diagonalises Sigma^{1/2} Gamma Sigma^{1/2} so Q becomes a sum of independent a_i y_i + 0.5 b_i y_i^2 terms with y_i ~ N(0,1).
Delta-gamma VaR via a fourth-order Cornish-Fisher expansion of the loss quantile.