Interest-rate swaps
Turning a strip of forwards and discount factors into par coupon, PV and curve risk
01Derive fixed- and floating-leg present values.
02Compute the par swap rate as floating PV divided by fixed annuity.
03Explain payer/receiver sign and clean/dirty PV.
04Map swap value to discount and projection curves.
Read the cash-flow timeline first.
A vanilla swap exchanges a fixed coupon schedule for a floating index schedule. The fixed leg is a discounted annuity; the floating leg is projected from forward fixings and discounted on the collateral curve.
Par rate is a ratio, not an average of forwards.
In a single-curve spot-starting idealisation the floating leg telescopes; multi-curve projection generally does not.
Payer-fixed gains when par rates rise, but bucketed curve moves determine actual P&L.
Start from cash flows and quotation.
Swaps are core instruments for duration transfer, curve construction, corporate hedging, asset-liability management and macro expression.
fixed-for-floating swaps
forward-start swaps
asset swaps
swap spreads
State currency, index, effective/maturity dates, fixed frequency and basis, floating basis, payment lags, collateral and payer/receiver direction.
Value each dated cash flow under explicit conventions.
Fixed-leg annuity
Present value of one unit of fixed coupon paid on the schedule.
Open in AnalyticsMulti-curve par rate
Projected floating coupons are discounted on the collateral curve and divided by the fixed annuity.
Open in AnalyticsShort derivation
Balancing fixed and floating legs at par
Price both legs independently on their dated schedules, then solve the zero-PV coupon.
- 01
Build the fixed annuity
Multiply each fixed accrual by its payment-date discount factor and sum.
- 02
Project floating coupons
For each floating period, project the index fixing from its forwarding curve and multiply by accrual, notional and discount factor.
- 03
Solve the par condition
Set NK A(0)=PV_flt and divide by N A(0).
- 04
Value an off-market trade
Subtract the current par-equivalent leg from the contractual fixed leg using the chosen receiver/payer sign.
Swap PV is the discounted difference between one contractual coupon and the curve-implied par coupon on exact schedules.
Inputs
A(0): fixed-leg annuityK: contractual fixed rateS(0): par swap rateF_i: projected floating fixing
Assumptions and limits
- The compact telescoping floating-leg formula is not generally multi-curve.
- Credit, funding and collateral optionality are omitted.
- Linear DV01 misses large-move convexity and curve-shape interaction.
Receiver-fixed PV
The compact identity holds once S is computed on the same schedules and curves.
Open in AnalyticsBuild, calibrate, and reprice the contract.
Generate both schedules, project each floating coupon, discount every payment, compute par coupon and return leg-level PV plus bucketed sensitivities.
Use swaps as bootstrap helpers only after short-end instruments and conventions are fixed. Every input quote should reprice within its market tolerance.
Implementation with current QuantLib
Use VanillaSwap with separate forwarding and discounting handles, explicit Schedules and a DiscountingSwapEngine. Inspect leg NPVs and cash flows rather than accepting only the net NPV.
API authority: upstream QuantLib reference pinned in the source registry.06PYTHON IMPLEMENTATIONOpen the implementation and checks.
- Parse dated market inputs and conventions at the boundary.
- Build deterministic curve objects in the framework-free quant layer.
- Return PV, repricing residuals and sensitivities together.
- Test inversion, par conditions, monotonic dates and invalid domains.
Par coupon and receiver-fixed PV
Compute annuity, par rate and verify zero PV at inception.
from __future__ import annotations import math times = [1., 2., 3., 4., 5.]rate = 0.04discounts = [math.exp(-rate*t) for t in times]annuity = sum(discounts)par = (1.0 - discounts[-1]) / annuityreceiver_pv = 10_000_000.0 * annuity * (par - par)assert abs(receiver_pv) < 1e-10assert abs(par - (math.exp(rate) - 1.0)) < 1e-12print(f"annuity={annuity:.8f} | par={par:.6%}")Move the state. Challenge the equation.
Swap par/PV laboratory
Change level, slope and fixed coupon; inspect fixed annuity, floating PV, par rate and payer/receiver P&L.
Base: Gently upward par curve.
- par swap
- 4.00% fixed coupon
Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.
Follow the trade through risk and lifecycle events.
“A swap is one headline rate wrapped around two schedules and two curve roles.”
fixed/floating schedules
projection curve
discount curve
notional and coupon
payer/receiver direction
Use swaps as bootstrap helpers only after short-end instruments and conventions are fixed. Every input quote should reprice within its market tolerance.
RISKdiscount DV01
forward DV01
curve spread
fixing and carry
- build schedules
- project float
- discount legs
- solve par/PV
- bucket and reconcile risk
Production failure modes
- payer/receiver sign
- wrong index tenor
- schedule mismatch
- using par formula with inconsistent curves
09MACRO CONNECTIONOpen the transmission channel.
Swap curves and the policy/term-premium split
Front-end swaps react to the policy path, while longer maturities combine expected short rates, inflation risk, supply and term premium.
transmitschanges policy and inflation expectations
transmitsmoves projected coupons
transmitsbalances discounted legs
outputrealises level and curve P&L
10COMMON PITFALLSOpen the failure checklist.
Averaging projected forwards instead of annuity-weighting them.
Applying the telescoping formula in a multi-curve setup.
Reporting DV01 without direction and curve role.
Ignoring accrued and already-fixed coupons.
11SOURCES / FURTHER READINGOpen sources and continue the track.
Interest-rate products, term structures and short-rate lectures
Research map for the rates progression and numerical experiments; all platform prose and code are original.
- Source
- Financial Engineering: Interest Rates & xVA
- Author
- L. A. Grzelak
- Ref
- main
Stochastic processes, Monte Carlo and model-calibration lectures
Mathematical cross-reference for stochastic dynamics and implementation checks.
- Source
- Computational Finance Course
- Author
- L. A. Grzelak
- Ref
- main
Current term structures, indexes, rate helpers, instruments, engines and tests
Implementation authority for production abstractions; Academy derives the mathematics before introducing library objects.
- Source
- QuantLib upstream
- Author
- QuantLib contributors
- Ref
- v1.42.1