Skip to content
Finance Lessons

Counterparty Risk & XVA

What Is Counterparty Risk?

Why a derivative is a two-way credit relationship a loan never is: settlement vs replacement risk, why exposure swings sign, and how 2008 turned counterparty risk into a front-office discipline.

14 min Updated Jun 14, 2026

You already know how to price a swap and how to read a CDS — you’ve built the instruments. This course asks a colder question about all of them: what happens if the person on the other side of the trade simply doesn’t pay? Every swap, every forward, every option you hold isn’t just exposure to a rate or a price — it’s also a bet that a specific institution stays solvent long enough to honor it. That bet has a name, counterparty risk, and for derivatives it behaves in a way a loan never does: the risk runs both ways, and it changes by the minute. This lesson sets up the entire course by getting one idea perfectly clear — why a derivative is a two-way credit relationship — and ends by pointing at the thing we’ll spend the rest of the course measuring and pricing.

Before you read — take a guess

You enter a 5-year interest-rate swap with a bank. A year in, the swap is worth +$2m to you (the bank owes you that if it closed today). Before we define anything — who carries counterparty credit risk in this relationship?

A loan is one-way; a derivative is two-way

Analogy. A loan is like lending your neighbor $100. There’s exactly one way this can go wrong: they don’t pay you back. You are never going to wake up one morning owing them $100 because lawn-care prices moved. The risk points in a single direction, from borrower to lender, and it stays there. A derivative is more like a bar tab that runs both ways — you each keep buying rounds for the other, and on any given night the question “who owes whom, and how much?” depends entirely on who’s been buying. Some nights you’re up; some nights you’re down. The credit risk follows the tab, and the tab swings.

The definition. Counterparty credit risk (CCR) is the risk that the other party to a derivative — your counterpartydefaults (fails to meet its obligations, e.g. through bankruptcy) before the contract has fully settled (finished exchanging all its payments). The crucial contrast is with a bond or a loan, where credit risk is unilateral: only the borrower can ever owe the lender, so only the lender bears default risk. A derivative is bilateral. Because its mark-to-market (MtM) — the value if you closed it out at today’s prices — can be positive (they owe you) or negative (you owe them), and because that sign flips as the market moves, each side carries credit risk to the other.

To make “two-way” concrete, here’s the jargon, defined once:

  • Counterparty — the institution on the other side of your trade.
  • Default — they fail to pay what the contract requires (typically via insolvency).
  • Mark-to-market (MtM) — the contract’s current close-out value to you. Positive = an asset (they’d owe you); negative = a liability (you’d owe them).
  • Bilateral — both sides are exposed, because either side can be the one in-the-money.

Worked example — the sign flips. Take a 5-year receive-fixed interest-rate swap: you receive a fixed rate, pay a floating rate. Suppose when you put it on, market rates then fall. Receiving fixed while everyone else now pays a lower fixed rate is valuable, so a year in the swap is worth +$2m to you — that’s its MtM. If your counterparty defaulted today, you’d lose that $2m of value you were counting on. Now fast-forward another year and suppose rates have instead risen sharply. Now your locked-in fixed rate looks below market, the swap is a drag, and its MtM is −$2m to you — you’re the one out-of-the-money. The exact same contract, untouched, went from a $2m asset to a $2m liability. Who bears counterparty risk didn’t stay put; it crossed the table.

TimeWhat rates didSwap MtM to youWho is exposed to default
Year 1Fell+$2m (asset)You — counterparty owes you $2m
Year 2Rose sharply−$2m (liability)Counterparty — you owe them $2m
Warning:

The trap: 'I'm the customer, so only the bank can stiff me'

The single most common beginner mistake is assuming counterparty risk only flows toward you — that because the bank is big and you’re the client, only its default matters. Wrong on both counts. First, your default matters too: when the swap is a liability to you, you are the credit risk in the room, and the bank prices that. Second, banks fail (Lehman did). Counterparty risk is bilateral by construction — it isn’t about who’s bigger, it’s about who happens to be in-the-money right now, and that changes.

Fill in why a derivative differs from a loan.

Pick the right option for each blank, then check.

In a loan, credit risk is : only the borrower can owe the lender. In a swap it is , because the contract's can be positive or negative and as markets move — so each side is, at different times, the one exposed to the other's default.

Settlement risk vs. replacement risk

Before you read — take a guess

On the morning of 26 June 1974, German bank Herstatt took in Deutschmark payments from its FX counterparties, then had its license pulled before its New York correspondent sent out the corresponding US-dollar legs. The counterparties had paid and got nothing back. Which flavor of counterparty risk is this?

Counterparty risk actually splits into two distinct hazards, and this course is squarely about the second one — so let’s separate them cleanly.

Settlement risk (a.k.a. Herstatt risk). This is the risk that your counterparty fails during the actual exchange of payments — you send your leg, and theirs never arrives. It’s named after Bankhaus Herstatt, a German bank shut down mid-settlement in 1974 after counterparties had already paid it Deutschmarks but before the matching dollars were released across time zones. The exposure window is short (hours), but the loss can be the entire payment, not just its change in value. The good news: the industry largely engineered this away with payment-versus-payment (PvP) settlement — most famously CLS Bank for FX — where neither leg releases unless both do. Settlement risk is mostly a solved problem.

Replacement risk. This is the one that matters for the rest of the course. It’s the risk that your counterparty defaults mid-life — well before any final settlement — and you must go to the market to replace the defaulted trade at current prices. The loss isn’t the notional; it’s the cost of re-establishing the same position now, which is exactly the trade’s MtM if that MtM is in your favor. This gives us the foundational formula of the entire subject:

Exposure=max(MtM,0)\text{Exposure} = \max(\text{MtM}, 0)

You only lose what they owe you. If, at the moment of their default, the trade is an asset to you (positive MtM), you lose that value — you have to pay up to replace it. If the trade is a liability to you (negative MtM), their default doesn’t cost you a replacement loss at all: you’d happily replace a position you were underwater on, and you still owe your side. Exposure is floored at zero.

Worked example — both directions. Suppose a counterparty defaults and you have one swap with them.

  • Case A: the swap is +$3m to you. Exposure = max(3,0)=3\max(3, 0) = 3, i.e. $3m. To get back the position you lost, you re-trade in the market and effectively eat that $3m of value (before any recovery). You’re hurt.
  • Case B: the swap is −$3m to you. Exposure = max(3,0)=0\max(-3, 0) = 0, i.e. $0. You were underwater by $3m. Replacing the trade at market costs you nothing extra — if anything you’re glad to be out — and you remain liable for your own obligations. No replacement loss.

So the same default produces a $3m loss or a $0 loss depending purely on which way the mark was pointing when the music stopped.

At default, swap MtM to youExposure = max(MtM, 0)Your replacement loss
+$3m (they owe you)$3mYou lose ~$3m (before recovery)
−$3m (you owe them)$0Nothing — you’d re-trade gladly
Tip:

The asymmetry is the whole game

Notice the brutal asymmetry baked into max(MtM,0)\max(\text{MtM},0): you take the loss when the trade is in your favor, and you take nothing when it’s against you. You get none of the windfall from a counterparty default on a position you owed, but all of the pain on one they owed you. That one-sidedness is why exposure is always non-negative and why we’ll spend the next lessons modeling the positive tail of future value, not the whole distribution.

Match each term to what it actually refers to.

Pick a term, then click its definition.

Why exposure “breathes”

Before you read — take a guess

A 10-year loan with $1m principal and a 10-year swap are both 'worth' something to you. As the years pass, which statement about how much you could lose to a default is true?

Analogy. A loan’s exposure is a filled bathtub — the water level (outstanding principal) is high and changes slowly and predictably as it drains over the schedule. A derivative’s exposure is the tide: it rises and falls, sometimes goes out to nothing, sometimes surges in, all driven by forces (rates, FX, spot) outside your control. You can’t ask “how exposed am I?” once and write the answer down — you’d have to ask again tomorrow and get a different number.

The definition. Because a derivative’s exposure is its MtM (floored at zero), and its MtM is a function of market risk factors — interest rates, FX rates, equity/commodity spot, credit spreads — the exposure changes continuously as those factors move. We say the exposure “breathes”: today’s asset can be tomorrow’s liability and next month’s asset again. A loan, by contrast, has exposure anchored to its outstanding principal, a number that’s large, scheduled, and barely surprises anyone.

Worked example. Return to the receive-fixed swap. Quarter by quarter, as the rate curve wanders, its MtM to you might read: +$2m, then −$0.5m, then +$1.2m, then +$4m, then −$3m. The exposure (the part that can hurt you in a default) is max(MtM,0)\max(\text{MtM},0) at each instant: $2m, $0, $1.2m, $4m, $0. The position passed through zero exposure twice and peaked at $4m — a number you could not have known at inception. This is precisely why you can’t summarize counterparty risk with one figure: you need a picture of exposure through time.

Tip:

This is the cliffhanger for the next lesson

“Exposure breathes” is the reason the next lesson exists. If exposure were a single fixed number, we’d be done. Because it’s a moving, random quantity, we have to describe its future distribution — how high it could plausibly climb, and what we expect it to average — before we can put a price on the risk. Hold the phrase “exposure through time”; it’s where we’re headed.

Fill in why a derivative's exposure is harder to pin down than a loan's.

Pick the right option for each blank, then check.

A loan's exposure is anchored to its , which is large and predictable. A derivative's exposure is its , which moves with rates, FX, and spot — so it over time, passing through zero and back. That's why you can't describe it with a single number.

The 2008 wake-up call

Before you read — take a guess

The Basel Committee, reviewing the 2007–09 crisis, found that the bulk of counterparty-credit-risk losses came not from counterparties actually defaulting, but from something else. What was the bigger source of loss?

Why this course exists. Counterparty risk used to be a sleepy back-office afterthought — something the credit department checked off with a line limit. Then 2008 happened, and it became a front-office, get-the-price-right discipline overnight. Three names tell the story:

  • AIG. Its financial-products unit had written enormous amounts of credit default swap (CDS) protection — promising to pay out if certain bonds defaulted — without holding the capital to back the promise. As the underlying mortgage assets soured, AIG owed collateral it couldn’t post. It didn’t even have to default to wreck balance sheets across the Street; it just had to become visibly unable to pay, triggering an $182bn government rescue.
  • Monoline insurers. Bond insurers like Ambac and MBIA had guaranteed structured credit. When their own ratings collapsed, every guarantee they’d written lost value — and everyone who’d relied on those guarantees took a mark-to-market hit, again without a single formal default on the day.
  • Lehman Brothers. The one that did default. Lehman was a counterparty on a vast web of derivatives; its September 2008 bankruptcy forced thousands of counterparties into the messy, lossy business of replacing trades at fire-sale prices — replacement risk, live, at scale.

The number that changed the rules. When the Basel Committee dissected the wreckage, it reached a finding that reframed the whole field: roughly two-thirds of counterparty-credit-risk losses came from CVA — the mark-to-market deterioration of counterparties’ own creditworthinessnot from actual defaults. CVA (Credit Valuation Adjustment) is, loosely, the price of the counterparty’s default risk embedded in a derivative’s value; when counterparties’ credit worsened, that adjustment swung against banks and bled them, even for names that never failed.

The regulatory response was decisive: CVA — and the broader family of valuation adjustments, XVA — became a mandatory part of pricing. You can no longer quote a swap at its “risk-free” value and ignore who’s on the other side. The cost of their possible default (and more) now goes into the price, on the trading desk, before the trade is even done. That migration — from back-office checkbox to front-office price — is the reason this course is “Counterparty Risk & XVA.”

Warning:

The pitfall 2008 exposed: 'no default, no loss'

The intuitive (and wrong) view is that counterparty risk only bites when someone actually defaults. The crisis proved otherwise: you can lose enormous sums from a counterparty merely getting riskier — its CDS spread blowing out, its rating cut — because that deterioration marks down the value of every trade you have with it. Most CCR losses in 2008 happened before (or without) formal default. That’s why we price the whole path of creditworthiness, not just the binary default event.

Sort each 2008 episode by what kind of counterparty risk it most directly illustrates.

Place each item in the right group.

  • A counterparty going insolvent and you re-trading the position at a loss
  • Banks watching CVA swing against them as counterparty spreads widened
  • Monoline insurers’ guarantees losing value when their own ratings were cut
  • Lehman’s bankruptcy forcing counterparties to replace trades at market
  • AIG becoming unable to post CDS collateral as its credit cratered

What you’d actually lose: a first look at exposure

Before you read — take a guess

Your portfolio with one counterparty is worth +$5m to you today. You're trying to gauge counterparty risk. Which figure should worry you MORE for the life of the trade?

Let’s consolidate what we’ve built into the vocabulary the rest of the course runs on. The thing you can lose to a counterparty’s default is its exposure, and we now know two facts about it: it’s floored at zero (max(MtM,0)\max(\text{MtM},0)), and it breathes through time. Put those together and the picture splits into “now” versus “later.”

Current exposure is the snapshot: max(MtM,0)\max(\text{MtM}, 0) right now. If your netted position with a counterparty marks at +$5m today, your current exposure is $5m; if it marks at −$5m, it’s $0. Simple, but nearly useless on its own — because defaults don’t politely happen today. They happen later, after the exposure has had months or years to wander.

Future exposure is the real worry: where could max(MtM,0)\max(\text{MtM},0) be when a default actually lands? Since the mark can grow, today’s $5m could be $12m in eighteen months — or $0. You can’t know the future mark, but you can describe its distribution and pull out two numbers that will headline the next lesson:

  • Expected Exposure (EE) — loosely, the average exposure you’d expect at a future date (averaging over all the ways the market could move).
  • Potential Future Exposure (PFE) — a worst-plausible-case exposure at a future date, e.g. a high percentile like the 95th. The “how bad could it reasonably get?” number.

We won’t fully define or compute EE and PFE here — that’s the next lesson’s job. The point to lock in now is the mindset shift: counterparty risk is forward-looking. The number that should keep you up isn’t what you’d lose if your counterparty vanished this instant — it’s what you might lose if they vanish at the worst possible future moment, after the tide has come all the way in.

Tip:

Where this is going

You now have the three load-bearing ideas of the whole course: (1) derivative counterparty risk is bilateral and time-varying, (2) the loss on default is replacement cost, floored at zero — max(MtM,0)\max(\text{MtM},0) — and (3) because exposure breathes, what matters is its future profile, summarized by EE and PFE. Everything ahead — measuring exposure, netting and collateral, then pricing it all as CVA/XVA — is built on these three planks.

Fill in the snapshot-vs-future distinction.

Pick the right option for each blank, then check.

Current exposure is , a snapshot. But because exposure , the real danger is future exposure — where the mark could go before a default lands. The average future exposure is summarized by , and a worst-plausible-case future exposure by .

Putting it together

A loan carries one-way credit risk — only the borrower can owe the lender. A derivative is different in kind: its mark-to-market can be positive (they owe you) or negative (you owe them), and it flips sign as markets move, so counterparty risk is bilateral — each side, at different times, is the one exposed. Counterparty risk splits into settlement (Herstatt) risk — failure during the payment exchange itself, largely solved by PvP/CLS — and replacement risk, the mid-life default that forces you to re-trade at market, which is this course’s subject. The loss on default is exposure =max(MtM,0)= \max(\text{MtM},0): you lose only what they owe you, never what you owe them. Because the mark moves with rates, FX, and spot, exposure breathes — today’s $2m asset is tomorrow’s $2m liability — so it can’t be summarized by a single number. 2008 dragged all of this from the back office to the trading desk: AIG, the monolines, and Lehman showed that counterparties can inflict catastrophic losses, and Basel found roughly two-thirds of crisis CCR losses came from CVA — credit deterioration — not actual defaults, which is why CVA/XVA pricing became mandatory. And because defaults strike later, the figure that matters is future exposure, summarized by EE and PFE — the door into the next lesson.

Big picture

What is counterparty risk?

  • Counterparty Risk
    • Loan vs. derivative
      • Loan: one-way — only borrower can owe
      • Derivative: bilateral — both sides exposed
      • MtM can be +ve (they owe you) or −ve (you owe them)
      • Receive-fixed swap: +$2m today → −$2m later
    • Two flavors
      • Settlement (Herstatt 1974): fails mid-payment
      • PvP / CLS largely solved settlement risk
      • Replacement: mid-life default → re-trade at market
      • Replacement risk = this course
    • Exposure = max(MtM, 0)
      • You lose only what they owe you
      • Owe them? Their default costs you no replacement loss
      • Always non-negative (floored at zero)
    • Exposure breathes
      • Mark moves with rates, FX, spot
      • Passes through zero and back
      • Loan exposure ≈ fixed principal; derivative wanders
      • Needs a profile through time, not one number
    • 2008 → CVA/XVA
      • AIG: wrote CDS it couldn’t back
      • Monolines: guarantees rotted with their ratings
      • Lehman: actual default, mass replacement
      • Basel: ~2/3 of CCR losses from CVA, not default
      • CVA/XVA became mandatory front-office pricing
    • First look at exposure
      • Current exposure: max(MtM, 0) right now (snapshot)
      • Future exposure: where it could go before default
      • EE = expected/average future exposure
      • PFE = worst-plausible-case future exposure
A derivative is a two-way, time-varying credit relationship a loan never is. Loss on default = max(MtM, 0) — replacement risk. Exposure breathes, so the future profile (EE, PFE) is what matters. 2008 made CVA/XVA mandatory front-office pricing.

Recap: what is counterparty risk?

Question 1 of 50 correct

Why is counterparty credit risk on a swap bilateral, while on a loan it is one-way?

Check your answer to continue.

Next — measuring exposure — we stop hand-waving about exposure that “breathes” and actually pin it down through time: simulating where the mark could go, then reading off Expected Exposure and Potential Future Exposure as the profile that everything else in the course is priced from.

Mark lesson as complete