Counterparty Risk, XVA and Clearing
Every derivative is also a loan to whoever owes you. What is that loan worth, and who should stand in the middle?
After 2008 the price of a derivative acquired adjustments: for the counterparty's default (CVA), for one's own (DVA), for funding, capital and margin. The part computes them from the ground up. A swap's value is simulated forward, its positive part is the exposure, collateral removes all but what can happen during the days it takes to close out a defaulter, and what remains is priced against the counterparty's default curve. Wrong-way risk is exposure that grows as the counterparty weakens. Initial margin and central clearing move the risk rather than remove it: the nickel market in March 2022 and Archegos in March 2021 show where it went.
What you need. Parts 19 and 20.
What you will be able to do
Undergraduate
- Explain counterparty exposure, collateral and what a central counterparty does.
Master's
- Compute expected and potential future exposure by simulation, with and without collateral and a margin period of risk.
- Compute CVA and DVA from an exposure profile and a hazard curve; describe FVA, KVA, MVA and initial-margin models.
PhD
- Bound wrong-way risk over all dependence structures by optimal transport; compute XVA sensitivities by adjoint differentiation and regress future values with a network.
Industry
- Explain margin procyclicality, a clearing house's default waterfall, and what the Archegos and nickel episodes revealed.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 11 min · Master's 46 min · PhD 55 min · Industry 22 min.
- 0The other side of every tradeUndergraduate3 min
- 1ExposureMaster's4 min
- 2Collateral and the margin period of riskMaster's3 min
- 3CVA and DVAMaster's4 min
- 4Wrong-way riskMaster's3 min
- 5FVA, KVA and MVAMaster's3 min
- 6Sensitivities by AADPhD2 min
- 7A network that learns future valuesPhD2 min
- 8Initial marginMaster's3 min
- 9Margin procyclicalityMaster's3 min
- 10Central clearingUndergraduate3 min
- 11March 2022: the LME's nickel marketIndustry3 min
- 12Capital for counterparty riskIndustry3 min
- 13March 2021: ArchegosIndustry3 min
- 14Rule 21: the XVA deskIndustry3 min
- For the researcher: bounding wrong-way riskPhD5 min
- Recap, desk questions, problemsAll tracks5 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Reading · 中文 · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
The other side of every tradeUndergraduate3 min
Counterparty risk, valuation adjustments and clearing. Every derivative is a promise between two parties, and either of them can fail before it is kept.
In March 2021, a family office in New York, Archegos Capital Management, failed to meet its margin calls. It held enormous positions in a handful of stocks, not directly but through total return swaps with several banks, and each bank saw only its own slice. When the stocks fell, the banks raced to sell the collateral. Those that sold first lost less; Credit Suisse lost about five and a half billion dollars, and Nomura almost three. Every one of those losses was counterparty risk: the chance that the other side of a derivative cannot pay what it owes.
How we got here. In 1987 dealers agreed a master contract for swaps, with netting on default. In 1998 the rescue of Long-Term Capital Management was a rescue of its counterparties. By the mid-2000s the big dealers were charging a credit valuation adjustment on their trades; then Lehman left thousands of swaps to be closed out. The Basel Committee found that most counterparty losses in the crisis came not from defaults but from the falling value of CVA, and charged capital for it. Burgard and Kjaer added funding in 2011, Hull and White argued in 2012 it does not belong in prices, and in 2013 the banks booked it anyway. Then the standardised approach to counterparty exposure, the capital adjustment, mandatory margin from 2016, and three episodes: March 2020, Archegos, and the London Metal Exchange's nickel market in 2022.
The plan: exposure, simulated and netted; the credit adjustment and its mirror; when default and exposure move together; the costs of funding, capital and margin; sensitivities by a single backward pass, and a network that learns what the book will be worth; initial margin, clearing houses and their waterfalls; capital; and two episodes from the public record. Along the way: why netting is a matter of law, how a CVA desk hedges, why a new trade's price depends on everything else the client has done with you, when a clearing house makes the system safer and when it does not, and how much margin a concentrated position really needs. Every number is computed by the House's code, and every case comes from the public record.
Before computing, fix the experiment. We use the public curve dated December 2025, with historical rate-volatility proxies rather than calibration to traded option prices. The swap engine resets the current floating period at each valuation date, ignoring past fixings. It is a controlled exposure sketch, not a production mark. Default curves and all policy parameters are illustrative. The CVA calculations multiply expected exposure by deterministic discount factors. A general stochastic-rate valuation needs the joint discounted exposure, default and closeout. Funding, capital and margin costs require a consistent policy; adding labels mechanically can double-count the same economic cost.
In the House, the credit desk becomes an XVA desk: every trade the House does is also a loan to whoever is on the other side, and is priced as one.
1ExposureMaster's4 min
Exposure: what the other side of a trade could owe you, and when. A swap is worth zero to both sides when it is struck. Then rates move, and it becomes an asset to one and a liability to the other. If the counterparty defaults when the swap is worth something to you, you lose it; if it is worth something to them, you still owe it. So the exposure is the positive part of the value, and its average over the paths rates might take is the expected exposure. Banks also set credit limits against a high percentile of it, the potential future exposure.
Here is one swap: the bank pays a fixed rate for ten years on a hundred million dollars. Fifty of twenty thousand paths of its value, simulated with the Hull and White model of Part nineteen. The fan widens at first, as rates have time to move. Then it narrows, because each year one payment fewer remains to be affected. Diffusion pushes the exposure up, amortisation pulls it down, and the profile between them has a hump.
Averaged over the paths: the expected exposure peaks at about million dollars, years in, and the expected negative exposure mirrors it. The ninety-fifth percentile reaches million: that is the number the bank's credit officers set a limit against, for a trade that was worth nothing on the day it was done.
These curves illustrate shapes under different simplified constructions. The swap uses the reset approximation. The FX proxy is the positive mean of a zero-drift normal terminal-value model, so it grows with square-root time. The rising mixed curve is a weighted sum of swap and FX expected-exposure profiles. It is not the expected positive value of a jointly simulated cross-currency swap: dependence and cash-flow terms are absent. The flat option curve is an invented positive-value proxy. A fully paid long option has nonnegative clean value, but actual exposure depends on valuation, settlement, collateral and remaining cash flows. Product labels alone do not determine a universal exposure curve.
Banks rarely face a counterparty with one trade. Under a master agreement, all the trades with one counterparty are closed out together on default, and only the net amount is owed. Add a five-year swap the other way and a short one the same way, and compare: summed one by one, the exposures are the red curve; netted, the blue. Netting cuts the average exposure by percent here, and in a dealer's book of thousands of offsetting trades, by far more. It is the single most important tool in counterparty risk.
Netting is not arithmetic; it is law. When a counterparty fails, its liquidator would like to collect on every trade it is winning and leave the bank to queue as an unsecured creditor on the rest. Close-out netting forbids that: all trades under one master agreement are terminated together and added into a single amount. The industry's master agreements, from 1987 onwards, make every trade part of one contract for exactly this reason. And netting is only worth what a court will enforce, so dealers collect legal opinions country by country, and count a netting set only where it is known to hold. In the United States, swaps are also exempt from the freeze on creditors that bankruptcy normally imposes, an exemption widened in 2005, and debated ever since Lehman.
Regulators take the same profile and make it conservative. The effective expected exposure is never allowed to fall, on the assumption that trades which mature are replaced. Its average over the first year, times a multiplier alpha of one point four, is the exposure at default for banks allowed to use their own models; the alpha covers wrong-way risk and model error.
A bank has two swaps with one counterparty that exactly offset. What is its exposure with netting, and without?
2Collateral and the margin period of riskMaster's3 min
Collateral: and why even a fully collateralised trade still has exposure. Most derivatives between banks are collateralised. Under a credit support annex, whichever side the trade is against posts margin every day, above an agreed threshold. But collateral lags. When a counterparty defaults, the last margin it paid was some days before, and closing out its trades takes days more: the margin period of risk, typically ten business days. The exposure that remains is how far the value moved in that gap.
The netting set again, three ways. With no collateral, the expected exposure of chapter one, averaging million. With a two-million threshold, it falls to : the counterparty only posts beyond that. With no threshold, to . What is left is the movement during the margin period, and it never goes to zero.
On a daily grid, with margin called every day and a ten-day margin period of risk. Uncollateralised, exposure grows with the square root of time. Collateralised, it stays at the size of ten days' moves. In the first year here it is of the uncollateralised exposure, and falling further relative to it as time passes. But the ten days are an assumption: in a crisis, volatility jumps and close-outs take longer, just when counterparties fail.
Why not call margin on every cent? Because every call is a payment, a reconciliation, and a possible dispute. With no minimum transfer, the netting set triggers a call on almost every business day, a year. A minimum transfer of a quarter of a million halves that; two million brings it to , for percent more expected exposure. Collateral terms are a trade between credit risk and operations.
Collateral need not be cash. Many agreements accept government bonds, counted after a haircut sized to how far the bond itself can fall during the margin period. Here the haircut matters for a reason beyond volatility. This netting set pays fixed, so its value rises with interest rates; and when rates rise, Treasuries fall. Posted in ten-year Treasuries with no haircut, the collateral weakens exactly as the exposure grows, and expected exposure is percent higher than with cash. The supervisory four percent haircut more than covers it, percent below cash. Collateral correlated with the exposure is a mild form of the wrong-way risk of chapter four; collateral correlated with the counterparty, like Archegos's shares, is the severe one.
Who holds the collateral matters as much as how much there is. Variation margin usually changes hands outright, and the receiver may use it again, to fund itself or to post to someone else. That makes collateral a source of funding, and a danger: if the receiver fails, the poster's collateral is gone and its claim is unsecured. Hedge funds whose assets Lehman's London broker-dealer had re-used waited years to recover them. So the rules after 2008 put initial margin with a third-party custodian, segregated, out of reach of either side's creditors: protection that works only because it cannot be lent out.
A counterparty posts cash daily with a zero threshold. Name two ways you can still lose money when it defaults.
3CVA and DVAMaster's4 min
The credit valuation adjustment, and its mirror image. Under a specified clean closeout, bilateral value subtracts loss when the counterparty defaults first and adds the own-default adjustment. Here start with unilateral CVA: loss given default, times discounted expected positive exposure, integrated against minus the survival decrement. The sign matters. We use a pricing-measure exposure model, independent default and deterministic discounting. With stochastic rates, discount and exposure belong inside one joint expectation. On a monthly grid the integral becomes a bucket approximation, with a positive survival decrement. DVA is the mirror for negative exposure. Bilateral versions also require survival of the other party and a consistent closeout convention.
Use the illustrative CDS quotes and the same three-swap netting set. The left curve is expected positive exposure; the bars are monthly deterministic-discount CVA contributions under independent default. The sum is thousand dollars. The running-spread conversion is basis points on a one-hundred-million reference notional, not on the book's two-hundred-million gross notional. The conversion is a quoting convention; it does not change the dollar loss estimate.
In this bucket approximation, each default counts only while the other party survives. Bilateral CVA is thousand, and DVA . Widening the bank's own spreads raises this DVA. Dealers reported own-credit gains in the financial crisis, but accounting recognition does not turn them into spendable income. Realization, hedging and prudential treatment depend on the instrument and rules; it is misleading to treat a deterioration in the bank's credit as operating profit.
Once CVA is on the books, it is a position, and positions are hedged. Double the counterparty's spreads and the CVA goes from to thousand; quadruple them and it reaches . It is short the counterparty's credit, and curves over because a likelier default comes sooner, before the exposure has grown. One basis point on the counterparty's curve moves the CVA by about dollars, so the desk buys about million of five-year protection on that name. The exposure itself moves with interest rates, and that part is hedged with swaps. The CVA desk is a trading desk, with the bank's own counterparties as its underlyings.
Because exposure belongs to the netting set, so does the price. A new trade is charged the change it makes to the set's CVA. A new five-year receiver swap, which partly offsets the book's ten-year payer, would carry thousand of CVA on its own; added to this book it reduces the CVA by thousand, so the desk can pay the client to do it. A new payer swap would cost thousand alone and adds . Two clients asking for the same swap can get different prices, and both can be right.
Distinguish simulation error from a model sensitivity exercise. Across twenty fixed-law independent runs, the standard deviation is thousand at two hundred fifty paths and at sixteen thousand. The inverse-square-root rule is an asymptotic sampling principle, not a guarantee for every realized run. Vary mean reversion and rescale volatility to the same historical ten-year-yield proxy. This example's CVA ranges from to thousand. That narrow range does not validate the model: option-price calibration, multiple factors, past fixings, discount-exposure dependence and closeout assumptions remain outside this test.
CVA is not only a price; it is a position that moves. As counterparties' spreads widened in 2007 and 2008, the adjustments on trades with them grew, and those changes were marked as losses. The Basel Committee found that about two thirds of banks' counterparty losses in the crisis came that way, from counterparties that had not defaulted, and only a third from those that did. So Basel the Third charged capital for the volatility of CVA itself.
A bank's DVA rises as its own credit gets worse. Is that profit real? Who would pay it, and when?
4Wrong-way riskMaster's3 min
Wrong-way risk: when the counterparty fails exactly when it owes you most. The formula so far assumed that a counterparty's default has nothing to do with how much it owes. The correct formula uses the exposure on the paths where it defaults. Tie the two together with a copula, Part twenty's tool: a correlation between the counterparty's default time and the rate that drives the trade's value.
Hold the exposure simulation and this flat exponential default law fixed while varying dependence. This flat hazard is the mean of bootstrapped hazards; it is not the piecewise CDS survival curve. At zero correlation this Monte Carlo estimate is thousand. At correlation point nine it is , or times as much. Right-way dependence reduces it. These changes illustrate dependence risk within one chosen model; they do not estimate an issuer's dependence from data.
A copula is one way to tie default to exposure. John Hull and Alan White proposed a more direct one. On every path, let the counterparty's hazard rate depend on the value the bank is owed: up by a factor e to the b for each million. Then shift the hazard's level date by date so that, averaged over the paths, survival still matches the counterparty's credit swaps. The market's probability of default is kept; only where the defaults land is changed. With b of point one, the CVA rises from to thousand. The model has one parameter with a meaning a desk can argue about: how much worse does this client's credit get for each million it owes us?
Basel's internal-model exposure framework multiplies effective expected positive exposure by alpha. The standard value is one point four; approved own estimates have a floor under the applicable rules. It reflects several risks, including imperfect dependence and concentration modelling. Our copula example shows why dependence matters, but its CVA ratio neither derives nor calibrates alpha. A valuation loss and a regulatory exposure measure are different objects.
Where does it happen? General wrong-way risk: a counterparty whose credit falls with the same market move that raises your exposure, like an oil producer that sold you oil forward. Specific: protection bought from a seller whose fate is tied to what it insures, as banks learned with the bond insurers that had sold them protection on mortgage securities. And collateral that is the counterparty's own risk, the story of Archegos at the end of this part.
You buy protection on one bank from another bank in the same country. What kind of risk is that, and how would you price it?
5FVA, KVA and MVAMaster's3 min
Funding, capital and margin: the other valuation adjustments. Where does funding come in? A bank trades with a client who posts no collateral, and hedges the trade with another dealer, under a collateral agreement. When the client's trade moves in the bank's favour, the hedge moves against it, and the bank must post cash to the dealer, cash it borrows at its own unsecured spread, while the client owes it the same amount without posting a cent. The cost of carrying that, over the trade's life, is the funding valuation adjustment: the spread times the expected exposure, discounted. When the trade moves the other way the bank receives collateral it can lend, a benefit.
Should funding be in the price at all? Christoph Burgard and Mats Kjaer derived it in 2011 from the cost of replicating the trade with the bank's own funding. John Hull and Alan White replied in 2012 that it does not belong there: in a well-functioning market, the value of a project cannot depend on who finances it, and funding adjustments largely double count the bank's own default. In January 2014 J.P. Morgan took a one point five billion dollar charge to adopt FVA, and most large dealers had done the same. The market priced it before the theory agreed.
A third cost is capital. Regulators require the bank to hold capital against the trade for as long as it lives, and capital is the shareholders' money, on which they expect a return. The capital valuation adjustment, KVA, is that return, charged on the whole profile of capital the trade will need, and discounted. Andrew Green, Chris Kenyon and Chris Dennis gave it its name in 2014. On this netting set, with capital that follows its potential exposure and a ten percent hurdle, KVA comes to about thousand dollars: the area under the capital curve, times the hurdle rate.
Compare costs under this illustrative policy. Bilateral CVA less DVA, then funding cost and funding benefit, which happen to nearly offset in this book with symmetric spreads. Equal spreads alone do not guarantee cancellation: the discounted signed exposure must also balance. KVA uses a stand-in capital profile; MVA funds an assumed margin profile. The arithmetic sum is million. It is not a universal fair-value identity. A coherent production policy must specify closeout, collateral, funding and capital, and prevent counting the same default or funding cost twice.
The cancellation depends on symmetry. If the bank borrows and lends at the same eighty basis points, the funding cost of thousand is nearly paid back by the benefit, and FVA is thousand. But a treasury seldom pays its desks for spare cash what it charges them for borrowing. Pay twenty basis points on the benefit side and FVA becomes thousand; a bank whose borrowing spread is a hundred and fifty pays . A strong bank at thirty both ways pays . Cheap funding wins the uncollateralised business, and an expensive funder is left with the collateralised trades, which need no funding. Whether that is how it should be is the question to end the chapter.
Two banks quote the same uncollateralised swap; one funds at twenty basis points over SOFR, the other at a hundred and fifty. Who wins the trade, and should they?
6Sensitivities by AADPhD2 min
Every sensitivity of CVA, from one backward pass. An XVA desk hedges its CVA, and for that it needs the sensitivity to every input: each point of the yield curve, each point of each counterparty's credit curve. By bumping, that is one full simulation per input, and a real book has thousands of them. Part sixteen's adjoint method gives them all at once: run the valuation forwards, then the chain rule backwards, and every derivative comes out for a few times the cost of one valuation.
How does one backward pass give every derivative? Take a single bucket of the CVA sum. Going forward, each step is computed and written down: the survival from the hazard rate, the default probability, and the CVA from that and the expected exposure. Now go backwards. Start with the derivative of the CVA with respect to itself, one. Each node passes back its own adjoint times its local derivative: the default probability's adjoint is ; the survival's is minus that; and the hazard rate's is that times minus t times the survival, . The exposure gets its adjoint in the same sweep. Each node is visited once forwards and once backwards, however many inputs feed it. That is why the cost does not grow with the number of sensitivities, and why the memory does: every intermediate value of the forward pass must be kept for the way back.
The netting set's CVA, written in torch, with its derivative with respect to every zero-rate node and every hazard rate. Each derivative from the backward pass, beside the same derivative by bumping that input by a basis point. They agree. The backward pass took seconds; the bumps, , for only inputs. For a bank's book, with thousands, that difference decides whether risk is known overnight or not at all.
The end of the House's implementation: expected exposure from the simulated values, survival from the hazards, the CVA as a sum, and one call to backward. Everything above that line is ordinary pricing code; the derivatives come with it.
Exposure takes the positive part of the value, and some payoffs jump. What does a backward pass get wrong at a kink or a jump, and how would you fix it?
7A network that learns future valuesPhD2 min
A network that learns what a book will be worth, from its cash flows alone.
Chapters one to six used a pricing formula for the swaps on every path. Real books hold trades with no formula. But the value on a future date is always a conditional expectation: of the discounted cash flows still to come, given the state of the world then. So simulate the cash flows, and regress them on the state with a network, one network over date and state together. It is the regression of Part sixteen with a network in place of polynomials, and the starting point of the deep solvers that Alessandro Gnoatto and coauthors built for the valuation adjustments themselves.
The network sees only the date, the state of the rate model, and what each path's swaps actually paid afterwards. Its error falls, and then levels off well above zero: each target is one noisy outcome, and the best the network can do is learn their average given the state, which is exactly the value we want.
On independent simulated test paths, compare the learned exposure with the analytic reference under the same floating-reset approximation. The reference changes at payment dates; a smooth network rounds those changes. Its CVA is thousand versus for the reference, a signed difference of percent. A small CVA error can conceal larger pointwise errors. This fixed experiment assesses approximation under its invented model; it does not establish production pricing accuracy or real-world capital adequacy.
Compare methods on the same training paths and independent test paths. Date-specific cubic regression has lower value RMSE in this one-factor experiment; its CVA error is percent. This is a measured comparison under the reset approximation. A full cubic in fifty factors has twenty-three thousand four hundred twenty-six coefficients per date. That can be expensive and underdetermined with too few training paths, but it is not mathematically impossible. Sparse bases, dimension reduction and neural networks are alternatives. Network input size, training cost and approximation error also depend on dimension and structure.
A network prices a book's future values fifty times faster than the model it learned from. When is it safe to use it for capital?
8Initial marginMaster's3 min
Initial margin: collateral posted in advance, against the gap. Variation margin covers yesterday's move. Initial margin is posted in advance, by both sides, to cover the move during the margin period of risk, at about the ninety-ninth percentile, and it is held by a third party, so it cannot be re-used. After 2008, regulators required it between large firms for derivatives that are not centrally cleared, phased in from 2016 to 2022. To agree on the number, the industry wrote a common model, ISDA's SIMM: sensitivities by risk factor, times risk weights, combined with correlations so that offsetting positions net.
A normal delta approximation motivates the quadratic form. Linearize value in rate sensitivities. Under joint normal moves, variance is a covariance quadratic form. For a zero-mean one-sided ninety-nine percent normal quantile, multiply standard deviation by about two point three three. That explains our illustrative risk-weighted aggregation. Full ISDA SIMM is a prescribed methodology with risk classes, buckets, concentration, vega and curvature, not simply this normal formula. Our fixed weights and neglected floating-leg risk are not the current regulatory calibration.
For the netting set: its rate sensitivity tenor by tenor, in thousands of dollars a basis point. The ten-year payer dominates, partly offset by the five-year receiver. Weighted and combined, the initial margin is about million dollars, posted by each side, on two hundred million of swaps.
Firms need not use a model at all. The regulators' fallback is a schedule: a fixed percentage of notional, by asset class and maturity, with netting allowed only through one ratio of net to gross replacement cost. For our three swaps: four percent of the ten-year's notional, two percent of the others', million dollars before any netting credit. The sensitivity-based model, which sees that the five-year receiver offsets part of the ten-year payer, asks for . The schedule is simple and blunt, and so expensive for hedged books that almost every large dealer adopted the industry model instead.
The margin must be funded for as long as the trades live. As the swaps run off, the required margin falls, step by step. The cost of funding this whole profile is the margin valuation adjustment of chapter five; for large dealers, posting margin became one of the biggest uses of cash on the balance sheet.
Is initial margin worth what it costs? Take the netting set with daily variation margin, over its first three years. With no initial margin, the credit adjustment left is about thousand dollars: the gap risk. Margin at the ninety-ninth percentile cuts it to thousand, but funding that margin costs . At ninety-nine point nine, thousand of funding removes the last fraction. For one bank, initial margin is an expensive way to buy protection. Regulators required it anyway, because it is not meant for the bank: it is there so that when a large dealer fails, its losses stay with it instead of spreading to everyone it traded with.
Initial margin is set at the ninety-ninth percentile of ten days' moves. What happens to it, and to everyone posting it, the day volatility doubles?
9Margin procyclicalityMaster's3 min
Procyclicality: why margin calls arrive exactly when cash is scarcest. Margin models scale with volatility. Here are two simple ones, computed from the daily moves of the ten-year Treasury yield since 2017: one uses the worst one percent of the last year's moves, the other an exponentially weighted volatility that reacts within days. In March 2020 the responsive model's margin rose from to dollars per hundred of notes in a few weeks. The slower model rose less, and then stayed high for a year after the danger had passed. Every holder of a margined position was asked for more cash at the same moment, and the fastest way to raise cash was to sell.
That is a loop. Volatility rises, so margin models ask for more; holders sell to raise the cash, prices fall further, and volatility rises again. It drove the gilt crisis of Part eighteen as well. The remedies trade efficiency in calm times for stability in storms: margin floors and buffers built up when markets are quiet, and look-back windows long enough to remember the last crisis.
Europe's clearing rules make the remedies concrete. A clearing house must use one of a few anti-procyclicality tools. The responsive model alone jumped times in March 2020. A buffer of twenty-five percent, collected in calm times and released in a stress, makes the jump times. A floor at the level of a ten-year look-back makes it times. The price is paid every quiet day: before the crisis, the floored margin was dollars against , about percent more. Stability is bought with collateral that sits idle in good times.
This is a historical diagnostic of absolute ten-day yield moves, with a two-sided normal threshold of two point five seven six standard deviations, rather than the earlier one-sided margin rule. There are exceptions in overlapping windows, percent. The reported iid Kupiec reference p-value is . Overlap creates dependence even under independent daily moves, so that p-value cannot certify coverage. Year-level rates reveal concentration of exceptions; formal testing needs a method accounting for overlap and model estimation. This is not a full margin-system backtest.
A margin model with a ten-year look-back barely moved in March 2020. Why might a regulator still dislike it?
10Central clearingUndergraduate3 min
Central clearing, and the waterfall that absorbs a member's default. After 2008, the G20 required standard derivatives to be cleared. Bilaterally, five dealers have ten relationships, each with its own exposure. With a clearing house, every trade is replaced by two, one with the clearing house on each side, and each dealer has one exposure, netted across all its trades with everyone. The clearing house has none, as long as everyone pays. The question is what happens when someone does not.
Does clearing always reduce risk? Darrell Duffie and Haoxiang Zhu showed that it need not. Take a dealer trading with every other dealer in several independent asset classes. Netting with each counterparty across all classes, its exposure to each grows like the square root of the number of classes. Now clear one class. That class nets across every dealer at the clearing house, but it is pulled out of every bilateral netting set, and those lose some of their netting. With two classes, clearing one helps as soon as there are a handful of dealers; with eight, it takes or more. Below that, a new clearing house makes the system's exposure larger. The lesson is to clear many products in a few clearing houses, not one product in many.
A typical waterfall allocates a defaulting member's losses through specified resources. Use its margin and fund contribution, then specified CCP capital, mutualized resources and further tools according to the rulebook. Resources, sequencing and liquidity arrangements vary. The PFMI applies a Cover Two stress standard to CCPs with more complex risk profiles or systemic importance across jurisdictions, with other minimum standards elsewhere. The relevant largest aggregate exposures need not be the two largest members by notional. Our toy deliberately sizes one fund from two members under a chosen stress; it is not a compliance calculation.
This is a fixed invented clearing-house law, with twenty unequal members and defaults coupled through a normal stress factor. Its conditional waterfall frequencies depend on the chosen member probabilities, loss severity and fund sizing. Under those assumptions survivors' resources are reached in about one in scenarios with a default. That is a toy conditional frequency, not an estimate of any CCP's annual default risk or proof that Cover Two is sufficient. Stress design, liquidity, concentration and recovery rules still matter.
Two real defaults show the waterfall at its best and at its most exposed. When Lehman failed in September 2008, it had more than sixty-six thousand interest-rate swaps at LCH's SwapClear service, nine trillion dollars of notional. LCH hedged the book and auctioned it to the other members within weeks, and used about a third of Lehman's own initial margin. No one else paid. Ten years later, a single Norwegian power trader, Einar Aas, a clearing member in his own right, held a large bet that Nordic and German electricity prices would converge. They moved apart. His collateral was gone, then Nasdaq's own seven million euros, and then about a hundred and seven million euros of the other members' default fund of a hundred and sixty-six: about two thirds of it, for one person's position. The members refilled the fund within a week, and asked why their money stood behind a concentrated bet that the margin model had not seen: the question of chapter thirteen, in a different market.
A clearing house lowers its margins to win business from a rival. Who bears the risk it no longer collects?
11March 2022: the LME's nickel marketIndustry3 min
Nickel, month by month, from the IMF's commodity prices. March 2022 looks like a spike. Inside that month were two days that a monthly average cannot show. After Russia invaded Ukraine, nickel rose on the seventh of March, and early on the eighth it passed one hundred thousand dollars a tonne, more than three times its level a week before.
Put numbers on it. Nickel closed at about twenty-nine thousand dollars a tonne on Friday the fourth of March, about forty-eight thousand on Monday the seventh, and early on the eighth it traded above a hundred and one thousand. On a short of a hundred thousand tonnes, a size chosen only for the arithmetic, the variation margin called for Monday is billion dollars, and the next morning's move adds billion more. In cash, the same day. Initial margin, set for ordinary moves, covers a small fraction of that. The question was no longer whether the short side was solvent, but whether its brokers could find the cash before the clearing house had to declare them in default.
A Chinese nickel producer held a very large short position, partly through banks' over-the-counter contracts that were themselves hedged on the exchange. As the price ran away, margin calls on the short side ran into billions, and some of the exchange's members could not meet their own. On the eighth of March the London Metal Exchange halted trading and cancelled every nickel trade done that day, to stop defaults cascading through its clearing house. Traders who had been on the right side sued; in 2023 the High Court found that the exchange had acted within its powers. Margin that cannot be paid in time is not a buffer; it is the beginning of a default.
What followed. When trading resumed on the sixteenth of March, the exchange imposed daily price limits, and the market hit them again and again in its first sessions. In November 2023 the High Court dismissed the challenge brought by Elliott and Jane Street: cancelling about three point nine billion dollars of trades had been within the exchange's powers. And in March 2025 the Financial Conduct Authority fined the exchange nine point two million pounds, the first such penalty on a recognised exchange, for controls that had not kept the market orderly in those five days. Legal and wise are different questions.
Why might a clearing house prefer to cancel trades rather than let its waterfall work?
12Capital for counterparty riskIndustry3 min
Regulators require capital against counterparty exposure, measured by a standard formula, SA-CCR. Exposure at default is what the trades would cost to replace today, plus an add-on for what they might become, times one point four. For interest-rate swaps, the add-on is half a percent of an effective notional: each trade's notional times a supervisory duration, signed long or short, grouped by maturity, with partial netting between the groups, and a smaller factor for margined trades.
The netting set's three swaps. Each alone has an exposure at default; summed, million. As one netting set, with offsetting directions, ; margined, . The formula rewards exactly what the lessons of 2008 recommended: netting, collateral, and clearing.
One more piece of the formula rewards collateral beyond what is owed. The add-on is multiplied by a factor that falls when the netting set is out of the money, or when the bank holds more collateral than the trades are worth. One add-on out of the money, and the multiplier is about point six; three, and about a quarter. It never goes below five percent: however much collateral there is, some charge remains, because the market can always move further than the collateral covers.
The charge for CVA's own volatility has a formula too, Basel's basic approach since 2020. Each counterparty's stand-alone charge scales with its exposure at default, its maturity, and a risk weight set by its sector and rating. Then they are combined as if every spread had one common factor, with correlation one half. For our netting set alone, with a five percent risk weight, the charge is about thousand dollars of capital. Spread the same exposure over a hundred counterparties, and the charge per name falls only to about half: the part of credit spreads that moves together cannot be diversified away, which is exactly what happened in 2008.
Default exposure and CVA spread risk attract distinct prudential charges under applicable rules. The leverage ratio adds a broadly risk-insensitive exposure measure, with detailed treatment of derivatives and securities financing. Basel minimums, implementation dates and extra buffers differ by jurisdiction and institution. These constraints can make dealer balance sheet costly and contribute to pricing wedges alongside funding, liquidity, hedging and demand. They do not by themselves identify the cause of a particular negative swap spread or cross-currency basis. The examples teach mechanisms, not a live capital requirement.
Under a leverage ratio, a dealer holds a riskless Treasury position financed in repo. Why does it still cost money?
13March 2021: ArchegosIndustry3 min
March 2021: how a client's margin became the banks' losses. Archegos held its positions through total return swaps. The bank buys the shares as its hedge and pays the client their return; the client pays interest and posts margin. The client has the economics; the bank holds the shares, so no public filing showed how much of each company Archegos controlled. To the bank, the swap is a loan secured by the shares. If they fall by more than the margin and the client cannot pay, the bank sells, and keeps the difference as a loss.
In March 2021 one of the largest positions, ViacomCBS, announced a share offering, and its shares fell. With margin sized for an ordinary fall, a decline of a third or more wiped it out. Archegos could not meet the calls. On the twenty-sixth of March the banks began to sell, each its own hedge, and each sale pushed the prices down for the others. Those who sold first recovered most of their money; those who hesitated sold into a collapse. The collateral was the risk: wrong-way risk in its purest form.
Liquidation time depends on position size and market participation. At an assumed twenty-percent participation rate, five days of normal volume take twenty-five days to sell if volume stays available. This fixed toy combines a normal volatility term with an assumed square-root impact term, and caps the plotted fraction at one hundred percent. It is not a calibrated margin rule or a safety guarantee. Here twenty percent is crossed near days of volume. The Credit Suisse board report described much larger concentrations and lengthy liquidation estimates. Those reported facts motivate concentration controls; the toy number does not establish the margin that would have prevented the loss.
Why did the banks race? A stylised version. Two banks each hold a hundred million dollars of the same shares as hedges, against twenty million of margin each. The news knocks thirty percent off the price. Now every block sold pushes the price down further. The bank that sells first sells on the way down from seventy cents, at an average of , and loses million beyond the margin. The bank that sells second sells into the first one's selling, at , and loses . Each would be better off going first whatever the other does, so both try to, and the price falls faster for everyone. It is a bank run, run by banks. That is roughly what happened on the twenty-sixth of March: the banks that sold large blocks that day lost little, and those that hesitated lost billions.
What went wrong is in the public record. Margin was set as if the positions were diversified, when they were a few stocks held in enormous size, and selling them moved the price. Each bank saw only its own swaps; no one measured the whole client. The report commissioned by Credit Suisse's board found repeated breaches of its limits that the bank did not act on; in 2024 a jury convicted Archegos's founder of fraud.
A client posts twenty percent margin on a single-stock swap. What one number about the client would you most want to know, and why can't you see it?
14Rule 21: the XVA deskIndustry3 min
The House's twenty-first rule, for its XVA desk. One illustrative House ticket, under an explicit internal charging policy. Use bilateral CVA for the netting set, report DVA separately, and do not let the own-credit gain reduce this internal charge. Add the assumed funding, capital and initial-margin costs. These conventions are a teaching policy, not an accounting mandate or a complete replication model. The resulting internal charge is thousand on two hundred million of swaps. A real quote needs incremental netting-set effects, an agreed cost policy and checks against overlap or double counting.
Behind the ticket is a process that runs every night. Simulate the markets, on thousands of paths and dates. Value every trade on every path, by formula where one exists and by a learned approximation where it does not. Net and collateralise by legal agreement. Compute every adjustment for every counterparty, and their sensitivities in one backward pass. Then hedge the credit and rate risks of the CVA, check potential exposure against each credit line, and run the stresses the rule requires. During the day, the same machinery quotes a new trade by rerunning only the netting set it changes.
The credit desk becomes an XVA desk with these tools. Values on every path and the exposure profiles; collateral and the margin period; the adjustments; wrong-way risk; every sensitivity in one backward pass; initial margin and capital exposure; and a clearing house's waterfall. And the twenty-first rule. Every derivative is priced with its credit, funding, capital and margin adjustments, against the counterparty's whole netting set, never alone. DVA is reported, but never counted as profit or capital. Every exposure is stressed for wrong-way risk, and for a margin period twice the one in the contract. And no client's margin is set without knowing how concentrated it is, and what it holds at other dealers, as far as that can be learned.
Would the rule have helped in this part's three cases? For Archegos, it asks what the client holds elsewhere and how concentrated it is before setting margin. At several days' volume per name, the margin of chapter thirteen is several times twenty percent: the House would have refused the size, or charged for it. For the power trader, the House as a clearing member stresses its share of the default fund against the largest one-way positions it can learn of. And for nickel, a doubled margin period and stressed collateral show calls that cannot be paid in a day. No rule prevents every loss. This one asks the questions whose answers were available, and ignored.
For the researcher: bounding wrong-way riskPhD5 min
For the researcher: Chapter 4 modelled wrong-way risk with a copula and with Hull and White's hazard link, and got different answers. Both are guesses about a dependence nobody observes. Here is the question without the guess: given what we do know, how large and how small can CVA be?
Write CVA before assuming anything. It is the expected discounted exposure at the moment of default. On simulated exposure paths and default buckets, the unknown is a table: the probability that path i goes with default in bucket j. Its margins are known: every path has weight one over N, and every bucket has the probability the CDS curve gives it. Optimizing a linear cost over tables with fixed margins is a transportation problem. Paul Glasserman and Linan Yang set it up this way in 2018.
Solve both programs for Chapter 1's netting set and a counterparty with a one in four chance of default over ten years. Independence, the standard assumption, gives million. The worst case: million, four and a half times as much, by putting the defaults on the paths where the bank is owed most. And the best: . With a quarter chance of default and exposure often zero, defaults can be hidden entirely where nothing is owed. The data alone say almost nothing about wrong-way risk.
Inspect default-conditioned exposure for each optimized coupling. Independence gives the mean positive exposure of this fixed empirical subset. The loss-maximizing coupling allocates default mass across dates and paths subject to both sets of margins. It does not independently select the highest path at each date. The loss-minimizing coupling here places defaults on zero exposure. These are profiles under three particular couplings, not pointwise envelopes for every feasible model. The LP bounds the integrated discounted loss, and the distinction matters when a model changes the timing of exposure.
The extremes are extreme. So budget the departure from independence: allow the joint law to differ from it by at most a given relative entropy. The solution is an exponential tilt of the independent table towards high-exposure cells for wrong-way risk, or away from them for right-way, rescaled row by row and column by column until the margins hold again: the Sinkhorn iteration of entropic optimal transport, which Part 9 met.
Plot each numerically rescaled coupling at its achieved relative entropy. At zero tilt the coupling is independent. Positive and negative tilts favor larger and smaller loss cells. The plotted points are a sampled regularization path, not exact solutions at every labeled entropy budget. Units matter: the implementation divides cost by its maximum, so theta is dimensionless. A KL-constrained optimum corresponds to a suitable Lagrange multiplier when feasibility, convergence and duality conditions hold; choosing a penalty and choosing a budget are distinct operations.
The chapter four calculations cannot automatically be tested against this single finite bound problem. The Gaussian example uses a flat mean hazard, while this LP uses a piecewise default curve. Both chapter four models use twenty thousand paths, while the LP uses a fixed fifteen hundred-path subset. A number falling between these extrema proves no containment theorem. To compare a model with these bounds, first match the path weights, default-bucket margins, costs and discount convention. Then verify that its coupling is feasible. Static transport bounds also allow dependencies that need not define an adapted trading model.
Three open questions. The entropy budget is set by judgement; linking it to observable quantities, such as how CDS spreads move with the exposure's drivers, is open. Requiring the coupling to respect time, since default cannot depend on future exposure, tightens the bounds; such constrained transport problems are larger and less studied. And regulators use a fixed multiplier of one point four, partly for wrong-way risk; whether bounds like these should replace it is unsettled.
Pause and predict. Two equally likely exposure paths, worth zero and ten at one date, and a default probability of a fifth at that date. With zero rates and no recovery, what are the independent, the worst and the best CVA?
The independent joint mass on the ten-unit exposure and default is one half times one fifth: one tenth, so expected loss is one. Put all one fifth of default probability on the high-exposure path: loss is two. Put it all on the zero-exposure path: loss is zero. Both extremes are feasible because each path has probability one half. The bound concerns these fixed margins; it does not infer a default mechanism.
Recap, desk questions, problemsAll tracks5 min
The first half in eight lines. Reported Archegos losses motivate counterparty exposure, but the exposure model here is an illustrative floating-reset sketch. Netting requires enforceable agreements. Collateral leaves gap risk and contractual complications. CVA uses positive exposure, with the survival sign and discount convention specified; DVA is not freely spendable income. New trades change a whole netting set. Dependence can change loss even when default marginals are fixed, but our flat-hazard and piecewise-hazard examples have different marginals. Funding costs need not cancel at equal spreads, and combining adjustments requires a consistent policy. AAD differentiates one scalar computation with respect to many inputs.
The second half. Regression and neural networks approximate this fixed simulated model, with independent test paths and measured error. Initial margin reduces modelled gap risk and costs funding; the delta-only aggregation is not full SIMM. Buffers and floors trade higher calm-period margin for stability. Clearing changes netting and mutualizes some losses; its simulated waterfall frequencies are assumptions, not forecasts. Public episodes distinguish notional, collateral, losses and liquidity. Regulatory examples depend on jurisdiction and implementation date. Concentration and liquidation time matter, and no illustrative impact formula establishes a universally safe margin.
Four desk questions. Why does DVA rise as the bank's own credit worsens? It reflects own non-performance risk under the valuation convention; recognition does not create freely spendable income. Two offsetting swaps with one counterparty cancel under enforceable netting; without it, positive claims are considered separately. Daily collateral still leaves margin-period risk, disputes, settlement and collateral-value risk. Responsive margin can rise when liquidity is scarce. Buffers and floors trade calm-time cost for stability, but their performance must be tested under the actual policy.
Two more. A continuous positive-part kink often permits pathwise differentiation under a continuous state law and suitable domination. Atoms and failure of derivative-expectation interchange need care. A discontinuous payoff can have a boundary contribution that naive differentiation misses. Smoothing introduces bias; likelihood-ratio and conditional methods require their own regularity checks. For a concentrated single-stock client, measure position size against available volume across dealers. It informs liquidation time and stress, but neither volume nor a fixed impact formula guarantees a safe margin.
Problems one to six. Derive expected exposure and the ninety-fifth percentile for the normal forward. Find the maximum of the diffusion-times-runoff swap profile. Turn constant-exposure CVA into a running spread, stating its reference notional and assumptions. Add the other party's survival to obtain a bilateral first-to-default expression. Derive gap exposure for a zero-threshold margin agreement under the stated lag. Then calculate the supervisory add-on for one swap. Keep pricing probabilities, discounting, time units and regulatory approximations explicit. The notes provide worked solutions; pause here to attempt the calculations.
Problems seven to ten. Apply the exercise's chosen Cover Two requirement to two stressed excess losses, then explain what changes if a third member defaults. Compare the work and memory of reverse differentiation with bumping, and state the conditions needed at kinks or discontinuities. Derive the dealer-count threshold for clearing one class in the independent normal netting model. Finally integrate a linearly declining capital profile to obtain the undiscounted KVA in that exercise. Each result is conditional on its model and policy assumptions, rather than a general compliance or safety statement.
The two qualifying problems. In the transport problem, let M count all columns, including survival. Prove that an optimum occurs at a vertex with at most N plus M minus one positive cells, allowing degeneracy, and solve the two-path example. For the entropy problem assume a positive theta and positive prescribed margins. Derive the exponentially tilted, row-and-column-scaled optimizer and explain Sinkhorn feasibility. Distinguish a regularization parameter from a pre-set KL budget, and state why a static coupling need not be adapted to market information. The English and Chinese notes contain the derivations.
Where this comes back. Part twenty-two: balance-sheet costs behind the currency basis and the Treasury basis trade. Part twenty-six charges funding and capital in every backtest. Part thirty-seven measures what it costs to sell a concentrated position, Archegos's problem. Part thirty-eight turns to market makers. And the finale stresses the House's counterparties together with their collateral.
The textbooks this part follows, and the papers, standards and public records it draws on, from Brigo and Masetti's CVA to deep solvers for the adjustments. Every number on screen was computed by the House's code on the Fed's curve, with illustrative credit and margin parameters labelled as such.
That completes the credit desk: default, and the price of every counterparty's promise. Next, Part twenty-two: currencies, commodities, and the bases that open when balance sheets are expensive. The House's macro desk opens.
Where it goes next. Margin that rises in stress is the procyclical engine of Part 41.
Key results
The part's results in one place, for revision.
Try it
Lab 21 · Exposure, collateral and CVA on one swap
Simulate a ten-year payer swap under Hull-White, draw its expected and potential future exposure, add daily variation margin with a ten-day margin period of risk, and price the counterparty's default.
python -m videos.quant.labs 21
needs numpy, scipy, matplotlib, numba · download lab21.py ·
source on GitHubPar swap rate 3.846%
Peak expected exposure 4.06 per 100 notional, at year 4.0
Peak 95% potential future exposure 14.40
CVA, uncollateralised 0.196 per 100 = 2.4 bp running
CVA, daily margin, 10-day MPoR 0.038 per 100 (19% of the above)
Collateral leaves only what the swap can move in the ten days it takes to close out a defaulter.
The code (55 lines; it asserts its own result)
"""Lab 21: the exposure of a swap, what collateral removes, and the CVA that is left."""
import numpy as np
from videos.quant import labs
from explainer.quant.house import rates, termstructure, xva
TITLE = "Exposure, collateral and CVA on one swap"
GOAL = ("Simulate a ten-year payer swap under Hull-White, draw its expected and potential future exposure, add "
"daily variation margin with a ten-day margin period of risk, and price the counterparty's default.")
TASKS = [
"Make it a receiver swap (payer=False). Why is the exposure profile not the mirror image?",
"Raise the threshold from 0 to 2% of notional. How much CVA comes back?",
"Double the counterparty's hazard rate, then make exposure rise with it (xva.wrong_way_cva).",
]
def run(seed=0):
curve = rates.Curve(np.array([0.5, 1, 2, 5, 10, 30]), np.array([0.030, 0.031, 0.033, 0.036, 0.038, 0.040]))
hw = termstructure.HullWhite(curve, a=0.05, sigma=0.01)
T_end = 10.0
K = curve.par(T_end, freq=1)
times = np.linspace(0, T_end, 241)[1:] # twice a month
x, _ = hw.simulate_x(times, 20000, seed=seed)
V = np.column_stack([xva.swap_values_hw(hw, x[:, i], t, K, T_end, freq=1, notional=100.0, payer=True)
for i, t in enumerate(times)])
raw = xva.exposure_profile(V)
coll = xva.exposure_profile(xva.collateralised(V, times, threshold=0.0, mpor=10 / 252))
knots, hazards = np.array([10.0]), np.array([0.02]) # a flat 2% hazard: about a 120 bp spread at 40% recovery
cva_raw = xva.cva(raw["EE"], times, curve.df, knots, hazards, R=0.4)
cva_coll = xva.cva(coll["EE"], times, curve.df, knots, hazards, R=0.4)
annuity = sum(curve.df(t) for t in range(1, 11))
lab = labs.Lab()
lab.row("Par swap rate", f"{100 * K:.3f}%")
lab.row("Peak expected exposure", f"{raw['EE'].max():.2f} per 100 notional, at year {times[raw['EE'].argmax()]:.1f}")
lab.row("Peak 95% potential future exposure", f"{raw['PFE'].max():.2f}")
lab.row("CVA, uncollateralised", f"{cva_raw:.3f} per 100 = {1e4 * cva_raw / (100 * annuity):.1f} bp running")
lab.row("CVA, daily margin, 10-day MPoR", f"{cva_coll:.3f} per 100 ({100 * cva_coll / cva_raw:.0f}% of the above)")
lab.note = "Collateral leaves only what the swap can move in the ten days it takes to close out a defaulter."
assert abs(V[:, 0].mean()) < 0.3 and 0 < cva_coll < 0.25 * cva_raw and 2 < times[raw["EE"].argmax()] < 6
assert raw["EE"][-1] < 0.2 * raw["EE"].max(), "exposure dies as the swap amortises"
fig, ax = labs.figure(2, size=(11, 4.2))
for path in V[:60]:
ax[0].plot(times, path, color=labs.SPOT, lw=0.5, alpha=0.5)
ax[0].axhline(0, color=labs.MUTED, lw=0.8)
ax[0].set(title="Value of a 10-year payer swap on 60 paths", xlabel="years", ylabel="per 100 notional")
ax[1].fill_between(times, raw["EE"], color=labs.LOSS, alpha=0.3)
ax[1].plot(times, raw["EE"], color=labs.LOSS, label="expected exposure")
ax[1].plot(times, raw["PFE"], color=labs.P, ls="--", label="95% potential future exposure")
ax[1].plot(times, coll["EE"], color=labs.GAIN, label="expected exposure with margin")
ax[1].set(title="Exposure profiles", xlabel="years")
ax[1].legend(fontsize=8)
lab.fig = fig
return lab
Now change it
- Make it a receiver swap (payer=False). Why is the exposure profile not the mirror image?
- Raise the threshold from 0 to 2% of notional. How much CVA comes back?
- Double the counterparty's hazard rate, then make exposure rise with it (xva.wrong_way_cva).
Problems, with solutions
Try each problem before opening its solution; the last two of each set are at qualifying-exam level.
Desk questions, with solutions
- Why does a bank's DVA increase as its credit gets worse, and is that profit real?
Answer
DVA reflects own non-performance risk under the specified closeout convention. A worse credit makes that likelier, so the liability is worth less and the bank books a gain. Accounting standards (IFRS 13, ASC 820) require it, but recognition is not freely spendable income; realization and prudential adjustments depend on the instrument and applicable rules (ch. 3). - Two offsetting swaps with one counterparty: exposure with and without netting?
Answer
With netting, nothing: the values cancel on every path. Without it, the sum of each swap's positive part: the liquidator collects on the swap the defaulter is winning and leaves the bank an unsecured claim on the other (ch. 1). - A counterparty posts daily cash margin with a zero threshold. How can you still lose?
Answer
Through the move between its last payment and the close-out (the margin period of risk, ch. 2), through the cost of replacing hedges in a market that has moved, through disputes and transfer thresholds, and through collateral that falls with the counterparty or the exposure (wrong-way, ch. 2 and 4). - Why does margin rise exactly when cash is scarce?
Answer
Margin models scale with recent volatility, and volatility rises in a crisis; every margined position is called at once, the cash is raised by selling, and selling raises volatility again (ch. 9). Buffers, floors and longer look-backs damp the loop at the cost of more margin in calm times. - What does a backward pass get wrong at max(V, 0), or at a jump in a payoff?
Answer
At a kink it returns the derivative on one side, which is correct almost everywhere and harmless on average. At a jump the pathwise derivative is zero almost everywhere and misses the jump's contribution entirely. Smooth the payoff (replace the step with a narrow sigmoid), or estimate those terms with likelihood-ratio or conditional-expectation methods (ch. 6). - A client posts 20% margin on a single-stock swap. What do you most want to know?
Answer
The size of its position against the stock's daily volume, at every dealer combined: that sets how long a liquidation takes, and so the margin (ch. 13). It is hard to see because a swap leaves the shares in the dealers' names, and each dealer sees only its own.
Problems, with worked solutions
In problem 11, M counts all transport columns, including survival. The research example has 120 default buckets plus one survival column. Pathwise sensitivity arguments at kinks require regularity and a justified exchange of differentiation and expectation; atoms and discontinuities need separate treatment.
-
A forward's exposure. For a forward contract with value \(V(t) = \sigma W_t\), show that \(\text{EE}(t) = \sigma\sqrt{t/(2\pi)}\) and \(\text{PFE}_{95}(t) = 1.645\,\sigma\sqrt t\).
Solution
V(t) = σW_t is normal with mean 0 and variance σ²t, so EE(t) = E[max(σW_t, 0)] = σ√t E[max(Z, 0)] = σ√t φ(0) = σ√(t/2π). Its 95th percentile is 1.645 σ√t, and PFE₉₅ = 1.645 σ√t since that is positive.
-
The swap's hump. A swap's EE is roughly \(\sigma\sqrt t\,(T - t)\,c\). At what \(t\) is it largest? Compare with chapter 1's hump.
Solution
f(t) = √t (T − t) has f′(t) = (T − t)/(2√t) − √t = 0 when T − t = 2t, so t = T/3: 3.3 years for a 10-year swap. Chapter 1's profile peaks near year 4 on a monthly grid, later than T/3 because the coupons are annual, so the remaining payments fall in steps rather than smoothly.
-
CVA as a spread. With a flat hazard \(\lambda\) and constant EE, show that \(\text{CVA} \approx (1 - R)\,\lambda\,\text{EE}\int_0^T e^{-(r + \lambda)t}\,dt\), and hence that CVA as a running spread is about \((1 - R)\lambda \times \text{EPE}/N\).
Solution
With a constant EE, flat hazard λ and rate r, the default density is λe^{−λt}, so CVA = (1 − R) EE ∫₀ᵀ e^{−rt} λ e^{−λt} dt = (1 − R) λ EE ∫₀ᵀ e^{−(r+λ)t} dt. Dividing by the risky annuity ∫₀ᵀ e^{−(r+λ)t} dt on notional N gives a running spread of (1 − R) λ EE/N: the credit triangle applied to the exposure.
-
Bilateral CVA. Show that bilateral CVA with independent defaults is \((1 - R)\int \text{EE}(t) P(0,t) Q_b(t)\,(-dQ_c(t))\), and explain why it is smaller than the unilateral CVA.
Solution
The bank loses on the counterparty's default at t only if it has not defaulted itself first. With independent defaults, P(τ_c ∈ dt, τ_b > t) = Q_b(t)(−dQ_c(t)), so CVA_bil = (1 − R) ∫ EE(t) P(0, t) Q_b(t)(−dQ_c(t)). Since Q_b(t) ≤ 1 everywhere, it is no larger than the unilateral CVA, and smaller whenever the bank can default.
-
Collateralised exposure. Collateral with zero threshold and margin period \(m\): show that for \(V(t) = \sigma W_t\) the collateralised EE is about \(\sigma\sqrt{m/(2\pi)}\), independent of \(t\).
Solution
With zero threshold and margin period m, the collateral at t is V(t − m), so the exposure is max(σ(W_t − W_{t−m}), 0). The increment is normal with variance σ²m whatever t is, so EE = σ√(m/2π), constant in time: the square root of the margin period, not of the trade's age.
-
An SA-CCR add-on by hand. Compute SA-CCR's add-on for a single 10-year payer swap on $100 million, unmargined (\(S = 0\), \(E = 10\)).
Solution
The supervisory duration is (e^{−0.05·0} − e^{−0.05·10})/0.05 = (1 − 0.607)/0.05 = 7.87, so the effective notional is 100 × 7.87 = 787 (one trade, in the over-five-years bucket, maturity factor 1). The add-on is 0.5% × 787 = $3.93 million and, with zero replacement cost and multiplier 1, EAD = 1.4 × 3.93 = $5.5 million: chapter 12's "10y payer alone".
-
Cover 2. A CCP's two largest members would lose 30 and 25 beyond their margin in a stress. What default fund does Cover 2 require, and who pays if the third largest also defaults?
Solution
Under the exercise's imposed Cover Two requirement, resources cover the two largest stressed aggregate exposures beyond member margin in extreme but plausible markets: 30 + 25 = 55. If the third largest also defaults, its own margin and fund contribution are used first, then what remains of the mutualised fund after the CCP's own capital; beyond that, assessments on the surviving members, capped by the rulebook, and then recovery tools such as haircutting variation-margin gains. The survivors pay.
-
The cost of AAD. Why can AAD compute \(n\) sensitivities for the cost of a few valuations, while bumping costs \(n\)? What does it cost in memory?
Solution
Reverse mode computes the gradient as a vector–Jacobian product, sweeping the recorded operations once backwards; each operation's adjoint costs a small constant multiple of the operation itself, so all n sensitivities cost a few valuations regardless of n, against n + 1 valuations for one-sided bumps. The price is memory: every intermediate value of the forward pass (each path, date and operation) must be stored for the backward one, or recomputed from checkpoints.
-
When clearing one product helps. With \(N\) dealers and \(K\) independent, equal asset classes, show that clearing one class lowers a dealer's expected exposure if and only if \(N > 1 + (\sqrt K + \sqrt{K - 1})^2\).
Solution
Bilaterally, a dealer's exposure to each of N − 1 counterparties nets K independent classes of variance σ², so it is σ√K φ with φ = 1/√(2π), and the total is (N − 1)σ√K φ. Clearing one class leaves (N − 1)σ√(K − 1)φ bilaterally and adds σ√(N − 1)φ at the CCP, where that class nets across all N − 1 counterparties. Clearing helps iff (N − 1)(√K − √(K − 1)) > √(N − 1), that is √(N − 1) > 1/(√K − √(K − 1)) = √K + √(K − 1), or N > 1 + (√K + √(K − 1))²: 7, 15 and 31 dealers for K = 2, 4 and 8.
-
A KVA by hand. A trade needs capital \(K(t) = K_0(1 - t/T)\) for \(T\) years. With hurdle \(h\) and no discounting, show that \(\text{KVA} = h K_0 T/2\).
Solution
KVA = h ∫₀ᵀ K₀(1 − t/T) dt = h K₀ [t − t²/(2T)]₀ᵀ = h K₀ T/2: the hurdle rate times the average capital times the life.
-
(qual) The transport problem. (qual) Write CVA over couplings of \(N\) exposure paths and \(M\) columns including survival as a transportation LP; show the bounds are attained at vertices with at most \(N + M - 1\) positive cells, and solve the two-path example by hand.
Solution
With c_ij = (1 − R)D(t_j)V_i(t_j)⁺ (and c = 0 for survival), CVA(p) = Σc_ij p_ij is linear in p, and the feasible set {p ≥ 0: Σ_j p_ij = 1/N, Σ_i p_ij = q_j} is a transportation polytope. A linear function attains its maximum and minimum at vertices, and a vertex of an N × M transportation polytope has at most N + M − 1 positive cells (its support is a forest in the bipartite graph). Two paths (0 and 10, weight ½ each), one date with q = 0.2: independence gives 0.2 × 5 = 1; the worst puts all 0.2 on the second path (feasible, since 0.2 ≤ ½): 2; the best puts it on the first: 0.
-
(qual) The entropic solution. (qual) For \(\theta > 0\), show that maximizing \(\sum p_{ij}c_{ij} - \frac1\theta\mathrm{KL}(p\,\|\,p^\perp)\) over couplings gives \(p_{ij} = a_i b_j p^\perp_{ij}e^{\theta c_{ij}}\), and that Sinkhorn's alternating rescaling finds \(a\), \(b\).
Solution
Assume θ > 0 and positive prescribed margins. The Lagrangian Σp c − (1/θ)Σp log(p/p⊥) + Σ_i α_i(Σ_j p_ij − 1/N) + Σ_j β_j(Σ_i p_ij − q_j) has first-order condition c_ij − (1/θ)(log(p_ij/p⊥_ij) + 1) + α_i + β_j = 0, so p_ij = a_i b_j p⊥_ij e^{θc_ij} with a_i = e^{θα_i − 1/2}, b_j = e^{θβ_j − 1/2}. Sinkhorn alternates a ← (1/N)/(Kb), b ← q/(Kᵀa) with K = p⊥e^{θc}; each step is a Bregman projection onto one set of margins, and the iteration converges to the unique solution.
Reading and notes
The part's papers
from READING.md
- Brigo, D., Masetti, M. (2005). "Risk neutral pricing of counterparty risk." In Counterparty Credit Risk Modelling (Risk Books).
- Pykhtin, M., Zhu, S. (2007). "A guide to modelling counterparty credit risk." GARP Risk Review.
- Piterbarg, V. (2010). "Funding beyond discounting." Risk.
- Burgard, C., Kjaer, M. (2011). "Partial differential equation representations of derivatives with bilateral counterparty risk and funding costs." J. Credit Risk.
- Duffie, D., Zhu, H. (2011). "Does a central clearing counterparty reduce counterparty risk?" Review of Asset Pricing Studies.
- Hull, J., White, A. (2012). "The FVA debate." Risk.
- Green, A., Kenyon, C., Dennis, C. (2014). "KVA: capital valuation adjustment." Risk.
- Basel Committee (2014). The Standardised Approach for Measuring Counterparty Credit Risk Exposures (SA-CCR).
- Cont, R. (2015). "The end of the waterfall: default resources of central counterparties." J. Risk Management in Financial Institutions.
- ISDA (2016–). ISDA SIMM Methodology.
- Andersen, L., Duffie, D., Song, Y. (2019). "Funding value adjustments." Journal of Finance.
- Paul, Weiss (2021). Credit Suisse Group Special Committee Report on Archegos Capital Management.
- Gnoatto, A., Picarelli, A., Reisinger, C. (2023). "Deep xVA solver: a neural network–based counterparty credit risk management framework." SIAM J. Financial Mathematics.
- Public reviews of the March 2022 LME nickel episode (LME, FCA, Bank of England) (verify).
Papers and sources
Papers, chapter by chapter
- Hook and ch. 1–2: Paul, Weiss, Report on Archegos Capital Management (to Credit Suisse's board, July 2021); ISDA master agreements (1987, 1992, 2002); Basel Committee, the IMM and α (2005); Canabarro, Picoult and Wilde (2003).
- ch. 3: Brigo and Masetti (2005); Gregory (2009); Basel Committee press release on Basel III (2011, the two thirds).
- ch. 4: Hull and White (2012), "CVA and wrong-way risk"; Pykhtin and Zhu (2007).
- ch. 5: Piterbarg (2010); Burgard and Kjaer (2011); Hull and White (2012), "The FVA debate"; Green, Kenyon and Dennis (2014); J.P. Morgan, fourth-quarter 2013 results.
- ch. 6–7: Giles and Glasserman (2006); Capriotti (2011); Longstaff and Schwartz (2001); Gnoatto, Picarelli and Reisinger (2023).
- ch. 8–9: BCBS–IOSCO, Margin requirements for non-centrally cleared derivatives (2015); ISDA SIMM methodology; Commission Delegated Regulation (EU) 153/2013, Article 28; Kupiec (1995); Christoffersen (1998).
- ch. 10: Duffie and Zhu (2011); CPMI–IOSCO, Principles for Financial Market Infrastructures (2012); Cont (2015); BIS Quarterly Review (December 2018), "Two defaults at CCPs, 10 years apart".
- ch. 11: LME notices (8 and 16 March 2022); the High Court's judgment (November 2023); FCA final notice (March 2025).
- ch. 12: Basel Committee, SA-CCR (2014) and the CVA framework (2020, MAR50); Andersen, Duffie and Song (2019).
For the researcher
- The theorems. Glasserman and Yang (2018), "Bounding wrong-way risk in measuring counterparty risk," Management Science 64(12); Cuturi (2013) and Sinkhorn (1964) for entropic transport; Hull and White (2012); Brigo, Morini and Pallavicini (2013) for the modelling side.
- Simplifications. A 1,500-path subsample for the LPs; monthly buckets; the coupling allowed to look at the whole path (not only past exposure), which makes the worst case larger than a non-anticipative one.
- Open problems. Calibrating the entropy budget; time-respecting couplings; replacing the α multiplier.
Labs, replays and simulations in the filmHands-on
The learning diagram abbreviates parameter fitting: θ* minimizes the empirical squared loss, then the fitted value function is V at θ*. In problem 5, the constant margin-period exposure formula applies after the lag window, t ≥ m.
- Labs (the House's own code on screen, then run):
cva_torch(ch. 6). - Computed: exposure on 20,000 Hull–White paths; collateral on a daily grid; CVA, DVA, FVA, KVA and MVA; CS01 and incremental CVA; two wrong-way models; AAD against bumps; a network and per-date regressions; IM, its funding, and a margin backtest on fifteen years of the 10-year yield; a simulated clearing house.
- Live constructions: the exposure fan; the margin lag; the computation tape run forwards and backwards; the SIMM quadratic form; the default waterfall filling; the procyclicality loop; the fire-sale race.
Textbook audit
| Textbook | Chapters | Where |
|---|---|---|
| Gregory, The xVA Challenge (4th ed.) | 3–4 (exposure, netting), 6–8 (collateral, margin, clearing), 11–12 (exposure models), 14–17 (CVA, DVA, wrong-way), 18–21 (FVA, MVA, KVA), 13 (capital) | ch. 1–5, 8–12 |
| Green, XVA: Credit, Funding and Capital Valuation Adjustments | 3–4 (CVA, DVA), 9–11 (FVA), 12–13 (KVA, MVA), 15–16 (Monte Carlo, AAD) | ch. 3–6 |
| Brigo, Morini and Pallavicini, Counterparty Credit Risk, Collateral and Funding | 4–5 (unilateral and bilateral CVA), 8 (wrong-way risk), 9–10 (collateral, funding) | ch. 3–5 |
| Hull, Options, Futures, and Other Derivatives | 24 (credit risk: CVA), 9 (OIS discounting and collateral) | ch. 2–3 |
Data, scope and reproducibilityData and reproducibility
The product-shape comparison includes a weighted rate/FX profile mixture and a flat positive option proxy; it does not value a jointly simulated cross-currency swap. The CVA running-spread conversion uses a $100 million reference notional against a $200 million gross swap book. CDS hazards are bootstrapped with a flat 4% discount assumption, separately from the dated exposure curve.
- FRED: DGS10 (daily, 2006–2025), PNICKUSDM (the IMF's nickel price, monthly); the Fed's fitted zero curve (Gürkaynak, Sack and Wright), as of 31 December 2025; frozen and checksummed.
- Published figures quoted, not computed: the banks' Archegos losses; LCH's and Nasdaq Clearing's defaults (BIS); the LME's daily prices, the cancelled trades and the FCA's fine; J.P. Morgan's FVA charge; the Paul, Weiss report's liquidation estimates.
- Illustrative inputs, labelled on screen: the counterparty's and the bank's CDS curves (80–170 and 40–85 bp), funding spreads, the SIMM-style risk weights, the capital proxy and hurdle rate, the clearing house's members and stresses, the hypothetical nickel position, the Archegos-style stock and the fire-sale model.
- No hold-out is opened in this part; the cumulative trial counter remains 317 through Part21 (23,562 globally).
Chapter notesChapters (about 55 minutes)
- The other side of every trade (2.5 min). Archegos's banks' reported losses (Credit Suisse 5.5, Nomura 2.9, Morgan Stanley 0.9, UBS 0.9, MUFG 0.3, $ billion); the history strip (1987–2023); the plan; the credit desk becomes an XVA desk.
- 1. Exposure (3.8). EE, ENE and PFE defined; a fan of values for a 10-year payer swap (Hull–White, a = 0.0087, σ = 1.04%); the hump (EE peaks at 5.9m near year 4; PFE 19.2m); product shapes (swap, FX forward, cross-currency swap, bought option); netting a three-swap set (EE 21% lower); close-out netting and the ISDA master agreements; effective EPE (1.20m) and α = 1.4.
- 2. Collateral and the margin period of risk (3.4). The CSA; EPE 2.98 → 1.08 (threshold $2m) → 0.81 (zero threshold, monthly grid); daily margin with a 10-day MPOR: 0.45 of the uncollateralised EPE; minimum transfer amounts (242 calls a year at zero, 8 at $2m, for 19% more EPE); Treasuries as collateral (+1.4% EPE unhaircut, −2.3% with Basel's 4%); re-use and segregation.
- 3. CVA and DVA (4.5). The formula derived; CVA $404k (about 5 bp a year of notional), month by month; bilateral CVA 381k, DVA 154k, rising to 729k at six times the bank's own spread; CVA against the counterparty's spread (212k at half, 1,216k at four times), CS01 $1,957 a bp and a $4.6m CDS hedge; incremental CVA (a 5-year receiver: 60k alone, −12k added); Monte Carlo error (27k at 250 paths, 3.4k at 16,000) and model error (403–411k across mean reversions, re-fitted); the Basel Committee's two thirds.
- 4. Wrong-way risk (2.8). The conditional formula; a Gaussian copula (CVA 366k at ρ = 0, 668k at 0.9, 195k at −0.6); Hull and White's hazard model λ = exp(a(t) + bV), refitted to the CDS curve (b = 0.1: 404k → 753k); α as partly its price (×1.25 at ρ = 0.3); general and specific wrong-way risk.
- 5. FVA, KVA and MVA (3.4). Funding an uncollateralised client hedged with a collateralised dealer; Burgard–Kjaer, Hull–White's FVA debate, J.P. Morgan's $1.5 billion (January 2014); KVA derived (511k at a 10% hurdle); the stack (CVA, DVA, FCA, FBA, KVA, MVA); asymmetric funding (FVA 22k at 80/80 bp, 140k at 80/20, 297k at 150/20).
- 6. Sensitivities by AAD (2.4). Bumping against one reverse sweep; the tape worked by hand for one default bucket;
14 sensitivities agreeing with bumps (1.1 s against 1.1 s in this CPU run); lab:
cva_torch. - 7. A network that learns future values (2.7). V(t, x) as a conditional expectation; training on realised discounted cash flows only; on fresh paths the CVA is 423k against the 414k reset-approximation reference (+2%), the coupon steps rounded off; against per-date regression (cubic: RMSE 0.19 against the network's 1.04; CVA +1.8%), and the 23,426 terms a cubic needs in 50 factors.
- 8. Initial margin (3.5). The rules (2016–2022); a normal delta-only motivation for a SIMM-style quadratic form; key-rate DV01s and a SIMM-style IM of $3.4m; the regulatory schedule ($6.0m without netting credit); the IM profile; IM against CVA and MVA (at the 99th percentile CVA falls from 15k to 0.2k while MVA is 89k).
- 9. Margin procyclicality (2.7). A 10-day 99% margin on 10-year notes from the daily yield: EWMA from $2.88 to $6.59 per $100 in March 2020; the loop; EMIR's tools (jump ×2.3 alone, ×2.1 with a 25% buffer, ×1.6 with a 10-year floor, at 40% more margin in calm times); a overlapping-window, two-sided diagnostic (28 exceptions in 2,238 windows, 1.25%; iid-reference p = 0.25 does not certify coverage).
- 10. Central clearing (3.4). Novation; Duffie and Zhu (clearing one of K classes helps only with more than 7, 15, 31 dealers for K = 2, 4, 8); the waterfall; a simulated CCP (under the fixed toy law, survivors' fund is reached in about one in eight scenarios conditional on a default); Lehman at LCH (66,390 swaps, $9 trillion, about a third of its margin used) and Aas at Nasdaq Clearing (€114m beyond collateral; €7m of the CCP's capital; €107m of a €166m fund).
- 11. March 2022: the LME's nickel market (2.5). Monthly prices (IMF); $28.9k, $48.1k, $101.4k a tonne on 4, 7 and 8 March; variation margin on a hypothetical 100,000-tonne short ($1.9bn, then $5.3bn); the suspension and the cancelled trades; price limits; the High Court (2023) and the FCA's £9.2 million fine (2025).
- 12. Capital for counterparty risk (2.7). SA-CCR derived for swaps; the netting set (8.1 alone, 4.8 netted, 1.4 margined, $m of EAD); the PFE multiplier (0.61 one add-on out of the money, floor 5%); Basel's basic CVA charge (about $580k for this set; per-name capital falls only to half across many names); CVA capital and the leverage ratio.
- 13. March 2021: Archegos (3.6). The total return swap; the fire sale; margin against the liquidation horizon (20% covers about 0.65 days' volume for a 4%-a-day stock; the Paul, Weiss report's 2.5–10 days at Credit Suisse alone); the race to sell (stylised: losses 20 against 40); the record.
- 14. Rule 21: the XVA desk (2.7). One ticket (CVA, DVA reported, FVA, KVA, MVA: the client pays about $1.05
million); the desk's night; the
xvamodule; Rule 21; the rule against this part's three cases. - For the researcher: finite wrong-way bounds. A transportation LP fixes an empirical law of 1,500 exposure paths and 120 monthly default buckets plus survival. Under deterministic discounting its independence value is 0.40m, maximum 1.81m and minimum 0.00. These are conditional finite bounds, allowing static couplings that need not be adapted or economically realizable. Sinkhorn points are plotted at their achieved KL values, with normalized costs; a penalty path does not solve every pre-set entropy budget. Chapter 4's flat-hazard copula and full-path hazard-link examples have different default or empirical path margins, so numerical inclusion does not establish a bound theorem. Matching margins and costs is a prerequisite. The worked two-path answer gives 1, 2 and 0.
- Recap, desk questions, problems (3.5). Sixteen lines; six desk questions; twelve problems (two at qualifying-exam level), solutions below.
中文讲义
本讲的中文说明、交易台问题与习题解答(与英文版对应)。
导言量化金融,从零搭建 — 第21部分:交易对手风险、XVA与清算
本轮视觉复核完成:已实际检查34张双语旁白节点画面表、17张英文动画画面表及27张原尺寸重点画面。配音开场及分章静音预览已核验。完整成片连续听审与发音验证仍待完成,信号检查不能替代听审。
本例使用2025年末公开曲线与历史波动率代理,并未对交易期权价格校准。浮息腿在每个估值日重设,忽略既有定盘利率。CVA采用明确假设下的确定性贴现近似。资金、资本及保证金成本须统一政策,避免重复计入。
第20部分为借款人不还钱的可能性定价;本部分为每一笔衍生品另一方的同一种可能性定价,以及围绕它发展起来的抵押品、融资、资本和清算。本部分讲:
- 敞口:在拟合指定曲线、采用历史参数代理的Hull–White示例中的路径价值,预期敞口与潜在未来敞口,不同产品的形状,净额结算及其背后的法律,监管的有效EPE;
- 抵押品:门槛、最低转移金额、风险保证金期,国债作为抵押品与折扣率,再使用与隔离;
- 推导并计算CVA与DVA;作为头寸的CVA(CS01及其CDS对冲)、增量定价、蒙特卡罗误差与模型误差;用连接函数和Hull–White风险率模型刻画错向风险,以及巴塞尔的α;
- 对称与不对称融资下的FVA、FVA之争、KVA与MVA;
- 伴随微分求敏感度,并手算计算记录;从现金流学习账簿未来价值的神经网络,与逐日回归比较;
- 初始保证金:SIMM的推导、监管表格法、初始保证金与它带来的MVA;顺周期性、EMIR的逆周期工具与Kupiec回测;
- 清算:更替、Duffie和Zhu关于净额结算的结论、模拟违约瀑布、雷曼在LCH(2008)与Einar Aas在纳斯达克清算所(2018);
- 依据公开记录:伦敦金属交易所的镍市场(2022年3月)与Archegos(2021年3月);资本:SA-CCR、巴塞尔基本法CVA资本、杠杆率。
讲的是方法,不构成投资建议。涉及的公司与事件均依据公开记录,并注明报道来源。
Chapter notes章节(约55分钟)
- 每笔交易的另一方。 Archegos相关银行报告的损失(瑞信55亿、野村29亿、摩根士丹利9亿、瑞银9亿、三菱日联3亿美元);历史条(1987–2023);本部分安排;信用交易台变成XVA交易台。
- 1. 敞口。 定义EE、ENE与PFE;10年期付固定互换的价值扇形(Hull–White,a = 0.0087,σ = 1.04%);驼峰(EE在第4年附近达到590万美元峰值;PFE 1,920万);产品形状(互换、外汇远期、交叉货币互换、买入期权);三笔互换的净额集(EE降低21%);平仓净额与ISDA主协议;有效EPE(120万)与α = 1.4。
- 2. 抵押品与风险保证金期。 信用支持附件;EPE 2.98 → 1.08(门槛200万美元)→ 0.81(零门槛,月度网格);每日保证金、10天风险保证金期:未抵押EPE的0.45;最低转移金额(零时每年242次追加,200万时8次,EPE多19%);国债作为抵押品(无折扣时EPE +1.4%,巴塞尔4%折扣时−2.3%);再使用与隔离。
- 3. CVA与DVA。 推导公式;CVA 40.4万美元(每年约为名义本金的5个基点),逐月分解;双边CVA 38.1万,DVA 15.4万,银行自身利差扩大到六倍时升到72.9万;CVA对交易对手利差(一半时21.2万,四倍时121.6万),CS01每基点1,957美元与460万美元的CDS对冲;增量CVA(一笔5年期收固定:单独6.0万,加入后−1.2万);蒙特卡罗误差(250条路径2.7万,16,000条3,400)与模型误差(重新拟合后不同均值回归下40.3–41.1万);巴塞尔委员会的三分之二。
- 4. 错向风险。 条件公式;高斯连接函数(ρ = 0时CVA 36.6万,0.9时66.8万,−0.6时19.5万);Hull和White的风险率模型λ = exp(a(t) + bV),重新拟合到CDS曲线(b = 0.1:40.4万 → 75.3万);α部分是它的价格(ρ = 0.3时×1.25);一般与特定错向风险。
- 5. FVA、KVA与MVA。 为一个无抵押客户融资,并与有抵押的交易商对冲;Burgard–Kjaer、Hull–White的FVA之争、摩根大通的15亿美元(2014年1月);推导KVA(10%门槛收益率下51.1万);全部调整(CVA、DVA、FCA、FBA、KVA、MVA);不对称融资(80/80个基点时FVA 2.2万,80/20时14.0万,150/20时29.7万)。
- 6. 用AAD求敏感度。 扰动对一次反向扫描;对一个违约区间手算计算记录;14个敏感度与扰动一致(本次CPU运行中为1.1秒对1.1秒);实验:
cva_torch。 - 7. 学习未来价值的网络。 把V(t, x)看作条件期望;只用实现的贴现现金流训练;在新路径上CVA为42.3万对重设近似参考值41.4万(+2%),付息处的台阶被磨平;与逐日回归比较(三次多项式:RMSE 0.19对网络的1.04;CVA +1.8%),以及50个因子下三次多项式需要的23,426项。
- 8. 初始保证金。 规则(2016–2022);把SIMM推导为正态VaR;关键利率DV01与类SIMM初始保证金340万美元;监管表格法(不计净额600万美元);初始保证金曲线;初始保证金对CVA与MVA(第99百分位时CVA从1.5万降到0.02万,而MVA为8.9万)。
- 9. 保证金的顺周期性。 由每日收益率得到的10年期国债10天99%保证金:EWMA在2020年3月从每100美元2.88升到6.59;循环;EMIR的工具(单独跳升×2.3,25%缓冲时×2.1,10年下限时×1.6,代价是平静时期多40%保证金);Kupiec回测(2,238天中28次例外,1.25%,p = 0.25;集中在2019和2020年)。
- 10. 中央清算。 更替;Duffie和Zhu(K = 2、4、8时,清算K类中的一类只有在交易商多于7、15、31家时才有帮助);瀑布;模拟清算所(大约每八个有违约的年份中有一个动用存活会员的基金);雷曼在LCH(66,390笔互换,9万亿美元,约用掉三分之一保证金)与Aas在纳斯达克清算所(超出抵押品1.14亿欧元;清算所自有资本700万欧元;1.66亿欧元基金中的1.07亿)。
- 11. 2022年3月:伦敦金属交易所的镍市场。 月度价格(IMF);3月4、7、8日每吨2.89万、4.81万、10.14万美元;一个假设的10万吨空头的变动保证金(19亿美元,然后53亿);暂停交易与取消交易;涨跌幅限制;高等法院(2023)与英国金融行为监管局920万英镑罚款(2025)。
- 12. 交易对手风险的资本。 为互换推导SA-CCR;净额集(单独8.1、净额4.8、有保证金1.4,单位为百万美元EAD);PFE乘数(价外一个附加值时0.61,下限5%);巴塞尔基本法CVA资本(这个净额集约58万美元;名称很多时每个名称的资本只降到一半);CVA资本与杠杆率。
- 13. 2021年3月:Archegos。 总收益互换;抛售;按清算期限计的保证金(对日波动4%的股票,20%只覆盖约0.65天成交量;Paul, Weiss报告所说仅在瑞信就有2.5–10天);抢先抛售(示意:损失20对40);公开记录。
- 14. 第21条规则:XVA交易台。 一张交易单(CVA、报告的DVA、FVA、KVA、MVA:客户约付105万美元);交易台的夜间流程;
xva模块;第21条规则;用本部分三个案例检验这条规则。 - 写给研究者:有限错向风险边界。 运输LP固定1500条敞口路径及120个月度违约桶加存活桶的边际。在确定性贴现下,独立值0.40百万、最大值1.81百万、最小值0。边界仅针对这个有限问题,静态耦合不一定适应或可由经济模型实现。Sinkhorn点按实际KL绘制;规范化成本后的惩罚路径并不求解所有指定熵预算。第四章平坦强度Copula及全路径强度联系示例的违约或路径边际不同,数值落在区间内不能证明边界包含关系;比较前必须匹配边际及成本。两路径题的实际演算答案为1、2、0。
- 回顾、交易台问题与习题。 十六行回顾;六个交易台问题;十二道习题(两道为资格考试水平),解答见下文。
Desk questions, with solutions交易台问题与解答
学习图将参数拟合简写:先由θ最小化经验平方损失,再使用参数θ对应的价值函数。习题5中恒定保证金风险期敞口公式适用于时滞窗口之后,即t ≥ m。
- 为什么银行信用变差时DVA上升,这种利润是真的吗? DVA是银行若先违约就不必偿还所欠款项的价值。信用变差使这种情况更可能,负债的价值下降,银行记录收益。会计准则(IFRS 13、ASC 820)要求这样做,但会计确认并不产生可自由支用的收入,实现、对冲及审慎资本处理取决于具体工具与适用规则(第3章)。
- 与同一交易对手的两笔相互抵消的互换:有无净额结算时的敞口? 有净额结算时为零:每条路径上价值都相互抵消。没有净额结算时是每笔互换正部之和:清算人会收取违约方赢的那笔,而把另一笔留给银行作为无担保债权(第1章)。
- 交易对手每天以现金缴纳保证金、门槛为零。你怎么还会亏损? 通过它最后一次付款与平仓之间的变动(风险保证金期,第2章),通过在已经变动的市场中重建对冲的成本,通过争议与转移门槛,以及通过与交易对手或敞口一起下跌的抵押品(错向,第2章与第4章)。
- 为什么保证金恰恰在现金稀缺时上升? 保证金模型随近期波动率缩放,而危机中波动率上升;所有有保证金的头寸同时被追加,现金靠卖出资产筹集,卖出又推高波动率(第9章)。缓冲、下限和更长的回看期能抑制这个循环,代价是平静时期更多的保证金。
- 在max(V, 0)处或在支付的跳跃处,反向扫描会出什么错? 在折点处它返回一侧的导数,几乎处处正确,平均而言无害。在跳跃处,逐路径导数几乎处处为零,完全遗漏了跳跃的贡献。可以平滑支付(用一个很窄的sigmoid代替阶跃),或用似然比或条件期望方法估计这些项(第6章)。
- 客户在单一股票互换上缴纳20%保证金。你最想知道什么? 它的头寸相对该股日成交量的大小,而且要合计所有交易商:这决定清算需要多久,从而决定保证金(第13章)。这很难看到,因为互换让股票留在交易商名下,每个交易商只看到自己那一份。
Problems, with worked solutions习题与解答
习题11中的M计全部运输列,包括存活状态。正文示例有120个违约桶,另有1个存活列。折点处逐路径求导须满足正则条件并能交换求导与期望,原子概率及不连续支付须另行处理。
-
远期的敞口。 对价值为\(V(t) = \sigma W_t\)的远期合约,证明\(\text{EE}(t) = \sigma\sqrt{t/(2\pi)}\)且\(\text{PFE}_{95}(t) = 1.645\,\sigma\sqrt t\)。
解答
V(t) = σW_t服从均值0、方差σ²t的正态分布,所以EE(t) = E[max(σW_t, 0)] = σ√t E[max(Z, 0)] = σ√t φ(0) = σ√(t/2π)。其第95百分位为1.645 σ√t,由于为正,PFE₉₅ = 1.645 σ√t。
-
互换的驼峰。 互换的EE大致为\(\sigma\sqrt t\,(T - t)\,c\)。它在哪个\(t\)最大?与第1章的驼峰比较。
解答
f(t) = √t (T − t),f′(t) = (T − t)/(2√t) − √t = 0时T − t = 2t,所以t = T/3:10年期互换为3.3年。第1章的曲线在月度网格上于第4年附近达到峰值,比T/3晚,因为票息按年支付,剩余付款是分级下降而不是平滑下降。
-
作为利差的CVA。 在风险率\(\lambda\)平坦且EE不变时,证明\(\text{CVA} \approx (1 - R)\,\lambda\,\text{EE}\int_0^T e^{-(r + \lambda)t}\,dt\),从而CVA作为持续价差约为\((1 - R)\lambda \times \text{EPE}/N\)。
解答
EE恒定、风险率λ和利率r为常数时,违约密度为λe^{−λt},所以CVA = (1 − R) EE ∫₀ᵀ e^{−rt} λ e^{−λt} dt = (1 − R) λ EE ∫₀ᵀ e^{−(r+λ)t} dt。除以名义本金N上的风险年金∫₀ᵀ e^{−(r+λ)t} dt,得到持续利差(1 − R) λ EE/N:把信用三角用在敞口上。
-
双边CVA。 证明违约独立时双边CVA为\((1 - R)\int \text{EE}(t) P(0,t) Q_b(t)\,(-dQ_c(t))\),并解释为什么它小于单边CVA。
解答
只有当银行自己尚未先违约时,交易对手在t时刻的违约才会让银行亏损。违约相互独立时,P(τ_c ∈ dt, τ_b > t) = Q_b(t)(−dQ_c(t)),所以CVA_bil = (1 − R) ∫ EE(t) P(0, t) Q_b(t)(−dQ_c(t))。由于处处Q_b(t) ≤ 1,它不大于单边CVA,只要银行可能违约就更小。
-
有抵押的敞口。 零门槛、保证金期为\(m\)的抵押:证明对\(V(t) = \sigma W_t\),有抵押的EE约为\(\sigma\sqrt{m/(2\pi)}\),与\(t\)无关。
解答
零门槛、风险保证金期为m时,t时刻的抵押品为V(t − m),敞口为max(σ(W_t − W_{t−m}), 0)。无论t为何,增量都服从方差为σ²m的正态分布,所以EE = σ√(m/2π),不随时间变化:取决于风险保证金期的平方根,而不是交易存续时间。
-
手算SA-CCR附加值。 计算1亿美元单笔10年期支付固定互换、无保证金(\(S = 0\),\(E = 10\))的SA-CCR附加项。
解答
监管久期为(e^{−0.05·0} − e^{−0.05·10})/0.05 = (1 − 0.607)/0.05 = 7.87,有效名义本金为100 × 7.87 = 787(一笔交易,在五年以上区间,期限因子为1)。附加值为0.5% × 787 = 393万美元;重置成本为零、乘数为1时,EAD = 1.4 × 3.93 = 550万美元:即第12章的"单独的10年期付固定"。
-
Cover 2。 一个CCP最大的两家会员在压力情景下会损失超出其保证金的30和25。Cover 2要求多大的违约基金?如果第三大会员也违约,谁来支付?
解答
在本题指定覆盖二要求下,资源覆盖两个最大合计压力敞口超出成员保证金的损失:30 + 25 = 55。若第三大会员也违约,先用它自己的保证金和基金份额,然后是清算所自有资本之后剩余的共同基金;再往后是按规则设上限的对存活会员的追加摊款,然后是诸如削减变动保证金收益之类的恢复工具。由存活会员承担。
-
AAD的成本。 为什么AAD能以几次估值的代价计算\(n\)个敏感度,而扰动法的代价是\(n\)次?它在内存上的代价是什么?
解答
反向模式把梯度作为向量–雅可比积来计算,对记录下的运算向后扫描一次;每个运算的伴随量只花费该运算本身的一个小常数倍,所以全部n个敏感度只花费几次估值,与n无关,而单侧扰动需要n + 1次估值。代价是内存:前向过程的每个中间值(每条路径、每个日期、每个运算)都要为反向过程保存,或从检查点重新计算。
-
何时清算一种产品有帮助。 有\(N\)个交易商和\(K\)个独立、相同的资产类别,证明清算其中一类降低一个交易商的期望敞口,当且仅当\(N > 1 + (\sqrt K + \sqrt{K - 1})^2\)。
解答
在双边情形下,交易商对N − 1个交易对手中每一个的敞口对K个方差为σ²的独立类别做净额,等于σ√K φ,φ = 1/√(2π),总量为(N − 1)σ√K φ。清算一类后,双边部分剩下(N − 1)σ√(K − 1)φ,并在清算所增加σ√(N − 1)φ,那一类在那里对全部N − 1个交易对手做净额。清算有帮助当且仅当(N − 1)(√K − √(K − 1)) > √(N − 1),即√(N − 1) > 1/(√K − √(K − 1)) = √K + √(K − 1),或N > 1 + (√K + √(K − 1))²:K = 2、4、8时分别为7、15、31家交易商。
-
手算KVA。 一笔交易在\(T\)年内需要资本\(K(t) = K_0(1 - t/T)\)。在门槛回报\(h\)、不贴现时,证明\(\text{KVA} = h K_0 T/2\)。
解答
KVA = h ∫₀ᵀ K₀(1 − t/T) dt = h K₀ [t − t²/(2T)]₀ᵀ = h K₀ T/2:门槛收益率乘以平均资本再乘以存续期。
-
(资格考试)运输问题。 (资格题)将\(N\)条敞口路径与\(M\)列状态(包括存活)的CVA耦合写成运输LP。证明边界在至多有\(N+M-1\)个正单元的顶点取得,并手算两路径例子。
解答
c_ij = (1 − R)D(t_j)V_i(t_j)⁺(生存时c = 0),CVA(p) = Σc_ij p_ij对p是线性的,可行集{p ≥ 0: Σ_j p_ij = 1/N, Σ_i p_ij = q_j}是运输多面体。线性函数在顶点处取最大和最小值,而N × M运输多面体的顶点至多有N + M − 1个正格子(其支撑是二部图中的森林)。两条路径(0和10,各½)、一个日期q = 0.2:独立给出0.2 × 5 = 1;最坏把全部0.2放在第二条路径上(因0.2 ≤ ½可行):2;最好放在第一条上:0。
-
(资格考试)熵解。 (资格题)设\(\theta>0\),证明固定边际下最大化\(\sum p_{ij}c_{ij}-\frac1\theta\mathrm{KL}(p\,\|\,p^\perp)\)得到\(p_{ij}=a_i b_j p^\perp_{ij}e^{\theta c_{ij}}\),并说明Sinkhorn交替缩放如何求\(a,b\)。
解答
设θ > 0且给定边际严格为正。 拉格朗日函数的一阶条件为c_ij − (1/θ)(log(p_ij/p⊥_ij) + 1) + α_i + β_j = 0,所以p_ij = a_i b_j p⊥_ij e^{θc_ij}。Sinkhorn交替进行a ← (1/N)/(Kb)、b ← q/(Kᵀa),K = p⊥e^{θc};每一步都是向一组边际的Bregman投影,迭代收敛到唯一解。
For the researcher写给研究者
- 定理。 格拉斯曼与Linan Yang(2018),Management Science 64(12);Cuturi(2013)与Sinkhorn(1964)论熵运输;Hull与White(2012);Brigo、Morini与Pallavicini(2013)的建模视角。
- 简化。 线性规划用1,500条路径的子样本;月度区间;耦合可以看整条路径(不只是过去的敞口),所以最坏情形比非预期的版本更大。
- 开放问题。 校准熵预算;尊重时间的耦合;取代α乘数。
Data, scope and reproducibility数据与复现
产品形状比较包含利率与外汇敞口的加权混合及平坦正期权价值代理,并非联合模拟的跨币种互换估值。CVA年化利差以一亿美元参考本金换算,而组合总名义本金为两亿美元。CDS强度自举使用平坦4%贴现假设,与指定日期的敞口曲线另行处理。
- FRED:DGS10(日度,2006–2025)、PNICKUSDM(IMF镍价,月度);美联储拟合的零息曲线(Gürkaynak、Sack和Wright),截至2025年12月31日;冻结并校验哈希。
- 引用而非计算的公开数字:各银行在Archegos上的损失;LCH与纳斯达克清算所的违约(国际清算银行);伦敦金属交易所的日价格、被取消的交易与金融行为监管局的罚款;摩根大通的FVA费用;Paul, Weiss报告的清算估计。
- 屏幕上标注为示意的输入:交易对手与银行的CDS曲线(80–170与40–85个基点)、融资利差、类SIMM风险权重、资本替代指标与门槛收益率、清算所的会员与压力情景、假设的镍头寸、类Archegos股票与抛售模型。
- 本部分不打开任何样本外数据;累计试验计数器保持317,全局23562。
Build the film
python -m videos.quant.quant21.compute # the part's numbers, into .cache/quant21
python tools/make.py quant21 # the narrated film, English and Chinese
EXPLAINER_TTS=silent python tools/qa_scene.py quant21 Hook # one chapter, silent, with a contact sheet
Scenes: videos/quant/quant21. Setup: see the course page. Source of these notes: the part's README and the scenes' narration.