Curve construction and bootstrapping
Solving a dated system of market instruments with repricing residuals at every pillar
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.
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.
Instrument quotes are equations, not curve nodes until cash flows are modelled.
Sequential solution works when each new helper introduces one new degree of freedom.
A tiny quote residual can coexist with unstable forwards, so repricing and shape diagnostics are both mandatory.
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.
overnight deposits and OIS
rate futures and FRAs
fixed-for-floating swaps
basis swaps
Store bid, ask, mid, timestamp, source, currency, index, tenor, settlement, day count, calendar, compounding and pillar rule with every helper.
Transform quotes without losing units or arbitrage constraints.
Bootstrap equation
The i-th par instrument determines the next unknown curve node after earlier nodes are fixed.
Open in AnalyticsFull 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.
- 01
Write the par equation
For an annual fixed-for-floating single-curve swap, fixed PV equals 1−P(0,T_n).
- 02
Separate known coupons
All payment-date factors before T_n were solved by earlier helpers; leave the final factor as the only unknown.
- 03
Solve the new node
Collect P_n and divide by its positive coefficient.
- 04
Insert and reprice
Add the node to the curve, rebuild the instrument and compute its quote residual using the final interpolation.
- 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 nodeV_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.
Repricing residual
Residuals must be reported in the market quote’s native unit and compared with tolerance or spread.
Open in AnalyticsCurve objective for global fits
A global fit can trade exact repricing for stability through weights and regularisation; that trade-off must be explicit.
Open in AnalyticsInvert, fit, and reprice the market instruments.
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.
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.
- 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.
Sequential par-swap discount bootstrap
Solve final discount factors and verify every par equation.
from __future__ import annotations import math def bootstrap_annual_swaps(par_rates: list[float]) -> list[float]: discounts: list[float] = [] for rate in par_rates: if not math.isfinite(rate): raise ValueError("finite quote required") known_annuity = sum(discounts) final_discount = (1.0 - rate * known_annuity) / (1.0 + rate) if final_discount <= 0: raise ValueError("inconsistent quote set") discounts.append(final_discount) return discounts quotes = [0.0300, 0.0320, 0.0340, 0.0350, 0.0360]df = bootstrap_annual_swaps(quotes)for maturity, (rate, terminal) in enumerate(zip(quotes, df), start=1): fixed = rate * sum(df[:maturity]) floating = 1.0 - terminal assert abs(fixed - floating) < 1e-12print([round(x, 8) for x in df])One curve, four linked diagnostics.
One curve, four linked diagnostics
Synthetic educational nodes · continuous zero rates · ACT/365-like clock
zero curve diagnostic under the base scenario.
- base zero
- shocked zero
Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.
View chart data
| Maturity (years) | base zero | shocked zero |
|---|---|---|
| 0.1Y | 3.100% | 3.100% |
| 0.3Y | 3.121% | 3.121% |
| 0.6Y | 3.211% | 3.211% |
| 0.8Y | 3.261% | 3.261% |
| 1.1Y | 3.309% | 3.309% |
| 1.3Y | 3.346% | 3.346% |
| 1.6Y | 3.384% | 3.384% |
| 1.8Y | 3.422% | 3.422% |
| 2.1Y | 3.460% | 3.460% |
| 2.3Y | 3.497% | 3.497% |
| 2.6Y | 3.535% | 3.535% |
| 2.8Y | 3.573% | 3.573% |
| 3.1Y | 3.607% | 3.607% |
| 3.3Y | 3.632% | 3.632% |
| 3.6Y | 3.657% | 3.657% |
| 3.8Y | 3.683% | 3.683% |
| 4.1Y | 3.708% | 3.708% |
| 4.3Y | 3.733% | 3.733% |
| 4.6Y | 3.758% | 3.758% |
| 4.8Y | 3.783% | 3.783% |
| 5.1Y | 3.804% | 3.804% |
| 5.3Y | 3.817% | 3.817% |
| 5.6Y | 3.829% | 3.829% |
| 5.8Y | 3.842% | 3.842% |
| 6.1Y | 3.855% | 3.855% |
| 6.3Y | 3.867% | 3.867% |
| 6.6Y | 3.880% | 3.880% |
| 6.8Y | 3.892% | 3.892% |
| 7.1Y | 3.905% | 3.905% |
| 7.3Y | 3.917% | 3.917% |
| 7.6Y | 3.930% | 3.930% |
| 7.9Y | 3.943% | 3.943% |
| 8.1Y | 3.955% | 3.955% |
| 8.4Y | 3.968% | 3.968% |
| 8.6Y | 3.980% | 3.980% |
| 8.9Y | 3.993% | 3.993% |
| 9.1Y | 4.006% | 4.006% |
| 9.4Y | 4.018% | 4.018% |
| 9.6Y | 4.031% | 4.031% |
| 9.9Y | 4.043% | 4.043% |
| 10.1Y | 4.052% | 4.052% |
| 10.4Y | 4.057% | 4.057% |
| 10.6Y | 4.062% | 4.062% |
| 10.9Y | 4.067% | 4.067% |
| 11.1Y | 4.072% | 4.072% |
| 11.4Y | 4.078% | 4.078% |
| 11.6Y | 4.083% | 4.083% |
| 11.9Y | 4.088% | 4.088% |
| 12.1Y | 4.093% | 4.093% |
| 12.4Y | 4.098% | 4.098% |
| 12.6Y | 4.103% | 4.103% |
| 12.9Y | 4.108% | 4.108% |
| 13.1Y | 4.113% | 4.113% |
| 13.4Y | 4.118% | 4.118% |
| 13.6Y | 4.123% | 4.123% |
| 13.9Y | 4.128% | 4.128% |
| 14.1Y | 4.133% | 4.133% |
| 14.4Y | 4.138% | 4.138% |
| 14.6Y | 4.143% | 4.143% |
| 14.9Y | 4.148% | 4.148% |
| 15.2Y | 4.152% | 4.152% |
| 15.4Y | 4.154% | 4.154% |
| 15.7Y | 4.157% | 4.157% |
| 15.9Y | 4.159% | 4.159% |
| 16.2Y | 4.162% | 4.162% |
| 16.4Y | 4.164% | 4.164% |
| 16.7Y | 4.167% | 4.167% |
| 16.9Y | 4.169% | 4.169% |
| 17.2Y | 4.172% | 4.172% |
| 17.4Y | 4.174% | 4.174% |
| 17.7Y | 4.177% | 4.177% |
| 17.9Y | 4.179% | 4.179% |
| 18.2Y | 4.182% | 4.182% |
| 18.4Y | 4.184% | 4.184% |
| 18.7Y | 4.187% | 4.187% |
| 18.9Y | 4.189% | 4.189% |
| 19.2Y | 4.192% | 4.192% |
| 19.4Y | 4.194% | 4.194% |
| 19.7Y | 4.197% | 4.197% |
| 19.9Y | 4.199% | 4.199% |
| 20.2Y | 4.200% | 4.200% |
| 20.4Y | 4.201% | 4.201% |
| 20.7Y | 4.201% | 4.201% |
| 20.9Y | 4.202% | 4.202% |
| 21.2Y | 4.202% | 4.202% |
| 21.4Y | 4.203% | 4.203% |
| 21.7Y | 4.203% | 4.203% |
| 21.9Y | 4.204% | 4.204% |
| 22.2Y | 4.204% | 4.204% |
| 22.4Y | 4.205% | 4.205% |
| 22.7Y | 4.205% | 4.205% |
| 23.0Y | 4.206% | 4.206% |
| 23.2Y | 4.206% | 4.206% |
| 23.5Y | 4.207% | 4.207% |
| 23.7Y | 4.207% | 4.207% |
| 24.0Y | 4.208% | 4.208% |
| 24.2Y | 4.208% | 4.208% |
| 24.5Y | 4.209% | 4.209% |
| 24.7Y | 4.209% | 4.209% |
| 25.0Y | 4.210% | 4.210% |
| 25.2Y | 4.210% | 4.210% |
| 25.5Y | 4.211% | 4.211% |
| 25.7Y | 4.211% | 4.211% |
| 26.0Y | 4.212% | 4.212% |
| 26.2Y | 4.212% | 4.212% |
| 26.5Y | 4.213% | 4.213% |
| 26.7Y | 4.213% | 4.213% |
| 27.0Y | 4.214% | 4.214% |
| 27.2Y | 4.214% | 4.214% |
| 27.5Y | 4.215% | 4.215% |
| 27.7Y | 4.215% | 4.215% |
| 28.0Y | 4.216% | 4.216% |
| 28.2Y | 4.216% | 4.216% |
| 28.5Y | 4.217% | 4.217% |
| 28.7Y | 4.217% | 4.217% |
| 29.0Y | 4.218% | 4.218% |
| 29.2Y | 4.218% | 4.218% |
| 29.5Y | 4.219% | 4.219% |
| 29.7Y | 4.219% | 4.219% |
| 30.0Y | 4.220% | 4.220% |
Where the model meets the book.
“If a quote cannot be traced to a helper, convention, pillar and residual, it is not a curve input—it is a loose number.”
timestamped bid/ask quotes
instrument conventions
pillar policy
interpolation/extrapolation
tolerances and fallback
Bootstrap in dependency order, reprice every helper after construction and compare residuals with bid/offer and desk tolerances.
RISKpillar/key-rate DV01
instrument basis
interpolation risk
stale-quote risk
- freeze market snapshot
- validate helper set
- solve nodes
- reprice all helpers
- 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.
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.
transmitsmoves deposits, futures and swaps
transmitstranslate quotes into cash-flow constraints
transmitssolve dated discount prices
outputmaps exposure back to liquid hedges
10COMMON PITFALLSOpen the failure checklist.
Treating quoted swap rates as continuous zero rates.
Checking only node monotonicity and not helper repricing.
Changing interpolation without rerunning risk and validation.
Using asynchronous quote timestamps as one coherent market snapshot.
11SOURCES / FURTHER READINGOpen sources and continue the track.
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
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
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