Counterparty Risk and CVA › Worked Example: Complete CVA Calculation

Michael BrenndoerferDecember 23, 20255 min read
Quantitative FinanceAll chapters
Part 10 of 15Risk Management and Financial Risk Controls
Chapter 56Counterparty Risk and CVA › Worked Example: Complete CVA Calculation
Reading section 13 of 16 · Worked Example: Complete CVA Calculation · 5 minSection 13 of 16 · 5 min

Book contents

Section 13 of 16 · 5 min read

Counterparty Risk and CVA › Worked Example: Complete CVA CalculationOne section · Sections in this chapter13 / 16 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Let's work through a detailed example that brings together all the concepts we have developed. This example demonstrates the complete CVA calculation workflow for a more complex product: a cross-currency swap. Consider a 5-year cross-currency swap where you receive EUR fixed at 2% and pay USD floating (SOFR) on €10 million notional.

In[26]:
Code
import numpy as np

# Cross-currency swap parameters
notional_eur = 10_000_000
initial_fx = 1.10  # EUR/USD
notional_usd = notional_eur * initial_fx
swap_maturity = 5.0
r_usd = 0.03  # USD risk-free rate
n_steps_cc = 20  # Quarterly
dt_cc = swap_maturity / n_steps_cc
times_cc = np.linspace(0, swap_maturity, n_steps_cc + 1)

# Counterparty: European corporate with 200bp CDS spread
cds_spread_cp = 0.02
recovery_cp = 0.35

# Simulate FX rate (GBM)
n_paths_cc = 5000
np.random.seed(123)

# FX volatility
fx_vol = 0.10

# Simulate FX paths
fx_paths = np.zeros((n_paths_cc, n_steps_cc + 1))
fx_paths[:, 0] = initial_fx

for t in range(n_steps_cc):
    dW = np.random.standard_normal(n_paths_cc) * np.sqrt(dt_cc)
    fx_paths[:, t + 1] = fx_paths[:, t] * np.exp(
        -0.5 * fx_vol**2 * dt_cc + fx_vol * dW
    )


# Simplified swap MTM: dominated by FX movement and notional exchange
def xccy_swap_mtm(fx_rate, initial_fx, time_to_maturity, notional_eur, r_rate):
    """
    Simplified MTM for receive-EUR cross-currency swap.
    Focuses on notional exchange risk.
    """
    # At maturity, receive EUR notional and pay USD notional
    # Value depends on FX rate change
    fx_change = fx_rate - initial_fx

    # PV of notional exchange difference (simplified)
    # If EUR strengthens, swap is valuable (receive more USD-equivalent)
    discount = np.exp(-r_rate * time_to_maturity)  # Simplified discounting
    mtm = fx_change * notional_eur * discount

    return mtm


# Calculate exposure profiles
exposures_cc = np.zeros((n_paths_cc, n_steps_cc + 1))

for t_idx in range(n_steps_cc + 1):
    time_remaining = swap_maturity - t_idx * dt_cc
    for path in range(n_paths_cc):
        mtm = xccy_swap_mtm(
            fx_paths[path, t_idx],
            initial_fx,
            time_remaining,
            notional_eur,
            r_usd,
        )
        exposures_cc[path, t_idx] = max(mtm, 0)

ee_cc = exposures_cc.mean(axis=0)
Out[27]:
Visualization
Cross-currency-swap expected exposure and 95 percent potential future exposure over five years. Expected exposure rises toward about one million dollars, while 95 percent PFE rises more steeply toward about 4.5 million dollars at maturity.
Cross-currency swap exposure profile showing increasing exposure toward maturity due to notional exchange risk. Unlike interest rate swaps, cross-currency swaps have peak exposure near maturity.

The cross-currency swap shows an exposure profile that increases toward maturity, opposite to the interest rate swap pattern. This reflects the notional exchange at maturity: if EUR/USD moves significantly over five years, the notional exchange creates substantial exposure. The longer the time horizon, the more opportunity there is for the exchange rate to drift from its initial value, and the resulting exposure accumulates until the large final exchange at maturity.

In[28]:
Code
import numpy as np

# Calculate CVA
lgd_cp = 1 - recovery_cp
mpd_cc, _ = calculate_default_probabilities(
    cds_spread_cp, recovery_cp, times_cc
)
df_cc = np.exp(-r_usd * times_cc)

cva_cc = calculate_cva(ee_cc, mpd_cc, df_cc, lgd_cp)
Out[29]:
Console
Cross-Currency Swap CVA Analysis
=============================================
EUR Notional:           €10,000,000
Initial FX Rate:        1.10 EUR/USD
USD Equivalent:         $11,000,000

Counterparty CDS:       200 bps
Recovery Rate:          35%

Peak Expected Exposure: $980,560
Peak 95% PFE:           $4,461,123

CVA:                    $51,896
CVA as % of Notional:   0.47%

The CVA for this cross-currency swap is substantially higher than for the interest rate swap of similar notional, which reflects both the higher counterparty credit risk (200bp vs 150bp) and the fundamentally different exposure profile with concentration near maturity. This example illustrates why cross-currency swaps receive special attention in counterparty risk management: their exposure profiles are back-loaded, meaning the largest exposures occur precisely when survival probability is lowest.

Key Parameters

The key parameters for the cross-currency swap CVA model are:

  • Notional: Principal amount exchanged at maturity. The large final exchange drives exposure.
  • Initial FX: The starting exchange rate. Changes in FX rate drive the mark-to-market value.
  • σFX\sigma_{FX}: FX volatility. Higher volatility increases potential future exposure and CVA.
  • Spread: CDS spread of the counterparty. A higher spread implies higher default probability.
  • rUSDr_{USD}: USD risk-free rate used for discounting future exposure.
Out[30]:
Visualization
Line chart comparing expected exposure over ten years for an interest rate swap with a mid-life hump and a cross-currency swap whose exposure rises to a peak at maturity.
Expected exposure profiles for interest rate and cross-currency swaps with similar notional amounts. The interest rate swap exhibits a characteristic hump shape that decays as cash flows are realized, whereas the cross-currency swap exposure grows toward maturity due to the significant risk associated with the final exchange of notionals.