Credit Course

CDS Term Structure: Bootstrapping the Survival Curve

Calibrate a piecewise-constant hazard rate model to the CDS term structure and compute forward spreads.

Intermediate – Advanced~9 hours9 lessonsUpdated May 2026

Enrol now

$139one-time payment
  • Lifetime access — all lessons & updates
  • 9 lessons across 2 structured parts
  • Fully worked Jupyter notebooks
  • Market datasets + published benchmark prices
  • Free lesson previews before you buy
  • 14-day money-back guarantee

Secured by a no-questions-asked 14-day refund.

Overview

Introduction

A flat hazard rate is a useful teaching device, but it is not how the market prices credit risk. Observed CDS spreads vary by maturity — a 1Y CDS and a 10Y CDS on the same issuer almost never imply the same hazard rate — and any serious credit analytics system must respect that term structure. This course shows you how to calibrate a piecewise-constant hazard rate model to the full CDS curve using the same sequential bootstrap that underlies industry standard tools.

The bootstrap algorithm is elegant: solve for the hazard rate in the first pillar by requiring that the 1Y CDS NPV is zero at the quoted spread, then lock it in and solve for the next pillar against the 2Y CDS quote, and so on out to 10Y. Each step is a single one-dimensional root-finding problem, and the result is a survival curve that is internally consistent with every quoted CDS maturity. The course derives the algorithm from the CDS pricing equations you already know and implements it cleanly in Python.

Beyond bootstrapping, the course covers the quantities that practitioners use every day: forward CDS spreads (the spread on a CDS starting in the future), default probability densities, expected losses, and scenario analysis under parallel curve shifts. It also covers the mark-to-market of seasoned trades against the new curve — the calculation that hits your P&L every time the curve moves. By the end you have a complete, production-grade survival curve engine.

Hands-on

The project you'll build

You begin with a CDS term structure — par spreads quoted at 1Y, 2Y, 3Y, 5Y, 7Y and 10Y — and a SOFR-based risk-free curve. The first stage is to verify the flat-hazard-rate case: using the credit triangle, confirm that the single constant hazard rate implied by each maturity differs across the curve, demonstrating why a term structure model is necessary.

The main stage is the sequential bootstrap. You implement a root-finder loop that processes each CDS maturity in order: given all previously calibrated hazard rates (which are now fixed), solve for the hazard rate in the current interval such that the full CDS NPV — protection leg minus premium leg, using the exact integral pricing from the CDS pricing course — is zero at the quoted par spread. You bootstrap all six pillars and store the resulting piecewise-constant λ(t) curve.

In the final stage you use the bootstrapped survival curve to compute forward CDS spreads (the break-even spread on a forward-starting CDS), the default probability density q(t), and expected loss EL(T) as a function of horizon. You then stress the curve with a parallel spread shift, reprice a seasoned CDS trade, and compute the P&L impact. The completed engine is wrapped into a reusable Python class with a clean API for pricing and scenario analysis.

Outcomes

What you'll learn

Term structure motivation

Demonstrate why a flat hazard rate is inconsistent with a non-flat CDS curve and quantify the pricing error it introduces for off-pillar maturities.

Piecewise-constant hazard rate model

Specify and implement the piecewise-constant λ(t) model, mapping each pillar interval to a constant hazard rate.

Sequential bootstrap algorithm

Implement the CDS bootstrap: calibrate each hazard rate interval sequentially by solving NPV = 0 at the matching CDS maturity.

Default probability density

Derive and compute the instantaneous default probability density q(t) from the bootstrapped survival curve and verify that it integrates to the correct cumulative default probability.

Expected loss calculation

Compute EL(T) — the expected present value of losses up to horizon T — as a function of the survival curve and the recovery rate assumption.

Forward CDS spread

Derive and compute the fair spread on a forward-starting CDS using the bootstrapped hazard rates, understanding the relationship to the forward survival probability.

Seasoned CDS mark-to-market

Value a seasoned CDS trade against the bootstrapped curve, computing the full mark-to-market P&L correctly for a trade with a non-market coupon.

Parallel shift scenario analysis

Re-bootstrap the curve under a parallel spread shift, reprice the portfolio and attribute P&L to each pillar interval's contribution.

Stack

Tools & technology

The course teaches a workflow, not just a toolset — here is what we use and what you could swap in.

ToolUsed forAlternatives
Python 3Bootstrap algorithm, survival curve engine and all scenario analyticsJulia, MATLAB, C++
NumPyPiecewise-constant hazard rate arrays, survival probability computation and EL integralsPure Python, JAX
SciPyBrent's method for the per-pillar root-finding step in the bootstrap and numerical integration for the protection legNewton-Raphson implemented from scratch, Simpson rule quadrature
pandasCDS input term structure tables, bootstrapped curve output and scenario P&L attributionNumPy structured arrays, polars
MatplotlibSurvival curve plots, hazard rate step functions, forward spread curves and P&L attribution chartsPlotly, seaborn
JupyterNotebook-driven development — each bootstrap step shown alongside the derivationVS Code, plain .py scripts

Syllabus

Course curriculum

9 lessons across 2 parts. Lessons marked Free preview can be read before you enrol.

Before you start

Prerequisites

  • Credit Default Swaps — Pricing from First Principles (or equivalent): CDS protection and premium leg pricing, par spread, RPVBP, and the ISDA upfront convention.
  • Government Bond Analytics or Yield Curve Bootstrapping (or equivalent): familiarity with curve bootstrapping concepts from the rates world.
  • Comfortable with Python, NumPy and SciPy; the bootstrap algorithm makes intensive use of numerical root-finding.
  • Basic calculus: the protection-leg integral involves differentiating the survival function to obtain the default density — the derivation is shown step by step.

Fit

Who this course is for

Credit derivatives quants

You price and risk CDS and want to own the full survival curve construction, rather than relying on a library you cannot inspect or modify.

Credit risk analysts

You work with credit term structures in a bank or asset manager context and want to understand the calibration algorithm well enough to audit it, extend it, or rebuild it when needed.

Quant candidates in credit

You are interviewing for a credit quant or model validation role and need to be able to derive and implement the full bootstrap algorithm from a set of par CDS spreads.

Quant-finance students

You have covered CDS pricing with a flat hazard rate and want to take the natural next step to a full term-structure model — the jump from flat to piecewise-constant is where the real world begins.

Faculty

Your instructor

QuantIndex Faculty

QuantIndex Faculty are practising quantitative analysts with hands-on experience in credit curve construction and CDS model validation at major financial institutions. This course was written by quants who have built, maintained and stress-tested survival curve engines in production — where bootstrap stability and ISDA convention compliance are hard requirements — and reviewed for mathematical rigour and code correctness before publication.

Benchmarked & verified

Every price you compute is checked against published results from leading textbooks and market data. You do not finish the course hoping your model is right — you finish it knowing.

Questions

Frequently asked questions

Why piecewise-constant hazard rates rather than a smooth interpolation?

Piecewise-constant is the ISDA standard model convention and is used by virtually every major dealer system for CDS curve construction. It guarantees that the bootstrap is exact — the calibrated curve re-prices every input CDS to zero NPV by construction. Smooth interpolation (e.g., cubic spline on log-survival) can produce a more aesthetically pleasing curve but introduces interpolation error at the pillar maturities and is less transparent for model validation.

What happens between the quoted CDS pillar maturities?

The piecewise-constant model holds the hazard rate constant within each interval between pillars, so the survival curve is a continuous but kinked exponential. Off-pillar CDS (e.g., a 4Y trade) are priced using the calibrated λ values from the 3Y and 5Y intervals. The course covers off-pillar interpolation and discusses when the flat-hazard-within-interval assumption is a material approximation.

How does this compare to QuantLib's CDS bootstrapper?

QuantLib's PiecewiseFlatHazardRate engine implements the same algorithm — and if you have taken this course, you will be able to read and understand its source code. The pedagogical value of building it yourself is that you understand every assumption, every numerical tolerance, and every edge case. That understanding is what lets you extend the model, debug it under stress, or adapt it to non-standard CDS structures.

What do forward CDS spreads tell you in practice?

A forward CDS spread is the break-even spread on a CDS that starts at some future date — for example, the 1Y CDS starting in 2 years. It is the credit market's analogue of the forward interest rate. Forward spreads are used to price contingent credit products, to detect relative-value opportunities in the term structure (a humped forward curve often signals a market view of near-term stress followed by recovery), and to mark forward-starting CDS trades.

How does scenario analysis work for a non-flat CDS curve shift?

The course focuses on parallel shifts — every pillar spread moves by the same amount — which is the most common scenario used in credit VaR. Non-parallel shifts (e.g., a steepener or a credit event that affects short-end spreads only) require re-bootstrapping with the stressed input spreads, which the course's engine supports directly. The CS01 term structure computed in the CDS pricing course maps naturally onto pillar-level scenario analysis.

Is there a refund policy?

Yes — a 14-day, no-questions-asked money-back guarantee. If the course is not right for you, contact us within 14 days of purchase and we will refund you in full.

Ready to start?

$139one-time payment
  • Lifetime access — all lessons & updates
  • 9 lessons across 2 structured parts
  • Fully worked Jupyter notebooks
  • Market datasets + published benchmark prices
  • Free lesson previews before you buy
  • 14-day money-back guarantee

Secured by a no-questions-asked 14-day refund.