FRTB IMA: End-to-End Numerical Case Study with 100 Trades

Reproduce FRTB IMA capital from 100 synthetic trades, historical scenarios, risk factor eligibility, expected shortfall, desk validation and correlated default simulation.

Download Python · Download code and datasets

The big picture

A bank trades currencies, shares and commodities. Prices move, and on a bad day or a bad month the bank can lose a lot of money. Regulators therefore require the bank to hold enough loss-absorbing capital to withstand large losses.

Under FRTB IMA (Fundamental Review of the Trading Book, Internal Models Approach), a bank may estimate that cushion with its own risk model, but only if the model passes a series of tests. This case study builds the whole calculation on 100 made-up trades, so you can see every step with real numbers.

The journey in one table:

Step The question it answers
1. Portfolio What does the bank actually hold?
2. Risk factors Which market prices drive the value, and can we trust the data on each?
3-4. Scenarios What could prices do over 10 days, based on history?
5. Expected Shortfall In the worst few scenarios, how big is the average loss?
6. Liquidity horizons What if we cannot sell quickly in a crisis?
7-8. Stress and IMCC What if markets are as bad as the worst past period?
9. NMRF What about prices we cannot model well?
10-11. Backtesting and P&L attribution Is the model honest and accurate?
12. Default risk What if a company whose shares we own goes bust?
13. Final capital Add it all up.

Final answer: capital of USD 3,472,266.59, which converts to market risk RWA (risk-weighted assets) of USD 43,403,332.33.

Mini glossary

1. Portfolio construction

In plain English: the bank has one trading desk, DESK01, holding 100 trades: 30 currency (FX) trades, 40 share trades and 30 commodity futures trades.

There are 10 risk factors (3 currency pairs, 4 stocks and 3 commodities), and 10 trades sit on each one. For each factor, 7 trades are long and 3 are short. Their quantities partly offset, leaving one net position per factor.

The stock issuers are fictional, and the case ignores funding, basis, counterparty and settlement risk. Amounts are in USD. Within each factor group, commodity futures share the same contract specifications and maturity, with enough time remaining for the assigned liquidity horizon.

How a trade's size is measured. Three ingredients:

qi=nimi,Ei=qiXf(i),0,Qf=∑i:f(i)=fqi.q_i=n_i m_i,\qquad E_i=q_iX_{f(i),0},\qquad Q_f=\sum_{i:f(i)=f}q_i.

Quantity equals signed contracts or units times the multiplier. Reference exposure equals that quantity times the current quote. The net quantity for a factor is the sum of the quantities mapped to it. Trade T071 (WTI oil, long) has 3 contracts of 1,000 barrels each at USD 75 per barrel, for USD 225,000 in reference exposure. Trade T001 (EUR/USD) has 347,764 units at 1.1, for USD 382,540.40.

Two totals to understand:

The gap between them is the longs and shorts offsetting each other. Neither number is capital or the portfolio's market value. They are only a measure of size. Note also that for a futures contract the exposure is not its fair value.

Quotes are in USD per unit: FX is USD per unit of foreign currency, stocks USD per share, WTI USD per barrel, wheat USD per bushel. The individual tickets were generated randomly (seed 100) so that they add up to the assumed net quantities. The full blotter is in data/trades.csv.

Selected rows from the trade blotter:

Trade Factor Side Signed lots/units Multiplier Price units Exposure USD
T001 EURUSD Long 347764 1 347764 382,540.40
T002 EURUSD Long 348140 1 348140 382,954.00
T008 EURUSD Short -191722 1 -191722 -210,894.20
T031 ALPHA Long 1662 1 1662 166,200.00
T068 DELTA Short -597 1 -597 -35,820.00
T071 WTI Long 3 1000 3000 225,000.00
T090 WHEAT Short -1 5000 -5000 -30,000.00
T100 RARE Short -1 1000 -1000 -70,000.00

2. Risk mapping, RFET and liquidity horizons

This step classifies each of the 10 risk factors in two ways.

(a) Can we trust its price data? The Risk Factor Eligibility Test (RFET). A model needs real, observable prices. The rule used here (Basel MAR31.13) is: the factor must have at least 100 days with real price observations in the past 12 months, with at most one observation counted per day. Factors that pass are modellable. Factors that fail are non-modellable (NMRF). They cannot go into the main model and get a separate, tougher treatment (Step 9).

(b) How long to exit or hedge? The liquidity horizon uses prescribed categories. In this portfolio, the specified currency pairs and large-cap equities use 10 days, small-cap equities and energy use 20 days, and agricultural commodities use 60 days.

Factor Class Net units Quote (USD) LH (days) Real-price days Modellable In reduced set
EURUSD FX 2,000,000 1.1 10 220 Yes Yes
GBPUSD FX 100,000 1.25 10 210 Yes No
JPYUSD FX 200,000,000 0.0067 10 205 Yes Yes
ALPHA Equity 10,000 100.0 10 230 Yes Yes
BETA Equity 12,000 80.0 10 225 Yes Yes
GAMMA Equity 15,000 45.0 20 180 Yes Yes
DELTA Equity 8,000 60.0 20 175 Yes Yes
WTI Commodity 20,000 75.0 20 240 Yes Yes
WHEAT Commodity 50,000 6.0 60 200 Yes Yes
RARE Commodity 2,000 70.0 20 18 No No

RARE has only 18 real-price days, far below 100, so it is non-modellable. Everything else passes.

MAR31.13 also allows a route with at least 24 qualifying real-price dates and no applicable 90-day period with fewer than four observations. RARE’s 18 dates fail both routes.

The reduced set. Regulators also want a smaller set of factors that have a long, reliable history, because this set is used to find the stress period later. Here it has 8 factors: the 9 modellable ones minus GBPUSD, which is dropped because the position is small. RARE is in neither set and gets its own capital charge.

Caveats. The price-day counts are assumed evidence, not real quotes. In real life you would also monitor monthly, check data quality and check that proxies are representative. The portfolio has no interest-rate or credit-spread factors.

3. Generate synthetic market shocks

Why synthetic? The study has no real market data, so it manufactures realistic-looking daily price moves from 2 January 2007 to 27 November 2026 (weekdays only, holidays ignored, random seed 20261128). The convention is 250 business days = one year.

The daily price change of factor f on day t is built like a recipe:

ΔXf,t=atσf(βfGt+γfCt+1−βf2−γf2 Zf,t).\Delta X_{f,t}=a_t\sigma_f\left(\beta_f G_t+\gamma_f C_t+\sqrt{1-\beta_f^2-\gamma_f^2}\,Z_{f,t}\right).

In the model, the global, commodity and factor-specific innovations are independent standard normal variables.

The two crises are synthetic and do not estimate real crisis losses. Changes are absolute (added to today's price), and there is no modelling of rolling futures contracts.

4. Ten-day historical simulation and trade-level repricing

The idea: take what happened in history over 10-day periods and ask, "If the same moves happened starting from today, how much would the bank gain or lose?"

For every 10-day window, the shock is simply the sum of the 10 actual daily changes (not one day's move scaled up by the square root of 10). In 250 days there are 250 - 10 + 1 = 241 overlapping windows, so 241 scenarios.

Sf,t(10)=∑k=09ΔXf,t−k.S_{f,t}^{(10)}=\sum_{k=0}^{9}\Delta X_{f,t-k}.

For each scenario and trade:

Vi(X)=qiXf(i),ΔVi,t=qiSf(i),t(10),LA,t=−∑i:f(i)∈AΔVi,t.V_i(X)=q_i X_{f(i)},\quad \Delta V_{i,t}=q_i S_{f(i),t}^{(10)},\quad L_{A,t}=-\sum_{i:f(i)\in A}\Delta V_{i,t}.

Multiply the signed quantity by the 10-day move to find a trade’s P&L. For the factors in the set AA, add up the trade P&Ls and reverse the sign to get the loss. The linear quote exposure ViV_i is used for P&L differences. Futures fair value is a separate measure.

Because every trade is linear (no options), adding trade P&Ls gives exactly the same answer as shocking each factor's net quantity once. The code checks this match for every factor and scenario.

The reconciliation follows from ∑iqiSf(i)=∑fQfSf\sum_i q_i S_{f(i)}=\sum_f Q_f S_f. Options would require nonlinear repricing.

Worked example: the first current scenario. Trade T001 (quantity 347,764) faces a 10-day EUR/USD move of +0.025290948, so its P&L is 347,764 x 0.025290948 = USD 8,795.28. Adding all trades per factor:

Factor 10-day shock Net P&L (USD)
EURUSD 0.025290948 50,581.90
GBPUSD 0.030037384 3,003.74
JPYUSD -0.000009719 -1,943.76
ALPHA 2.050393469 20,503.93
BETA -2.905410374 -34,864.92
GAMMA -1.424583837 -21,368.76
DELTA -2.232123070 -17,856.98
WTI 3.303110316 66,062.21
WHEAT 0.245640908 12,282.05
RARE -0.633759620 -1,267.52

The nine modellable factors add up to a gain of USD 76,399.40, so the loss is -76,399.40. A negative loss is a gain. RARE is left out because it is handled separately.

The files current_trade_scenarios.csv and stress_trade_scenarios.csv each hold 24,100 rows (100 trades x 241 scenarios). Positive P&L is a gain. Positive loss is a loss.

5. Expected Shortfall estimation

VaR vs ES. Value at Risk (VaR) answers "what is the loss I will only exceed in the worst 2.5% of cases?" It says nothing about how bad those cases are. Expected Shortfall goes further: it averages the losses in that worst 2.5% tail. FRTB uses ES at the 97.5% level.

How to compute it. Sort the 241 losses from worst to best. The tail is 2.5% of 241 = 6.025 scenarios. The six worst losses count fully, and the seventh counts for only 0.025 of a scenario. Then divide by 6.025.

For confidence qq and NN equally weighted losses, the tail contains m=(1−q)Nm=(1-q)N observations by weight. Let k=⌊m⌋k=\lfloor m\rfloor, r=m−kr=m-k, and order the losses from worst to best, starting at L[1]L_{[1]}.

ESq=∑i=1kL[i]+rL[k+1]m.ES_q=\frac{\sum_{i=1}^{k}L_{[i]}+rL_{[k+1]}}{m}.

6. Liquidity horizon adjustment

The problem: a 10-day loss assumes you can get out in 10 days. If wheat takes 60 days to sell, you are exposed to wheat moves for much longer, so the risk should be larger.

The fix, step by step.

ESLH=∑j=15hj−hj−110 ES10,j2,h0=0.ES_{LH}=\sqrt{\sum_{j=1}^{5}\frac{h_j-h_{j-1}}{10}\,ES_{10,j}^2},\quad h_0=0.

Intuitively, each weight counts how many extra 10-day periods that slice of positions stays stuck. Wheat is stuck for 60 days, so it shows up in the 10, 20, 40 and 60 slices. The 40 and 60 slices have the same ES because both contain only wheat, but both are weighted separately. There is no 120-day exposure, so that term is zero.

The portfolio results (USD). FC = full set, current data. RC = reduced set, current data. RS = reduced set, stressed data.

Calibration ES LH10 ES LH20 ES LH40 ES LH60 ES LH120 LH-adjusted ES
FC 338,666.41 261,181.09 51,020.28 51,020.28 0.00 439,684.86
RC 337,550.31 261,181.09 51,020.28 51,020.28 0.00 438,825.76
RS 854,626.53 647,342.31 131,473.42 131,473.42 0.00 1,103,892.94

For example, the FC result is the square root of: 338,666.41 squared + 261,181.09 squared + 2 x 51,020.28 squared + 2 x 51,020.28 squared. The file liquidity_es.csv has all 18 scope and calibration rows.

7. Reduced set validation and selection of the stress window

Part A: does the reduced set represent the full set? Over the last 60 days, compute reduced-set ES divided by full-set ES each day and average it. Regulators require at least 75%. Here the average is 99.8120% (latest day 99.8046%), a comfortable pass.

160∑t=160ESR,C,tESF,C,t≥0.75.\frac{1}{60}\sum_{t=1}^{60}\frac{ES_{R,C,t}}{ES_{F,C,t}}\ge0.75.

Part B. Find the worst period in history. At the first date of the 60-day capital history, the model scans all complete 250-day windows since 2007 using information available at that date. For each window it scores the stressed reduced-set ES with the current scaling ratios, then picks the window with the highest blended charge.

w∗=arg⁡max⁡w[0.5 ESR,SAll(w)sAll+0.5∑cESR,Sc(w)sc],sc=max⁡(1,ESF,Cc/ESR,Cc).w^*=\arg\max_w\left[0.5\,ES_{R,S}^{All}(w)s_{All}+0.5\sum_c ES_{R,S}^{c}(w)s_c\right],\quad s_c=\max(1,ES_{F,C}^c/ES_{R,C}^c).

The selected stress window is 21 March 2008 to 5 March 2009. It overlaps the synthetic 2008–09 crisis regime. The same window applies to the unconstrained and class-level calculations, and both the reduced set and the stress window stay fixed through the 60-day run. The candidate scores are in stress_search.csv. Production governance requires review at least quarterly and after material changes. Supervisory approval and data quality are assumed here.

8. IMCC calculation

IMCC (Internally Modelled Capital Charge) is the main capital number for modellable risk. For each scope (All, and each risk class) take the stressed reduced ES and scale it by how much the full set exceeds the reduced set today:

Ic=ESR,Scmax⁡(1,ESF,CcESR,Cc).I_c=ES_{R,S}^c\max\left(1,\frac{ES_{F,C}^c}{ES_{R,C}^c}\right).

Absent classes give zero. A nonzero full ES with zero reduced ES would signal a model design error.

Scope ES_FC ES_RC ES_RS Scale Stressed charge
All 439,684.86 438,825.76 1,103,892.94 1.001958 1,106,054.05
FX 92,000.41 91,252.15 273,437.35 1.008200 275,679.50
Equity 290,082.39 290,082.39 517,446.08 1.000000 517,446.08
Commodity 252,605.66 252,605.66 740,279.63 1.000000 740,279.63
Interest rate 0.00 0.00 0.00 1.000000 0.00
Credit spread 0.00 0.00 0.00 1.000000 0.00

Then blend the all-risk number with the sum of the per-class numbers:

IMCC=0.5IAll+0.5∑c∈{FX,Equity,Commodity,IR,Credit}Ic.IMCC=0.5 I_{All}+0.5\sum_{c\in\{FX,Equity,Commodity,IR,Credit\}} I_c.

Check: 0.5 x 1,106,054.05 + 0.5 x (275,679.50 + 517,446.08 + 740,279.63) = USD 1,319,729.63. The sum of the classes is larger than the all-risk figure because adding classes ignores diversification, and the 50/50 blend gives partial credit for it.

The model recomputes this on each of the last 60 days, giving an average IMCC of USD 1,319,363.77.

9. NMRF stress scenario capital

Non-modellable factors have too little data for the normal model, so regulators ask for a deliberately conservative Stress Scenario charge (SES). Here only RARE is non-modellable.

LRARE,t20=−QRARE∑k=019ΔXRARE,t−k,SES=max⁡wES.975(LRARE,w20).L_{RARE,t}^{20}=-Q_{RARE}\sum_{k=0}^{19}\Delta X_{RARE,t-k},\quad SES=\max_w ES_{.975}(L_{RARE,w}^{20}).

With one NMRF there is nothing to aggregate, so SES = USD 13,220.93. With several NMRFs, regulators prescribe common stress periods and aggregation rules (MAR33.16-17). Because the position and calibration are fixed, the SES is identical on all 60 history dates.

The example assumes the proxy is suitable. A production model must demonstrate that its calibration is prudent.

10. Desk-level VaR backtesting and bank-wide multiplier

Backtesting asks: did the model's predicted risk match reality? Each day, the model forecasts a one-day VaR. If the actual loss is larger, that is an exception. Too many exceptions means the model underestimates risk.

The test uses 250 days. Each forecast uses the preceding 250 days of losses (excluding the test day) and is a plain empirical quantile. VaR here is one-day and not liquidity-adjusted. Three P&L streams are compared:

RTPLt=∑i=1100qiΔXf(i),t,HPLt=RTPLt+250Z1,t,APLt=HPLt+350Z2,t−100.RTPL_t=\sum_{i=1}^{100}q_i\Delta X_{f(i),t},\quad HPL_t=RTPL_t+250Z_{1,t},\quad APL_t=HPL_t+350Z_{2,t}-100.

The forecasts use the inverse empirical CDF without interpolation. RTPL includes RARE, while the VaR forecast uses modellable risk factors. The example claims no NMRF exception waiver.

The desk's exception count is the larger of the APL and HPL counts.

Nq=max⁡(∑t1[−APLt>VaRq,t],∑t1[−HPLt>VaRq,t]).N_q=\max\left(\sum_t\mathbf1[-APL_t>VaR_{q,t}],\sum_t\mathbf1[-HPL_t>VaR_{q,t}]\right).
Confidence APL exceptions HPL exceptions Desk maximum allowed
97.5% 10 10 30
99% 2 2 12

The desk passes both tests. Being the only desk, its 99% exceptions are also the bank-wide count. The capital multiplier m(c) depends on that count: 1.50 for 0-4 exceptions, 1.70, 1.76, 1.83, 1.88, 1.92 for 5-9, and 2.00 for 10 or more, before any discretionary add-ons. With 2 exceptions, m(c) = 1.50. The P&L streams were deliberately built to be close to each other, so passing here is not independent proof of model quality.

11. P&L attribution test

Question: is the risk model's P&L (RTPL) a good match for the desk's hypothetical P&L (HPL)? If not, the model is not capturing what drives profits.

Two statistics over the same 250 days:

ρS=Corr⁡(rank⁡(HPL),rank⁡(RTPL)),\rho_S=\operatorname{Corr}(\operatorname{rank}(HPL),\operatorname{rank}(RTPL)),
DKS=sup⁡x∣F^HPL(x)−F^RTPL(x)∣.D_{KS}=\sup_x|\widehat F_{HPL}(x)-\widehat F_{RTPL}(x)|.

Results: Spearman 0.99993395, KS 0.012.

Zones: green if correlation is above 0.80 and KS below 0.09. Red if correlation is below 0.70 or KS above 0.12. Amber otherwise. This desk is comfortably green, so there is no PLA surcharge. Daily data are in desk_tests.csv.

12. Default risk charge: four correlated equity obligors

The risk: the market-risk model above handles price moves. It does not cover a company going bust, where a share price drops to zero. The Default Risk Charge (DRC) captures that.

Four equity positions are exposed. The loss if a company defaults (jump-to-default, JTD) is the whole position value.

Issuer JTD (USD) 1-year default probability Region loading Industry loading
ALPHA 1,000,000 0.5% 0.35 0.30
BETA 960,000 0.8% 0.35 0.45
GAMMA 675,000 1.5% 0.40 0.25
DELTA 480,000 2.0% 0.40 0.40

Why correlation matters. Companies tend to fail together in a downturn, so the chance of several defaulting at once is higher than if they were independent. The model captures this with a latent variable for each firm, a hidden measure of financial health:

Yi=bi,RR+bi,II+1−bi,R2−bi,I2ϵi,Di=1[Yi<Φ−1(PDi)].Y_i=b_{i,R}R+b_{i,I}I+\sqrt{1-b_{i,R}^2-b_{i,I}^2}\epsilon_i,\quad D_i=\mathbf1[Y_i<\Phi^{-1}(PD_i)].

The probabilities and loadings are assumed. A production calibration requires the applicable 10-year market-data history. The two systematic factors and the issuer-specific innovations are independent standard normals.

Simulation. Simulate 2,000,000 one-year outcomes (seed 20261129). Each outcome identifies which of the 4 firms default (16 possible combinations). Total loss is L=∑iJTDiDiL=\sum_i JTD_iD_i. The DRC is the smallest loss level at which the cumulative probability reaches 99.9%.

DRC=inf⁡{x:F^L(x)≥0.999}.DRC=\inf\{x:\widehat F_L(x)\ge0.999\}.

A useful observation: the loss levels come from default combinations. For example, 1,440,000 equals BETA + DELTA, and 1,480,000 equals ALPHA + DELTA.

Cross-check. Simulation has sampling noise, so the code independently estimates the distribution by 60 × 60 Gauss–Hermite quadrature over the two shared factors. It multiplies conditional issuer default or survival probabilities to obtain each state’s probability. The resulting CDF is 0.9990433 at USD 1,480,000, giving the same quantile. Both estimates are in drc_distribution.csv. The final rule takes the larger of the latest DRC and its previous 12-week average. These are identical under the case study’s fixed positions and calibration.

13. Final capital and market risk RWA

The final assembly (simplified MAR33.43, green desk, no ineligible positions) has two branches for the non-default capital:

CA=max⁡(IMCCt−1+SESt−1, mcIMCC‾60+SES‾60),C_A=\max(IMCC_{t-1}+SES_{t-1},\ m_c\overline{IMCC}_{60}+\overline{SES}_{60}),

The max is a safety feature: capital cannot drop just because yesterday was calm. Then:

K=CA+max⁡(DRClatest,DRC‾12w),RWA=12.5K.K=C_A+\max(DRC_{latest},\overline{DRC}_{12w}),\qquad RWA=12.5K.

(The 12.5 comes from the Basel convention that capital is 8% of RWA, and 1 / 0.08 = 12.5.)

Item USD
Latest IMCC 1,319,729.63
Average IMCC 1,319,363.77
Latest and average SES 13,220.93
Branch 1: latest IMCC + SES 1,332,950.56
Branch 2: 1.5 x average IMCC + SES 1,992,266.59
Non-default capital (larger branch) 1,992,266.59
Default risk charge 1,480,000.00
SA / PLA surcharge 0.00
Total market risk capital 3,472,266.59
Market risk RWA 43,403,332.33

Branch 2 wins because the 1.50 multiplier pushes it well above Branch 1. Check: 1.5 x 1,319,363.77 + 13,220.93 = 1,992,266.59, and 1,992,266.59 + 1,480,000 = 3,472,266.59. Rounding is for display only.

14. Assumption and input provenance

Item Source
Desk approval, quantities, quotes, multipliers Assumed
Individual ticket sizes Generated to match the assumed net positions
Liquidity horizons, RFET evidence, proxy quality Assumed
Volatilities, loadings, crisis regimes Assumed
Daily and 10-day shocks, trade P&L Generated, then calculated and reconciled
ES, IMCC, SES, backtest and PLA statistics Calculated
Default probabilities and loadings Assumed
Default outcomes and DRC Simulated, checked by quadrature
Capital history and RWA Calculated, assuming fixed positions

The table separates assumed inputs, generated data, and calculated outputs. The regulatory calculations are applied to a synthetic portfolio and market history.

15. Reproduce the case study

python -m pip install -r requirements.txt
python run_case_study.py

The script regenerates every file in data/. Start with summary.json (the authoritative results), then use trades.csv and risk_factors.csv for inputs. The trade-level scenario files let you filter by ticket or date, and desk_tests.csv, liquidity_es.csv, imcc_components.csv, stress_search.csv, nmrf_stress_losses.csv, drc_issuers.csv, drc_distribution.csv, capital_history.csv and drc_weekly.csv trace each step above.

Dataset Use
trades.csv, risk_factors.csv Blotter and factor master
rfet_assumed_flags.csv, daily_shocks.csv RFET evidence and shock history
current_trade_scenarios.csv, stress_trade_scenarios.csv Trade-level scenario P&L
latest_scenarios.csv, selected_stress_scenarios.csv Factor-level scenario reconciliation
liquidity_es.csv, imcc_components.csv ES and IMCC
stress_search.csv, nmrf_stress_losses.csv Stress window and NMRF
desk_tests.csv Backtesting and PLA
capital_history.csv, drc_weekly.csv Regulatory averages
drc_issuers.csv, drc_distribution.csv Correlated issuer default calculation
summary.json Final results

16. Regulatory scope and limitations

This is a teaching model, not a bank-ready engine. It leaves out interest rate and credit spread factors, options (and so any nonlinear revaluation), multiple desks, changing holdings, exchange holidays, the standardised-approach fallback and the amber PLA surcharge. It approximates a year as 250 business days and 12 weeks as 60. A real implementation needs all applicable risk factors, real market data, independent validation, calibrated default parameters, supervisory approval and local rules.

References: Basel MAR30, MAR31, MAR32, MAR33. In particular MAR31.13, MAR32.9/18/19/22 and PLA thresholds, MAR33.4–7, 12–17, 18–39 and 43–44.

A production implementation also needs full valuation controls, a review of proxy suitability, prescribed reporting conventions and the applicable jurisdiction’s rules.

Explore the synthetic case study

100 synthetic trades. Reported capital: USD 3,472,266.59. Market risk RWA: USD 43,403,332.33. Enable JavaScript to explore the datasets.