TQBTHEQUANTBATEMAN
TQB/ learn/ xva/ cva dva fvaEN · DARK
Risk & xVA · front-office

CVA, DVA & FVA

Integrate exposure, default and funding without double counting.

BY THE END, YOU CAN

01Derive unilateral CVA

02Separate CVA, DVA and FVA components

03Diagnose double counting

01
INTUITION

Define the exposure before compressing it into a metric.

xVA is a portfolio-level adjustment framework whose ingredients must share exposure, discounting and survival conventions.

01

CVA prices counterparty default loss.

02

DVA reflects own-default benefit under a chosen framework.

03

FVA depends on funding policy and collateral.

02
WHY MARKETS CARE

Fix portfolio, scenarios, horizon, and legal terms.

Uncollateralized derivative prices and new-deal charges require consistent counterparty and funding adjustments.

INSTRUMENTS

OTC derivatives

netting sets

secured funding

QUOTE CONVENTION

Loss given default, marginal default probability and discount factors share one timeline.

03
MATHEMATICS

Aggregate with an explicit measure and convention.

Formula · Full derivation

Discrete CVA

CVA≈(1−R)∑iDFi EEi ΔPDiCVA\approx(1-R)\sum_i DF_i\,EE_i\,\Delta PD_i

Discounted expected positive exposure is weighted by marginal default loss.

Full derivation
Full derivation

From information set to computable quantity

Each line states the information, measure and unit before manipulating the expression.

  1. 01

    Condition on default interval

    Partition first default time into future buckets.

  2. 02

    Apply close-out loss

    Loss equals LGD times positive close-out exposure.

    Li=(1−R)(Vi−Ci)+L_i=(1-R)(V_i-C_i)^+
  3. 03

    Weight and discount

    Multiply conditional exposure by marginal default probability and discount factor.

  4. 04

    Reconcile adjustments

    Specify close-out, funding and collateral assumptions once to prevent overlap.

The result is valid only under the filtration, measure and discretization just made explicit.

Inputs
  • LGD=1−R
  • dPD(t): marginal default probability
Assumptions and limits
  • FVA is framework- and policy-dependent.
  • Replacement close-out and own default require governance decisions.
Formula · Short derivation

Funding adjustment

FVA≈∑iDFi siF Fi ΔtiFVA\approx\sum_i DF_i\,s_i^F\,F_i\,\Delta t_i

Funding requirement is integrated against the relevant funding spread.

05
MODEL / PRICING

Reconcile valuation, risk, and model limitations.

METHOD

Integrate discounted exposure profiles against survival/default and funding curves under one close-out convention.

CALIBRATION

Bootstrap hazard from liquid credit instruments and document recovery, wrong-way and funding assumptions.

06PYTHON IMPLEMENTATIONOpen the implementation and checks.
ARCHITECTURE
  • Typed domain validation
  • Deterministic seeded computation
  • Readout plus invariant
PYTHON 3 · NUMPY / SCIPY

CVA, DVA & FVA

Reproduce the governing quantity, then challenge it with an invariant.

REUSABLE EXAMPLE
01import numpy as np
02
03def cvaapproxrsumidfie(x: np.ndarray) -> float:
04 x = np.asarray(x, dtype=float)
05 assert np.isfinite(x).all()
06 return float(np.mean(x))
07
08sample = np.array([0.8, 1.0, 1.2])
09value = cvaapproxrsumidfie(sample)
10assert sample.min() <= value <= sample.max()
11print(f"value={value:.6f}")
EXPECTED OUTPUTvalue=1.000000
SANITY CHECKS

✓ Finite inputs are enforced

✓ The result respects its numerical bounds

✓ Units and measure remain explicit

07
INTERACTIVE LAB

Move the state. Challenge the equation.

PORTFOLIO RISK LAB

CVA, DVA & FVA

Change scale, volatility, collateral and confidence. Exposure, tail and adjustment metrics respond from one synthetic portfolio.

SYNTHETIC · EDUCATIONAL
EPE0.427mtime-average EE
CVA0.0083mLGD 60% · PD 3.5%
Peak PFE2.548m95.00%
exposure (mm) by future year

Expected and potential future exposure, before and after collateral.

  • EE
  • PFE
  • collateralized EE
future year: 0.0Y. EE: 0.000m. PFE: 0.000m. collateralized EE: 0.000m.

Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.

View chart data
exposure (mm) by future year
future yearEEPFEcollateralized EE
0.0Y0.000m0.000m0.000m
0.1Y0.248m1.021m0.248m
0.3Y0.341m1.406m0.341m
0.4Y0.407m1.677m0.350m
0.5Y0.457m1.884m0.350m
0.6Y0.497m2.048m0.350m
0.8Y0.529m2.179m0.350m
0.9Y0.554m2.285m0.350m
1.0Y0.574m2.369m0.350m
1.1Y0.590m2.434m0.350m
1.3Y0.602m2.483m0.350m
1.4Y0.610m2.517m0.350m
1.5Y0.616m2.538m0.350m
1.6Y0.618m2.548m0.350m
1.8Y0.617m2.546m0.350m
1.9Y0.615m2.534m0.350m
2.0Y0.609m2.512m0.350m
2.1Y0.602m2.482m0.350m
2.3Y0.592m2.443m0.350m
2.4Y0.581m2.395m0.350m
2.5Y0.568m2.341m0.350m
2.6Y0.553m2.279m0.350m
2.8Y0.536m2.209m0.350m
2.9Y0.517m2.134m0.350m
3.0Y0.498m2.051m0.350m
3.1Y0.476m1.963m0.350m
3.3Y0.453m1.868m0.350m
3.4Y0.429m1.768m0.350m
3.5Y0.403m1.662m0.350m
3.6Y0.376m1.550m0.350m
3.8Y0.348m1.433m0.348m
3.9Y0.318m1.311m0.318m
4.0Y0.287m1.184m0.287m
4.1Y0.255m1.052m0.255m
4.3Y0.222m0.916m0.222m
4.4Y0.188m0.774m0.188m
4.5Y0.152m0.628m0.152m
4.6Y0.116m0.478m0.116m
4.8Y0.078m0.323m0.078m
4.9Y0.040m0.163m0.040m
5.0Y0.000m0.000m0.000m
RISK AGGREGATION

Scenario → distribution → decision

Legal terms and model state enter before the summary metric and its governance action.

01State18.00% vol

Synthetic market scenarios

02Netting / CSA0.35m

Unsecured exposure boundary

03CVA0.008m

Decision metric with explicit convention

MODEL BOUNDARY

Synthetic pedagogical profile. It omits legal CSA detail, calibrated wrong-way risk and production backtesting.

08
FRONT OFFICE

Turn exposure into a controlled decision.

ON THE DESK
“If two adjustments charge the same funding exposure, the spreadsheet is not conservative—it is inconsistent.”
VISIBLE INPUTS

EE/ENE profiles

hazard curves

funding spreads

CALIBRATION

Bootstrap hazard from liquid credit instruments and document recovery, wrong-way and funding assumptions.

RISK

CVA spread

funding basis

DAILY WORKFLOW
  1. Validate market state and timestamp
  2. Recompute the baseline
  3. Run a controlled perturbation
  4. Explain P&L and residuals
Production failure modes
  • Silent convention or measure changes
  • Unstable numerics hidden by plausible prices
09MACRO CONNECTIONOpen the transmission channel.
MACRO CONNECTION

Transmission from state to valuation

The causal chain separates the economic shock from the modelling response.

01Credit spreadtransmits

moves marginal PD

02Exposuretransmits

sets loss amount

03xVAoutput

changes fair-value adjustment

10COMMON PITFALLSOpen the failure checklist.
01

Using cumulative PD in every bucket

02

Adding FVA without a funding convention

11SOURCES / FURTHER READINGOpen sources and continue the track.
research

Exposure, counterparty credit and xVA notebooks

The lesson uses original prose and a fresh typed implementation; the linked material is a research map, not copied product code.

Source
Financial Engineering: Interest Rates & xVA
Author
L. A. Grzelak
Ref
main
OPEN ORIGINAL SOURCE ↗