Fibtec · pyvar.com · Market Risk
Domain 01 · Market Risk

VaR, ES, backtesting.
Every market risk metric,
one API.

71 functions covering Monte Carlo and parametric VaR, Expected Shortfall, FRTB SA/IMA capital, backtesting and stress testing. Basel III/IV and FRTB compliant.

71
Functions
1.4ms
p50 latency
Basel
III/IV compliant
FRTB
SA & IMA
Function library

71 market risk functions

Showing all 71 functions
Key capabilities

Built on regulatory-grade risk modelling

Monte Carlo & Parametric VaR
Historical simulation, filtered historical simulation, delta-normal, Cornish-Fisher and full Monte Carlo VaR — plus marginal, component and incremental VaR decomposition.
FRTB SA & IMA Capital
Standardised Approach sensitivities-based capital and Internal Models Approach ES-based capital, computed consistently from the same risk-factor simulation engine.
Backtesting & P&L Attribution
Basel traffic-light backtesting, Kupiec and Christoffersen tests, and the FRTB P&L Attribution Test (Spearman correlation + ratio) for IMA desk eligibility.
Regulatory alignment

Standards covered

Basel III / IV — 99% 1-day VaR
Standard VaR confidence level for market risk capital, with 95% and 97.5% supported for internal limits and FRTB ES respectively.
FRTB IMA — 97.5% 10-day Expected Shortfall
ES computed as the mean of losses beyond the VaR threshold (not the median or max), with Euler-allocated component decomposition.
Basel traffic-light backtesting
Exactly 250 trading days, green/yellow/red breach zones (<5 / 5-9 / ≥10) and the corresponding 3.0-4.0 capital multiplier.
FRTB P&L Attribution Test
Joint Spearman correlation and ratio test — green ≥0.80 correlation and 0.8-1.2 ratio, amber ≥0.70 and 0.6-1.5, red otherwise.
API example

Monte Carlo VaR endpoint

POST /api/v1/var/compute
{
  "portfolio_value": 1000000,
  "returns": returns,
  "confidence_level": 0.99,
  "horizon_days": 1,
  "n_simulations": 100000
}

→ var_abs: £28,200 (99% VaR)
→ cvar_abs: £35,100 (CVaR/ES)