18 July 202618 juillet 2026article

VaR vs. CVaR: A Python ReproductionVaR vs. CVaR : Une reproduction en Python

Empirically testing risk coherence, Monte Carlo stability, and the FRTB regulatory shift.Test empirique de la cohérence du risque, de la stabilité de Monte Carlo et du changement réglementaire FRTB.

Risk ManagementQuantitative FinancePython

To truly understand quantitative finance, one must build its foundational models from scratch. Following our theoretical breakdown of Value at Risk (VaR) and Conditional Value at Risk (CVaR), we are now bridging the gap between mathematical theory and practical implementation.

We have open-sourced a complete Python environment to empirically verify the core claims of our previous research: the instability of VaR, its dangerous violation of subadditivity, and the exact mechanics behind the Basel Committee's FRTB regulatory shift.

Step 1: Monte Carlo Simulation and Estimator Stability

In complex portfolios containing options and non-linear payoffs, risk cannot be computed with simple closed-form equations. We simulate 10,000 daily P&L paths for a portfolio that is long delta and short gamma (exhibiting negative convexity and tail risk).

The script strictly computes the 99% VaR and the 99% CVaR using direct sorting algorithms.

  • Calculation Match: For 10,000 scenarios at a 99% confidence level, the 99% VaR (the 100th worst loss) evaluates to 2,602.11. The 99% CVaR (the average of the worst 100 losses) evaluates to 3,189.63. Comparing the direct sorting method to statistical quantile functions, the two methods match exactly.
  • Statistical Stability: Running this simulation across 20 independent random seeds reveals that CVaR is actually a more stable estimator than VaR. Because CVaR aggregates 100 observations instead of relying on a single quantile threshold, its relative statistical noise is only 1.9%, compared to 2.3% for VaR.

Step 2: The Subadditivity Violation (Mathematical Coherence)

The fundamental flaw of VaR is that it penalizes diversification. We recreate the classic analytical counter-example: two independent corporate bonds, each with a 0.8% default probability and a 100.00 loss magnitude.

  • Analytical Failure: Because the default probability (0.8%) is lower than the 1% tail threshold, the 99% VaR for Bond A is 0.00, and for Bond B is 0.00. However, the probability of at least one bond defaulting pushes the 99% VaR of the combined portfolio to 100.00. VaR mathematically penalizes holding a diversified portfolio.
  • CVaR Coherence: On the exact same portfolio, the 99% CVaR for each individual bond is 80.00 (a sum of 160.00). The 99% CVaR of the combined portfolio evaluates to 100.64. Thus, CVaR inherently preserves subadditivity and accurately reflects the benefits of diversification.
  • Monte Carlo Frequency: When generating 2,000 random portfolio pairings, VaR violated subadditivity in 3.9% of the cases. As mathematically proven, CVaR violated subadditivity in 0.0% of the tested scenarios.

Step 3: The FRTB Regulatory Shift

The Basel Committee's Fundamental Review of the Trading Book (FRTB) mandates a shift from 99% VaR to a 97.5% Expected Shortfall (CVaR). We simulate different market environments to test the capital gap this creates.

  • Under Normal Markets: If markets are perfectly Gaussian (normal distribution), the ratio between the 97.5% ES and the 99% VaR is 1.005. The regulatory shift barely changes the required capital.
  • Under Fat Tails: As the tail becomes thicker (simulating realistic financial markets), the capital gap diverges. For a Student-t distribution with ν=3, the 97.5% ES to 99% VaR ratio increases to 1.111. The ratio consistently decreases back toward 1.00 as the distribution approaches normality.
  • The 2008 Stress Scenario: We simulated a mixture model where 99% of returns are normal, but 1% represent a severe market crash. Here, the 99% VaR registered at 2,939,359. However, the 97.5% ES aggressively aggregated the severity of the crisis, landing at 4,806,174. This yields a ratio of 1.64, perfectly illustrating why regulators consider VaR "blind" to the true magnitude of extreme market shocks.
> RESEARCH_ARTIFACTS_AVAILABLE
</> GITHUB REPO

Pour vraiment comprendre la finance quantitative, il faut construire ses modèles fondamentaux à partir de zéro. Suite à notre analyse théorique de la Value at Risk (VaR) et de la Conditional Value at Risk (CVaR), nous passons de la théorie mathématique à l'implémentation pratique.

Nous avons rendu open-source un environnement Python complet pour vérifier empiriquement nos recherches : l'instabilité de la VaR, sa violation dangereuse de la sous-additivité, et la mécanique exacte derrière le changement réglementaire FRTB du Comité de Bâle.

Étape 1 : Simulation de Monte Carlo et Stabilité des Estimateurs

Dans les portefeuilles complexes contenant des options et des gains non linéaires, le risque ne peut être calculé par de simples équations. Nous simulons 10 000 trajectoires de P&L quotidiens pour un portefeuille long delta et short gamma.

  • Correspondance des calculs : Pour 10 000 scénarios avec un niveau de confiance de 99 %, la VaR 99 % (la 100ème pire perte) est évaluée à 2 602,11. La CVaR 99 % (la moyenne des 100 pires pertes) est évaluée à 3 189,63. Les deux méthodes (tri direct et quantile statistique) concordent exactement.
  • Stabilité statistique : L'exécution sur 20 graines aléatoires révèle que la CVaR est un estimateur plus stable. Son bruit statistique relatif n'est que de 1,9 %, contre 2,3 % pour la VaR.

Étape 2 : La violation de la sous-additivité

Le défaut fondamental de la VaR est qu'elle pénalise la diversification. Nous recréons le contre-exemple analytique classique : deux obligations d'entreprise indépendantes, chacune avec une probabilité de défaut de 0,8 % et une perte de 100,00.

  • Échec analytique : La probabilité de défaut (0,8 %) étant inférieure au seuil de 1 %, la VaR 99 % pour chaque obligation est de 0,00. Cependant, la probabilité qu'au moins une obligation fasse défaut pousse la VaR 99 % du portefeuille combiné à 100,00. La VaR pénalise mathématiquement la détention d'un portefeuille diversifié.
  • Cohérence de la CVaR : Sur ce même portefeuille, la CVaR 99 % pour chaque obligation est de 80,00 (une somme de 160,00). La CVaR combinée est évaluée à 100,64. La CVaR préserve donc la sous-additivité.
  • Fréquence Monte Carlo : Sur 2 000 paires de portefeuilles, la VaR a violé la sous-additivité dans 3,9 % des cas, contre 0,0 % pour la CVaR.

Étape 3 : Le changement réglementaire FRTB

La FRTB impose de passer d'une VaR 99 % à un Expected Shortfall (CVaR) à 97,5 %.

  • Marchés normaux : Si les marchés sont gaussiens, le ratio entre l'ES 97,5 % et la VaR 99 % est de 1,005. Le capital requis change peu.
  • Queues épaisses : Pour une distribution de Student avec ν=3, le ratio passe à 1,111. L'écart de capital diverge.
  • Scénario de crise 2008 : Sous un modèle mixte incluant 1 % de crashs sévères, la VaR 99 % est de 2 939 359, mais l'ES 97,5 % bondit à 4 806 174 (un ratio de 1,64). Cela illustre pourquoi la VaR est jugée aveugle face aux chocs extrêmes.
> RESEARCH_ARTIFACTS_AVAILABLE
</> GITHUB REPO