TQBTHEQUANTBATEMAN
TQB/ learn/ rates/ yield curvesEN · DARK
Rates & curves · front-office

Curve construction and bootstrapping

Solving a dated system of market instruments with repricing residuals at every pillar

BY THE END, YOU CAN

01Map each market quote to its exact instrument cash flows and conventions.

02Bootstrap discount factors sequentially from deposits/OIS/futures/swaps.

03Diagnose quote repricing, pillar choice and interpolation dependence.

04Explain why a curve snapshot requires market data, conventions and construction policy together.

01
INTUITION

Separate the quote from the quantity inferred from it.

A bootstrap is a constrained inverse problem. Each liquid quote contributes an equation; the curve is accepted only when every calibration instrument reprices under the same conventions and interpolation policy.

01

Instrument quotes are equations, not curve nodes until cash flows are modelled.

02

Sequential solution works when each new helper introduces one new degree of freedom.

03

A tiny quote residual can coexist with unstable forwards, so repricing and shape diagnostics are both mandatory.

02
WHY MARKETS CARE

Start from executable inputs and conventions.

Discounting, forecasting, carry, hedging and every downstream model depend on a curve that converts heterogeneous market quotes into consistent dated prices.

INSTRUMENTS

overnight deposits and OIS

rate futures and FRAs

fixed-for-floating swaps

basis swaps

QUOTE CONVENTION

Store bid, ask, mid, timestamp, source, currency, index, tenor, settlement, day count, calendar, compounding and pillar rule with every helper.

03
MATHEMATICS

Transform quotes without losing units or arbitrage constraints.

Formula · Full derivation

Bootstrap equation

Vi(θ1,…,θi;qi)=0V_i(\theta_1,\ldots,\theta_i;q_i)=0

The i-th par instrument determines the next unknown curve node after earlier nodes are fixed.

Open in Analytics
Full derivation
Full derivation

Sequentially solving a par swap pillar

Assume earlier discount factors are known and isolate the final maturity discount factor from the newest par instrument.

  1. 01

    Write the par equation

    For an annual fixed-for-floating single-curve swap, fixed PV equals 1−P(0,T_n).

    K∑j=1nαjP(0,Tj)=1−P(0,Tn)K\sum_{j=1}^{n}\alpha_jP(0,T_j)=1-P(0,T_n)
  2. 02

    Separate known coupons

    All payment-date factors before T_n were solved by earlier helpers; leave the final factor as the only unknown.

    K∑j<nαjPj+KαnPn=1−PnK\sum_{j<n}\alpha_jP_j+K\alpha_nP_n=1-P_n
  3. 03

    Solve the new node

    Collect P_n and divide by its positive coefficient.

    Pn=1−K∑j<nαjPj1+KαnP_n=\frac{1-K\sum_{j<n}\alpha_jP_j}{1+K\alpha_n}
  4. 04

    Insert and reprice

    Add the node to the curve, rebuild the instrument and compute its quote residual using the final interpolation.

  5. 05

    Inspect the implied forwards

    Compute adjacent forwards and key-rate sensitivities; reject local spikes or negative accumulations that the quote residual alone cannot reveal.

A production curve is a reproducible construction policy with instrument-level repricing and shape diagnostics, not an interpolated list of displayed rates.

Inputs
  • q_i: i-th market quote
  • \theta_i: i-th curve node
  • V_i(\theta): model PV
  • \varepsilon_i: quote repricing residual
Assumptions and limits
  • The closed-form swap step is educational and single-curve.
  • Global and sequential fits can differ under inconsistent or noisy quotes.
  • Exact repricing does not guarantee stable off-grid forwards or hedge ratios.
Formula · Definition

Repricing residual

εi=qimodel(θ)−qimarket\varepsilon_i=q_i^{model}(\theta)-q_i^{market}

Residuals must be reported in the market quote’s native unit and compared with tolerance or spread.

Open in Analytics
Formula · Full derivation

Curve objective for global fits

min⁡θ∑iwiεi2+λ R(θ)\min_{\theta}\sum_i w_i\varepsilon_i^2+\lambda\,\mathcal R(\theta)

A global fit can trade exact repricing for stability through weights and regularisation; that trade-off must be explicit.

Open in Analytics
05
MODEL / PRICING

Invert, fit, and reprice the market instruments.

METHOD

Order helpers by pillar, solve each unknown in discount or log-discount space, rebuild all instruments, and expose zero, forward, discount and risk views from one curve object.

CALIBRATION

Use bid/ask-aware tolerances, deterministic pillar dates, documented interpolation and fallback rules. Retain both input quote and solved node lineage.

Implementation with current QuantLib

Compose instrument-specific RateHelpers into PiecewiseYieldCurve with explicit traits and interpolation. Preserve helper impliedQuote/error diagnostics, pillar choices and observer lifecycle; current upstream tests are the API authority.

API authority: upstream QuantLib reference pinned in the source registry.
06PYTHON IMPLEMENTATIONOpen the implementation and checks.
ARCHITECTURE
  • Keep market conventions and quote lineage at the boundary.
  • Solve curves and dynamics in framework-free deterministic kernels.
  • Return residuals, state and sensitivities with every value.
  • Test analytical limits, reconstruction identities and failure domains.
PYTHON 3 · NUMPY / SCIPY

Sequential par-swap discount bootstrap

Solve final discount factors and verify every par equation.

REUSABLE EXAMPLE
01from __future__ import annotations
02
03import math
04
05def bootstrap_annual_swaps(par_rates: list[float]) -> list[float]:
06 discounts: list[float] = []
07 for rate in par_rates:
08 if not math.isfinite(rate):
09 raise ValueError("finite quote required")
10 known_annuity = sum(discounts)
11 final_discount = (1.0 - rate * known_annuity) / (1.0 + rate)
12 if final_discount <= 0:
13 raise ValueError("inconsistent quote set")
14 discounts.append(final_discount)
15 return discounts
16
17quotes = [0.0300, 0.0320, 0.0340, 0.0350, 0.0360]
18df = bootstrap_annual_swaps(quotes)
19for maturity, (rate, terminal) in enumerate(zip(quotes, df), start=1):
20 fixed = rate * sum(df[:maturity])
21 floating = 1.0 - terminal
22 assert abs(fixed - floating) < 1e-12
23print([round(x, 8) for x in df])
EXPECTED OUTPUTA positive, decreasing discount-factor vector with zero par-swap residuals.
SANITY CHECKS

✓ Every quote is finite.

✓ Every solved factor is positive.

✓ All calibration swaps reprice after the final node is added.

07
INTERACTIVE LAB

One curve, four linked diagnostics.

FLAGSHIP CURVE CONSTRUCTION WORKBENCH

One curve, four linked diagnostics

Synthetic educational nodes · continuous zero rates · ACT/365-like clock

DATA MODESYNTHETIC · REPRODUCIBLE
5Y PAR3.856%
10Y DISCOUNT0.666977
MAX FORWARD MOVE0.0 bp
QUOTE RESIDUAL< 0.01 bp
LINKED CURVE VIEWZERO · BASE
Annualised rate by Maturity (years)

zero curve diagnostic under the base scenario.

  • base zero
  • shocked zero
Maturity (years): 0.1Y. base zero: 3.100%. shocked zero: 3.100%.

Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.

View chart data
Annualised rate by Maturity (years)
Maturity (years)base zeroshocked zero
0.1Y3.100%3.100%
0.3Y3.121%3.121%
0.6Y3.211%3.211%
0.8Y3.261%3.261%
1.1Y3.309%3.309%
1.3Y3.346%3.346%
1.6Y3.384%3.384%
1.8Y3.422%3.422%
2.1Y3.460%3.460%
2.3Y3.497%3.497%
2.6Y3.535%3.535%
2.8Y3.573%3.573%
3.1Y3.607%3.607%
3.3Y3.632%3.632%
3.6Y3.657%3.657%
3.8Y3.683%3.683%
4.1Y3.708%3.708%
4.3Y3.733%3.733%
4.6Y3.758%3.758%
4.8Y3.783%3.783%
5.1Y3.804%3.804%
5.3Y3.817%3.817%
5.6Y3.829%3.829%
5.8Y3.842%3.842%
6.1Y3.855%3.855%
6.3Y3.867%3.867%
6.6Y3.880%3.880%
6.8Y3.892%3.892%
7.1Y3.905%3.905%
7.3Y3.917%3.917%
7.6Y3.930%3.930%
7.9Y3.943%3.943%
8.1Y3.955%3.955%
8.4Y3.968%3.968%
8.6Y3.980%3.980%
8.9Y3.993%3.993%
9.1Y4.006%4.006%
9.4Y4.018%4.018%
9.6Y4.031%4.031%
9.9Y4.043%4.043%
10.1Y4.052%4.052%
10.4Y4.057%4.057%
10.6Y4.062%4.062%
10.9Y4.067%4.067%
11.1Y4.072%4.072%
11.4Y4.078%4.078%
11.6Y4.083%4.083%
11.9Y4.088%4.088%
12.1Y4.093%4.093%
12.4Y4.098%4.098%
12.6Y4.103%4.103%
12.9Y4.108%4.108%
13.1Y4.113%4.113%
13.4Y4.118%4.118%
13.6Y4.123%4.123%
13.9Y4.128%4.128%
14.1Y4.133%4.133%
14.4Y4.138%4.138%
14.6Y4.143%4.143%
14.9Y4.148%4.148%
15.2Y4.152%4.152%
15.4Y4.154%4.154%
15.7Y4.157%4.157%
15.9Y4.159%4.159%
16.2Y4.162%4.162%
16.4Y4.164%4.164%
16.7Y4.167%4.167%
16.9Y4.169%4.169%
17.2Y4.172%4.172%
17.4Y4.174%4.174%
17.7Y4.177%4.177%
17.9Y4.179%4.179%
18.2Y4.182%4.182%
18.4Y4.184%4.184%
18.7Y4.187%4.187%
18.9Y4.189%4.189%
19.2Y4.192%4.192%
19.4Y4.194%4.194%
19.7Y4.197%4.197%
19.9Y4.199%4.199%
20.2Y4.200%4.200%
20.4Y4.201%4.201%
20.7Y4.201%4.201%
20.9Y4.202%4.202%
21.2Y4.202%4.202%
21.4Y4.203%4.203%
21.7Y4.203%4.203%
21.9Y4.204%4.204%
22.2Y4.204%4.204%
22.4Y4.205%4.205%
22.7Y4.205%4.205%
23.0Y4.206%4.206%
23.2Y4.206%4.206%
23.5Y4.207%4.207%
23.7Y4.207%4.207%
24.0Y4.208%4.208%
24.2Y4.208%4.208%
24.5Y4.209%4.209%
24.7Y4.209%4.209%
25.0Y4.210%4.210%
25.2Y4.210%4.210%
25.5Y4.211%4.211%
25.7Y4.211%4.211%
26.0Y4.212%4.212%
26.2Y4.212%4.212%
26.5Y4.213%4.213%
26.7Y4.213%4.213%
27.0Y4.214%4.214%
27.2Y4.214%4.214%
27.5Y4.215%4.215%
27.7Y4.215%4.215%
28.0Y4.216%4.216%
28.2Y4.216%4.216%
28.5Y4.217%4.217%
28.7Y4.217%4.217%
29.0Y4.218%4.218%
29.2Y4.218%4.218%
29.5Y4.219%4.219%
29.7Y4.219%4.219%
30.0Y4.220%4.220%
READ THE DIAGNOSTIC

A curve shock updates zero rates, discount factors, interval forwards and quote-space risk from one state. Use pointer, touch or keyboard for exact values.

08
FRONT OFFICE

Where the model meets the book.

ON THE DESK
“If a quote cannot be traced to a helper, convention, pillar and residual, it is not a curve input—it is a loose number.”
VISIBLE INPUTS

timestamped bid/ask quotes

instrument conventions

pillar policy

interpolation/extrapolation

tolerances and fallback

CALIBRATION

Bootstrap in dependency order, reprice every helper after construction and compare residuals with bid/offer and desk tolerances.

RISK

pillar/key-rate DV01

instrument basis

interpolation risk

stale-quote risk

DAILY WORKFLOW
  1. freeze market snapshot
  2. validate helper set
  3. solve nodes
  4. reprice all helpers
  5. inspect forwards and risk
Production failure modes
  • duplicate pillar
  • missing short-end anchor
  • mixed calendars
  • curve rebuilt from partially updated quotes
09MACRO CONNECTIONOpen the transmission channel.
MACRO CONNECTION

Market instruments into a policy and term-premium curve

Macro expectations arrive through different liquid instruments by tenor; the bootstrap converts their quotes into one dated pricing representation.

01Macro repricingtransmits

moves deposits, futures and swaps

02Helper equationstransmits

translate quotes into cash-flow constraints

03Curve nodestransmits

solve dated discount prices

04Portfolio riskoutput

maps exposure back to liquid hedges

10COMMON PITFALLSOpen the failure checklist.
01

Treating quoted swap rates as continuous zero rates.

02

Checking only node monotonicity and not helper repricing.

03

Changing interpolation without rerunning risk and validation.

04

Using asynchronous quote timestamps as one coherent market snapshot.

11SOURCES / FURTHER READINGOpen sources and continue the track.
research

Curve construction, multi-curve, short-rate and HJM lectures

Research map for term-structure theory and numerical experiments; all platform explanations and code are original.

Source
Financial Engineering: Interest Rates & xVA
Author
L. A. Grzelak
Ref
main
OPEN ORIGINAL SOURCE ↗
research

Monte Carlo, stochastic calculus and calibration lectures

Mathematical and numerical cross-reference for model dynamics and diagnostics.

Source
Computational Finance Course
Author
L. A. Grzelak
Ref
main
OPEN ORIGINAL SOURCE ↗
implementation reference

Current bootstrapping, interpolation, curve, model, cap/floor and swaption tests

Implementation authority for production object boundaries and regression-test patterns.

Source
QuantLib upstream
Author
QuantLib contributors
Ref
v1.42.1
OPEN ORIGINAL SOURCE ↗