Class FrtbEs

java.lang.Object
com.quantfinlib.risk.FrtbEs

public final class FrtbEs extends Object
FRTB Internal Models Approach expected shortfall — the market-risk capital measure that replaced 10-day VaR: ES at 97.5%, computed on a base 10-day horizon and scaled up across liquidity horizons (how long each risk factor class realistically takes to exit under stress: 10 days for major FX and rates, up to 120 for exotic credit), then anchored to a stressed period:
  ES = √( Σⱼ [ ESⱼ · √((LHⱼ − LHⱼ₋₁)/10) ]² )      (the LH cascade)
 ES   = ES_R,S · max(1, ES_F,C / ES_R,C)                    (MAR33.5-33.6, stressed calibration)

Styled after BCBS MAR33, not certified: the same stance as the LULD and ESMA-tick implementations elsewhere in this library. The formulas are the regulation's and the tests pin their arithmetic, but regulatory capital additionally requires desk-level approvals, the full P&L attribution program (PnlAttribution), non-modellable risk factor (NMRF) capital, and the standardized-approach floor, all named in docs/MARKET_RISK.md as out of scope. Standard liquidity horizons are provided as LH_10 … LH_120. Research lane, static, deterministic.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The Basel backtesting traffic light over 250 days of 99% VaR exceptions: GREEN ≤ 4 (model fine), AMBER 5-9 (capital multiplier rises), RED ≥ 10 (model presumed wrong).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The five regulatory liquidity horizons, in days.
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final double
    Minimum share of full-set current ES the reduced set must explain (BCBS MAR33.5(2)).
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    es975(double[] losses)
    ES at 97.5% of a loss sample (positive losses), the FRTB tail measure, using the Acerbi-Tasche estimator of TailRisk (floored at zero).
    static double
    liquidityHorizonEs(double[] esByHorizon, int[] horizons)
    The liquidity-horizon cascade: given the base 10-day ES computed on the full factor set and the ESs of the nested subsets that remain shocked at each longer horizon, aggregates per MAR33.4:
    static double
    stressCalibratedEs(double esCurrentFull, double esStressedReduced, double esCurrentReduced)
    Stressed calibration of the IMA expected shortfall (BCBS MAR33.5-33.6):

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • es975

      public static double es975(double[] losses)
      ES at 97.5% of a loss sample (positive losses), the FRTB tail measure, using the Acerbi-Tasche estimator of TailRisk (floored at zero). On a 250-day window the tail holds 6.25 observations: the worst six at full weight plus a quarter of the seventh, divided by 6.25.
    • liquidityHorizonEs

      public static double liquidityHorizonEs(double[] esByHorizon, int[] horizons)
      The liquidity-horizon cascade: given the base 10-day ES computed on the full factor set and the ESs of the nested subsets that remain shocked at each longer horizon, aggregates per MAR33.4:
      Parameters:
      esByHorizon - esByHorizon[j] = 10-day ES with only the factors of liquidity horizon ≥ horizons[j] shocked; index 0 is the full set at LH 10
      horizons - ascending, starting at 10 (e.g. {10, 20, 60})
    • stressCalibratedEs

      public static double stressCalibratedEs(double esCurrentFull, double esStressedReduced, double esCurrentReduced)
      Stressed calibration of the IMA expected shortfall (BCBS MAR33.5-33.6):
        ES = ES_R,S · max(1, ES_F,C / ES_R,C)
      where ES_R,S is the ES of the reduced factor set over the stressed 12-month period, ES_F,C the ES of the full factor set over the current 12 months, and ES_R,C the ES of the reduced set over the current period. The stressed reduced-set ES is the base; the full/reduced ratio, measured today, scales it up for the factors the stress period does not cover, and that ratio is floored at 1. The reduced set must explain at least 75% of the full-set current ES (ES_R,C >= 0.75 · ES_F,C); a set that does not is rejected.

      Example: ES_F,C = 100, ES_R,C = 80, ES_R,S = 150 gives 150 · 1.25 = 187.5.

      Parameters:
      esCurrentFull - ES_F,C
      esStressedReduced - ES_R,S
      esCurrentReduced - ES_R,C, must be > 0
      Throws:
      IllegalArgumentException - if an input is negative or not finite, or the reduced set explains less than 75%