Chapter 20 — Counterparty Credit Risk and XVA

"Default risk is not just about the reference entity. It's about who sits across the table."


After this chapter you will be able to:

  • Explain why counterparty credit risk is structurally different from loan credit risk
  • Compute exposure profiles (EPE and PFE) for interest rate swaps via Monte Carlo
  • Derive and implement CVA as the expected present value of counterparty default losses
  • Understand DVA and why it produced controversial P&L entries for major banks in 2011–2012
  • Describe FVA, KVA, and MVA and why they forced a structural reorganisation of derivatives businesses
  • Identify wrong-way risk situations and explain why they cause standard CVA to understate exposure

On 15 September 2008, Lehman Brothers Holdings Inc. filed for Chapter 11 bankruptcy protection. Firms that had traded interest rate swaps, credit default swaps, and other OTC derivatives with Lehman suddenly found themselves holding contracts with a defaulted counterparty. The contracts had theoretical positive market value — Lehman owed them money — but recovery would arrive only after years of bankruptcy proceedings at cents on the dollar. The total counterparty losses from the 2008 crisis, spanning Lehman, AIG, and the monoline insurers, ran into hundreds of billions of dollars. This was not credit risk in the traditional sense of lending money and waiting for repayment — it was the credit risk embedded in derivative contracts themselves.

Counterparty Credit Risk (CCR) is the risk that a derivative counterparty defaults before fulfilling all its future payment obligations. Its central complexity is that the exposure — the amount the counterparty owes you at the time of default — is not known in advance. For a standard bond, the exposure is fixed: the notional plus accrued interest. For an interest rate swap, the exposure at any future date depends on where rates are at that date, which is stochastic. CCR requires simulating future market scenarios and revaluing derivatives under each scenario to compute the distribution of future exposure.

The industry response to 2008 produced a comprehensive framework of XVA adjustments: CVA (credit), DVA (own-default), FVA (funding), KVA (capital), and MVA (margin). Each represents a distinct economic cost of counterparty risk that was previously ignored. This chapter implements CVA and DVA and introduces the machinery of exposure simulation.


20.1 The Pre-Crisis World and Why It Changed

Before 2007, the standard assumption in derivatives pricing was that counterparties were effectively risk-free. A bank pricing an interest rate swap would compute the risk-neutral expected discounted cashflows using the swap rate and the risk-free curve and report that as the derivative's fair value. The possibility that the counterparty might default — and that this would reduce the realised value of the contract below its theoretical price — was either ignored or handled informally through credit limits and occasional ad-hoc reserves.

This assumption was not entirely naive. Large dealer banks operated under ISDA Master Agreements that included close-out netting provisions: if a counterparty defaulted, the bank could net all trades with that counterparty to a single number and claim (or pay) the difference. Most significant derivative trading was done between dealers and large buy-side counterparties (pension funds, asset managers, insurance companies) that were viewed as unlikely to default. The business model assumed that bilateral credit risk, while theoretically present, was not large enough to price explicitly.

Three things changed this. First, the 2008 crisis brought the unexpected default of Lehman Brothers and the near-default of AIG and a constellation of monoline bond insurers, demonstrating that major financial institutions could and did fail with enormous OTC derivative exposures outstanding. Second, the post-crisis regulatory overhaul pushed standardised derivatives onto central clearing platforms where all counterparty risk is replaced by central counterparty (CCP) risk — but non-standard, illiquid, or structured derivatives remained bilateral, with CCR that now had to be priced explicitly. Third, Basel III required banks to capitalise CVA risk as a value-adjustment that could fluctuate, and IFRS 13 required CVA to appear in fair value measurements.

The result is that every major dealer now has an XVA desk whose job is to price, hedge, and manage the XVA adjustments on the whole derivatives book. This is not a back-office function — it prices into every trade at origination, and the XVA "charge" paid by the front-office desk to the XVA desk can be the difference between a profitable trade and an unprofitable one.


20.2 CCR Concepts and CVA Derivation

Counterparty Credit Risk (CCR) is the risk that a counterparty defaults before fulfilling contractual obligations on a derivative. Before building the mathematics, it is worth noting what makes CCR unusual compared to loan credit risk:

  1. The exposure is two-sided. A swap can have positive or negative value to you at any point in time. You face CCR only when the swap has positive value to you (you are "in the money"). If the swap has negative value, the counterparty faces CCR against you.

  2. The exposure is stochastic. The value of a 5-year swap today depends on today's rate. Its value in 2 years depends on rates in 2 years, which we don't know. We must simulate the distribution of future rates to get the distribution of future exposure.

  3. Default and exposure may be correlated. In a benign world, counterparty default probability and trade value are independent. In reality — particularly for sovereigns, financial institutions, and trades referencing the counterparty's own sector — they can be strongly correlated in the worst direction. This is called wrong-way risk and addressed in §20.6.

The key exposure metrics are:

  • Mark-to-Market (MtM): current replacement cost if counterparty defaults today
  • Expected Positive Exposure (EPE): $E[\max(V_t, 0)]$ — expected exposure at time $t$, conditional on it being positive
  • Potential Future Exposure (PFE): a high-quantile (typically 95th or 99th percentile) of the MtM distribution at future dates — used for credit limit monitoring rather than pricing

The EPE profile of a standard interest rate swap has a characteristic hump shape: at $t = 0$ it is zero (by construction of the par swap), it rises as rate uncertainty accumulates and the swap moves off-par, reaches a maximum around mid-life, then falls as remaining cashflows decline toward maturity. For a 5-year at-the-money swap, the EPE peak typically occurs around year 2–3, with magnitude 2–4% of notional.

A cross-currency swap (where principal is exchanged at maturity in different currencies) has a completely different EPE profile: the FX rate uncertainty at maturity creates a large spike in PFE near the end of the contract life, often 10–30% of notional if the exchange rate moves significantly.

CVA derivation: The Credit Valuation Adjustment is the expected present value of losses due to counterparty default. Divide the life of the contract $[0, T]$ into small intervals $[t_i, t_{i+1}]$. In each interval, the counterparty defaults with probability $Q(t_i) - Q(t_{i+1})$, where $Q(t)$ is the risk-neutral survival probability (derived from CDS spreads). If default occurs, the bank loses $(1 - R) \cdot \max(V_{t_i}, 0)$, where $R$ is the recovery rate and $\max(V, 0)$ captures that only positive exposures represent a loss. Discounting and summing:

$$\text{CVA} = (1-R) \sum_{i} \text{EPE}(t_i) \cdot \text{DF}(t_i) \cdot [Q(t_i) - Q(t_{i+1})]$$

In continuous time: $\text{CVA} = (1-R) \int_0^T \text{EPE}(t) \cdot \text{DF}(t) \cdot (-dQ(t))$. Note that CVA is always non-negative (it represents a cost) and reduces the fair value of the derivative: the trade's CVA-adjusted value is $V - \text{CVA}$.

For a counterparty with CDS-implied spread $s$ and recovery $R$, the hazard rate approximation $\lambda \approx s/(1-R)$ gives $Q(t) \approx e^{-\lambda t}$. A counterparty trading at 100bp CDS spread with 40% recovery has $\lambda \approx 167\text{bp}$, so the survival probability at 5 years is $e^{-0.0167 \times 5} \approx 92%$.

Key metrics summary:

$$\text{CVA} = (1-R) \int_0^T \text{EPE}(t)\cdot d(-Q(t)) \cdot \text{DF}(t)$$

  • Mark-to-Market (MtM): current replacement cost if counterparty defaults today
  • Potential Future Exposure (PFE): quantile of MtM distribution at future date
  • Expected Positive Exposure (EPE): $E[\max(V_t, 0)]$ — expected loss given default

$$\text{CVA} = (1-R) \int_0^T \text{EPE}(t)\cdot d(-Q(t)) \cdot \text{DF}(t)$$


20.3 Exposure Profiles

To compute CVA we need the EPE profile: the expected positive mark-to-market of the trade at each future date. This cannot be computed analytically for most products because the distribution of future market conditions is complex. Instead, we use Monte Carlo simulation: generate $N$ paths of the underlying risk factors (here, the short rate under a Vasicek or Hull-White model), revalue the trade at each time step on each path, take the positive part, and average across paths.

The implementation below runs n_paths simulations of n_steps time steps, computing the full exposure distribution — not just the mean (EPE) but also the 95th and 99th percentile PFE, which credit risk teams use for limit monitoring. Note that swap_exposure returns an exposure_profile record with all three curves, so the cva function can consume the EPE while the PFE curves are separately fed into the credit limit system. For a par 5-year swap with $\sigma_{\text{rate}} = 1.5%$, expect EPE to peak around 1.5–2.5% of notional near the swap's midpoint.

Interest Rate Swap Exposure Profile Figure 20.1 — Expected Exposure (EE) and Potential Future Exposure (PFE) for an Interest Rate Swap. The exposure is zero at inception, swells as rate uncertainty accumulates, and amortises to zero as the remaining cashflows decline toward maturity.

module Ccr = struct

  type exposure_profile = {
    time_steps  : float array;
    expected_pe : float array;   (* EPE: E[max(V, 0)] at each t *)
    pfe_95      : float array;   (* 95th percentile PFE *)
    pfe_99      : float array;   (* 99th percentile PFE *)
    mtm         : float;         (* current MtM *)
  }

  (** Compute exposure profile for a swap via simulation *)
  let swap_exposure ~swap ~n_paths ~n_steps ~rate_model () =
    let tau        = swap.Swap.maturity in
    let dt         = tau /. float_of_int n_steps in
    let time_steps = Array.init n_steps (fun i -> float_of_int (i + 1) *. dt) in
    let n_t        = Array.length time_steps in

    (* Simulate short rate paths (Vasicek) *)
    let all_values = Array.init n_paths (fun _ ->
      let r = ref (Vasicek.initial_rate rate_model) in
      Array.init n_t (fun _t ->
        r := Rate_model.vasicek_step rate_model !r dt;
        (* Revalue swap at this path/time — simplified: use current rate + Δr *)
        let pv = Swap.npv_at_rate swap !r in
        pv
      )
    ) in

    (* Compute statistics at each time step *)
    let epe   = Array.init n_t (fun t ->
      let vals = Array.map (fun path -> Float.max 0.0 path.(t)) all_values in
      Array.fold_left (+.) 0.0 vals /. float_of_int n_paths
    ) in
    let pfe f = Array.init n_t (fun t ->
      let vals = Array.map (fun path -> path.(t)) all_values in
      Array.sort compare vals;
      vals.(int_of_float (float_of_int n_paths *. f))
    ) in

    { time_steps; expected_pe = epe; pfe_95 = pfe 0.95; pfe_99 = pfe 0.99;
      mtm = Swap.npv swap }

  (** CVA calculation via EPE profile *)
  let cva ~exposure ~hazard_curve ~recovery ~discount_curve =
    let n  = Array.length exposure.time_steps in
    let cv = ref 0.0 in
    for i = 0 to n - 2 do
      let t1  = if i = 0 then 0.0 else exposure.time_steps.(i - 1) in
      let t2  = exposure.time_steps.(i) in
      let q1  = Credit.survival_pw_const hazard_curve t1 in
      let q2  = Credit.survival_pw_const hazard_curve t2 in
      let tm  = (t1 +. t2) /. 2.0 in
      let df  = Interpolation.discount_factor discount_curve tm in
      let epe = exposure.expected_pe.(i) in
      cv := !cv +. (1.0 -. recovery) *. epe *. df *. (q1 -. q2)
    done;
    !cv

  (** DVA: own credit adjustment — the flip side of CVA *)
  let dva ~exposure ~own_hazard ~own_recovery ~discount_curve =
    let n  = Array.length exposure.time_steps in
    let dv = ref 0.0 in
    for i = 0 to n - 2 do
      let t1  = if i = 0 then 0.0 else exposure.time_steps.(i - 1) in
      let t2  = exposure.time_steps.(i) in
      (* Negative exposures become own default risk DVA *)
      let ene = -. (exposure.expected_pe.(i)) in
      let q1  = Credit.survival_pw_const own_hazard t1 in
      let q2  = Credit.survival_pw_const own_hazard t2 in
      let tm  = (t1 +. t2) /. 2.0 in
      let df  = Interpolation.discount_factor discount_curve tm in
      dv := !dv +. (1.0 -. own_recovery) *. (Float.max 0.0 ene) *. df *. (q1 -. q2)
    done;
    !dv

end

20.4 DVA and the Own-Credit Controversy

Debit Valuation Adjustment (DVA) is the mirror image of CVA. In a bilateral derivative, both parties face counterparty risk. Bank A computes CVA against Bank B (the cost to A of B's potential default). But Bank B simultaneously computes CVA against Bank A. From A's perspective, the CVA that B holds against A reduces A's derivative liability — because A might default and not have to pay. This reduction in liability is DVA.

Mathematically, DVA is computed identically to CVA but using the firm's own hazard rate and the negative part of the exposure profile (Expected Negative Exposure, ENE):

$$\text{DVA} = (1-R_{\text{own}}) \int_0^T \text{ENE}(t) \cdot \text{DF}(t) \cdot (-dQ_{\text{own}}(t))$$

where $\text{ENE}(t) = E[\max(-V_t, 0)]$ is the expected negative exposure — the average when the trade's value to the firm is negative (i.e., the firm owes money).

The bilateral fair value of a derivative is then:

$$V^{\text{bilateral}} = V^{\text{risk-free}} - \text{CVA} + \text{DVA}$$

The controversy: In 2011, as post-crisis credit spreads remained elevated, banks including Morgan Stanley and Goldman Sachs reported large positive DVA P&L in their earnings. Morgan Stanley reported approximately $3.4 billion in DVA gains in Q3 2011 — gains that arose because Morgan Stanley's own credit spreads widened, implying a higher probability that Morgan Stanley itself would default. In other words, a bank becoming less creditworthy caused a gain in its reported P&L. This produced enormous public confusion and regulatory scepticism.

The logic is internally consistent from an accounting standpoint (IFRS 13 exit-price principle), but the operational problem is that DVA gains are almost impossible to monetise: to realise a DVA gain you would need to buy back your own debt at the worsened credit spread, which is prohibitively expensive and practically limited. Post-2013, the Basel Committee required banks to deduct DVA from Common Equity Tier 1 capital precisely because it represents an unrealisable paper gain.

Today, most banks handle DVA asymmetrically: they book CVA as a P&L cost on the trade, but DVA recognition depends on the specific accounting and regulatory framework applied. The practical consensus is that CVA is a real economic cost that must be charged to the front office, while DVA is a more philosophical adjustment that reduces the bank's accounting liability but produces no tradeable benefit.


20.5 Netting and Collateral

Netting agreements (ISDA Master Agreement) allow offsetting MtMs across trades with a single counterparty:

$$\text{MtM}_{\text{netting}} = \max\left(\sum_i V_i,, 0\right) \leq \sum_i \max(V_i, 0)$$

Collateral (CSA) reduces exposure:

$$\text{Exposure} = \max(V - C, 0)$$

where $C$ is the posted collateral (cash/bonds).

module Netting = struct

  type csa = {
    threshold       : float;    (* counterparty threshold *)
    own_threshold   : float;
    minimum_transfer: float;
    independent_amount: float;  (* IA posted by counterparty *)
  }

  (** Exposure after netting and collateral *)
  let net_exposure ~mtms ~collateral ~csa =
    let net_mtm = Array.fold_left (+.) 0.0 mtms in
    let collat  = collateral -. csa.independent_amount in
    Float.max 0.0 (net_mtm -. collat)

  (** Margin period of risk (MPOR): days to re-hedge after default *)
  let mpor_adjustment ~epe ~mpor_days =
    let scale = sqrt (float_of_int mpor_days /. 252.0) in
    Array.map (fun e -> e *. scale) epe

end

Netting has a dramatic effect on CVA. Consider a counterparty with whom you have a 5-year receiver swap (positive value when rates fall) and a 5-year payer swap (positive value when rates rise). Without netting, both swaps contribute positive EPE on their respective rate scenarios. With netting, only the net position matters: when rates fall the receiver is in-the-money but the payer is out-of-the-money, and the two substantially offset. The netting benefit (ratio of gross EPE to net EPE) can be 50–80% for a well-diversified portfolio of rates trades, which is why ISDA netting agreements are operationally critical — securing one before trading with a new counterparty is a standard credit precondition at every major dealer.

Collateral managed under a Credit Support Annex (CSA) reduces exposure further. Under a daily-call CSA with zero threshold and zero minimum transfer amount, the variation margin posting essentially eliminates EPE except for the margin period of risk (MPOR): the 2–10 days it takes to identify a default, stop posting margin, call in outstanding collateral, and re-hedge the position. Under Basel III, the regulatory MPOR for bilateral trades is at least 10 business days. The mpor_adjustment function scales the EPE by $\sqrt{\text{MPOR}/252}$, reflecting that exposure over the risk period grows with the square root of time under diffusive dynamics.


20.6 Wrong-Way Risk

Wrong-way risk (WWR) arises when the exposure on a trade is positively correlated with the counterparty's default probability. In the standard CVA formula we assume independence: the EPE(t) term and the default probability density $(-dQ(t))$ are computed separately and multiplied together. If they are in fact positively correlated — if higher exposure coincides with higher default probability — then the product understates the true credit cost.

Classic wrong-way risk examples:

  • FX forwards with emerging-market banks: A bank sells USD to a Brazilian counterparty in exchange for BRL deliverable in 6 months. If Brazil experiences a sovereign debt crisis, the BRL weakens (increasing the positive USD value of the trade to the bank), and simultaneously the Brazilian bank counterparty is likely to be in financial distress. The moments of maximum exposure and maximum default probability coincide exactly.

  • AIG and the financial crisis: AIG Financial Products had sold credit protection (via credit default swaps) on CDO tranches to major banks including Goldman Sachs. As the CDO market deteriorated in 2008, the market value of the CDS positions moved deeply in favour of the banks (large positive exposure to AIG), while simultaneously AIG's creditworthiness collapsed entirely. This is textbook wrong-way risk: the counterparty most likely to default was precisely the one that owed the most, exactly when it owed the most. AIG's actual default was prevented only by an $85 billion Federal Reserve credit facility in September 2008 — without which, the banks would have faced catastrophic CVA losses on their largest exposures simultaneously.

  • Equity collateral from a correlated counterparty: If a hedge fund posts its own equity (or equity in its prime broker) as collateral on a trade, the collateral loses value precisely when the fund is most likely to be in distress — the opposite of what collateral is supposed to achieve.

Modelling wrong-way risk properly requires replacing the independence assumption with a joint model for market risk factors and counterparty credit quality. A common approach is a factor model where the counterparty's hazard rate $\lambda(t)$ is stochastic and correlated with the underlying risk factors of the trade. The correct CVA calculation then uses the joint simulation. Implementing general WWR adds substantial complexity and is a research-active area; many production CVA engines approximate it with WWR stress factors or specific case-by-case models for known problematic trade types.


20.7 FVA, KVA, and MVA

The XVA family extends well beyond CVA and DVA. The 2010–2016 period produced a series of additional adjustments as banks recognised that uncollateralised derivatives have economic costs beyond default risk.

Funding Valuation Adjustment (FVA): An uncollateralised trade requires the bank to fund its hedge. If the bank hedges an uncollateralised swap with a collateralised interbank swap, it posts variation margin to the hedge counterparty daily. This variation margin must be funded at the bank's cost of funds — which, post-crisis, could be 50–100bp above OIS for major banks. FVA is the present value of the expected funding cost over the life of the trade. FVA was controversial among academics (Hull and White argued it duplicates DVA economically) but became standard practice because traders' actual cost of capital demanded it.

Capital Valuation Adjustment (KVA): Under Basel III, derivatives require regulatory capital (via the CVA capital charge). This capital is not free — shareholders require a return on it commensurate with the risk taken. KVA is the present value of the expected capital cost over the trade's life, computed as the expected future regulatory capital times the hurdle rate above risk-free. It tends to be material for long-dated trades where capital requirements accumulate into a significant present-value cost.

Margin Valuation Adjustment (MVA): For centrally cleared or initial-margin-required trades, the initial margin posted represents a funding cost even if no default ever occurs. The margin earns only the near-zero risk-free rate rather than the firm's cost of funds. MVA prices this funding cost. Since the 2016 BCBS/IOSCO Phase-In rules required bilateral initial margin for non-cleared derivatives, MVA became significant: initial margin on large bilateral portfolios can run to billions of dollars.

The total XVA adjustment on a trade is therefore:

$$V^{\text{XVA}} = V^{\text{risk-free}} - \text{CVA} + \text{DVA} - \text{FVA} - \text{KVA} - \text{MVA}$$

On a sufficiently long-dated or large uncollateralised trade, the aggregate XVA can easily amount to 1–3% of notional — comparable in size to the bid-ask spread on the risk-free leg of the trade itself.


20.8 Chapter Summary

Counterparty credit risk is structurally different from traditional credit risk because the exposure is random. A bond has a fixed notional; a swap has an exposure that depends on future interest rates. This randomness requires a simulation-based approach: generate thousands of market risk scenarios, revalue each trade at each future date under each scenario, and compute the distribution of future exposure.

CVA is the market price of counterparty risk in a derivative contract: $(1-R) \int_0^T \text{EPE}(t) \cdot \text{DF}(t) \cdot (-dQ(t))$, where EPE is the Expected Positive Exposure, DF is the discount factor, and $dQ(t)$ is the risk-neutral default probability density. CVA is a cost borne by the party facing counterparty default risk and reduces the fair value of the derivative.

DVA is the controversial symmetric adjustment: it accounts for the fact that if you might default yourself, your counterparty faces CVA against you, which reduces your own liability. DVA produces the uncomfortable result that a firm's P&L improves when its own credit spreads widen. Post-2008, IFRS 13 required DVA in fair value measurements, while Basel III required banks to deduct it from regulatory capital because it is not realisable.

Netting and collateral are the primary risk mitigants: netting reduces gross exposures by 50–80% for diversified portfolios; daily variation margin under a zero-threshold CSA reduces residual EPE to the margin period of risk. Wrong-way risk — when exposure is positively correlated with the counterparty's default probability — breaks the independence assumption in the CVA formula and typical examples (AIG, FX with EM banks, equity collateral) cause standard CVA models to dramatically understate true CCR.

The XVA framework (CVA + DVA + FVA + KVA + MVA) has restructured how banks price and manage derivatives. XVA desks at major dealers hold the full portfolio of uncollateralised trades and charge the front office for the aggregate economic costs. Understanding XVA is essential for anyone working on the pricing, risk management, or accounting side of OTC derivatives.


Exercises

20.1 [Basic] Compute the exposure profile for a 5-year interest rate swap under a Vasicek short-rate model using 10,000 Monte Carlo paths with 60 monthly steps. Plot EPE, PFE-95, and PFE-99 curves and verify the characteristic hump shape peaks near year 2–3.

20.2 [Basic] Calculate CVA for the swap in 20.1 assuming a counterparty hazard rate of 80bp, recovery 40%, flat 3% discount curve. What is the CVA as a percentage of notional? How does it scale if the hazard rate doubles?

20.3 [Intermediate] Study netting: price two swaps — one receiver, one payer — with the same counterparty. Compute gross CVA (no netting) vs net CVA. Quantify the netting benefit as a fraction of gross CVA.

20.4 [Intermediate] Implement DVA: using the exposure profile from 20.1, compute DVA assuming the bank's own credit spread is 50bp with 40% recovery. Show how $V^{\text{risk-free}} - \text{CVA} + \text{DVA}$ differs from the one-way CVA-adjusted price.

20.5 [Advanced] Implement a simplified wrong-way risk model: let the counterparty's hazard rate be $\lambda(t) = \lambda_0 + \rho \cdot (r(t) - r_0)$ where $r(t)$ is the swap rate from the simulation. For $\rho = +0.5$ (positive wrong-way risk), compare the correlated CVA to the independent CVA from 20.2.

20.6 [Advanced] Implement a toy FVA calculation: assume the bank funds uncollateralised at OIS + 80bp. Compute FVA as the present value of the expected funding cost on the EPE profile. Compare FVA to CVA for the 5-year swap — which dominates at short vs long maturities?


Next: Chapter 21 — Portfolio Risk and Optimization