XVA Foundations

XVA
Computation

Prerequisites

This series assumes you have completed the IR series (IR-01 through IR-08) and can produce a simulated mark-to-market matrix V(t, ω) for any interest rate derivative.

Minimum path to understand CVA (if skipping parts of the IR series): IR-01 (discount curve), IR-04 (stochastic rates), IR-05 (draft), IR-07 (draft), IR-08 (draft); then XVA-01 and XVA-03.

Scope: This series covers single-currency interest rate portfolios. FX, credit, and cross-currency XVA require model extensions not covered here.

XVA is the family of valuation adjustments that account for counterparty credit risk (CVA), own-default risk (DVA), and funding costs (FVA). These quantities are computed on top of the risk-free price and have become a central part of derivatives pricing since the 2008 crisis.

This series assumes you already have the rate model built and calibrated in the Interest Rate Modeling series. Starting from simulated portfolio exposures, it shows how to aggregate trades into netting sets, apply collateral agreements, and compute the CVA and DVA integrals that price the credit risk embedded in a derivative portfolio.

All charts in this series are reproducible. Every data source is named and linked. If you want to verify a result or extend an example, the tools to do so are in your hands.

Series at a glance
3
Chapters live
Prerequisites
  • Interest Rate Modeling series
  • Basic probability
  • Portfolio concepts
The destination

After the full series, you will understand the complete XVA pipeline: from netting and collateral agreements through CVA/DVA, funding costs (FVA), margin and capital charges (MVA/KVA), and the regulatory capital frameworks (SA-CVA, BA-CVA) that govern them.

XVA Series Roadmap

XVA-01 (Exposure: EE, EPE, PFE from V(t, ω))
  → XVA-02 (Aggregation: netting sets, CSA, collateral)
    → XVA-03 (CVA: pricing counterparty default risk)

Each chapter takes the output of the previous as its input:

IR-08 (draft) outputs: V(t, ω) (the exposure matrix)
XVA-01 outputs: EE(t), EPE, PFE per counterparty
XVA-02 outputs: netted/collateralised EE across the portfolio
XVA-03 outputs: CVA charge per netting set

The full family of exposure metrics (E, EE, EPE, EEPE, ENE, EEE, and PFE), defined from first principles, computed on simulated paths, and connected to the regulatory and pricing frameworks that use them.

EPE and PFE
EEPE (regulatory)
Simulated paths
Read chapter →

Before computing any XVA, individual trade-level exposures must be combined into netting sets that reflect the legal agreements between counterparties. This chapter covers netting, the effect of collateral (CSA), and the aggregation of mark-to-market values into portfolio-level EPE and PFE profiles.

Netting sets
Collateral (CSA)
Portfolio EPE
Read chapter →

With exposure profiles in hand, the CVA integral can be evaluated. CVA prices the expected loss from counterparty default by combining the EPE profile with CDS-implied hazard rates. This chapter derives the formula from first principles, implements the full computation in PyTorch, and introduces DVA as the symmetric adjustment.

CVA integral
Hazard rates from CDS
Survival probabilities
Read chapter →

Variation margin, initial margin under SIMM, and the mechanics of collateral agreements. How collateral transforms the exposure profile and what it means for CVA on collateralised vs uncollateralised portfolios.

Funding costs arise when a dealer must borrow to finance a derivative position. This chapter derives the FVA integral, distinguishes symmetric from asymmetric formulations, and separates FBA (funding benefit) from FCA (funding cost).

Margin valuation adjustment (the cost of posting initial margin over the life of the trade), capital valuation adjustment (the cost of regulatory capital), and how the XVA desk attributes these charges to the trading book.

The standardised approach (SA-CVA) and basic approach (BA-CVA) to CVA capital under Basel III/IV. How FRTB reshapes the capital framework for counterparty risk, and what these requirements mean for XVA desk sizing and trade-level allocation.

Where to start

We begin with XVA-01 (Exposure) because every XVA metric (CVA, DVA, FVA) is built on the exposure profile. Exposure tells you how much you stand to lose if your counterparty defaults. Pricing that risk is what CVA does. The pipeline starts here.

Back to Writing

All views expressed are strictly personal and do not represent any past or current employer. Content is educational; nothing here constitutes financial, investment, or trading advice.