TQBTHEQUANTBATEMAN
TQB/ learn/ rates/ interest rate swapsEN · DARK
Rates & curves · intermediate

Interest-rate swaps

Turning a strip of forwards and discount factors into par coupon, PV and curve risk

BY THE END, YOU CAN

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.

01
INTUITION

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.

01

Par rate is a ratio, not an average of forwards.

02

In a single-curve spot-starting idealisation the floating leg telescopes; multi-curve projection generally does not.

03

Payer-fixed gains when par rates rise, but bucketed curve moves determine actual P&L.

02
WHY MARKETS CARE

Start from cash flows and quotation.

Swaps are core instruments for duration transfer, curve construction, corporate hedging, asset-liability management and macro expression.

INSTRUMENTS

fixed-for-floating swaps

forward-start swaps

asset swaps

swap spreads

QUOTE CONVENTION

State currency, index, effective/maturity dates, fixed frequency and basis, floating basis, payment lags, collateral and payer/receiver direction.

03
MATHEMATICS

Value each dated cash flow under explicit conventions.

Formula · Definition

Fixed-leg annuity

A(0)=∑i=1nαiPd(0,Ti)A(0)=\sum_{i=1}^{n}\alpha_iP_d(0,T_i)

Present value of one unit of fixed coupon paid on the schedule.

Open in Analytics
Formula · Short derivation

Multi-curve par rate

S(0)=∑j=1mδjPd(0,Uj)Fp(0;Uj−1,Uj)A(0)S(0)=\frac{\sum_{j=1}^{m}\delta_jP_d(0,U_j)F_p(0;U_{j-1},U_j)}{A(0)}

Projected floating coupons are discounted on the collateral curve and divided by the fixed annuity.

Open in Analytics
Short derivation
Short derivation

Balancing fixed and floating legs at par

Price both legs independently on their dated schedules, then solve the zero-PV coupon.

  1. 01

    Build the fixed annuity

    Multiply each fixed accrual by its payment-date discount factor and sum.

  2. 02

    Project floating coupons

    For each floating period, project the index fixing from its forwarding curve and multiply by accrual, notional and discount factor.

    PVflt=N∑jδjPd(0,Uj)Fp(0;Uj−1,Uj)PV_{flt}=N\sum_j\delta_jP_d(0,U_j)F_p(0;U_{j-1},U_j)
  3. 03

    Solve the par condition

    Set NK A(0)=PV_flt and divide by N A(0).

    S(0)=PVflt/[NA(0)]S(0)=PV_{flt}/[N A(0)]
  4. 04

    Value an off-market trade

    Subtract the current par-equivalent leg from the contractual fixed leg using the chosen receiver/payer sign.

    Vrec=NA(K−S)V_{rec}=NA(K-S)

Swap PV is the discounted difference between one contractual coupon and the curve-implied par coupon on exact schedules.

Inputs
  • A(0): fixed-leg annuity
  • K: contractual fixed rate
  • S(0): par swap rate
  • F_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.
Formula · Short derivation

Receiver-fixed PV

Vrec=N A(0)[K−S(0)]V_{rec}=N\,A(0)[K-S(0)]

The compact identity holds once S is computed on the same schedules and curves.

Open in Analytics
05
MODEL / PRICING

Build, calibrate, and reprice the contract.

METHOD

Generate both schedules, project each floating coupon, discount every payment, compute par coupon and return leg-level PV plus bucketed sensitivities.

CALIBRATION

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.
ARCHITECTURE
  • 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.
PYTHON 3 · NUMPY / SCIPY

Par coupon and receiver-fixed PV

Compute annuity, par rate and verify zero PV at inception.

REUSABLE EXAMPLE
01from __future__ import annotations
02
03import math
04
05times = [1., 2., 3., 4., 5.]
06rate = 0.04
07discounts = [math.exp(-rate*t) for t in times]
08annuity = sum(discounts)
09par = (1.0 - discounts[-1]) / annuity
10receiver_pv = 10_000_000.0 * annuity * (par - par)
11assert abs(receiver_pv) < 1e-10
12assert abs(par - (math.exp(rate) - 1.0)) < 1e-12
13print(f"annuity={annuity:.8f} | par={par:.6%}")
EXPECTED OUTPUTA positive annuity and a par coupon that gives zero initial PV.
SANITY CHECKS

✓ Discount factors are positive.

✓ Annuity uses fixed accrual weights.

✓ Par trade reprices to zero.

07
INTERACTIVE LAB

Move the state. Challenge the equation.

FIXED ANNUITY · FLOATING PV · PAR RATE

Swap par/PV laboratory

Change level, slope and fixed coupon; inspect fixed annuity, floating PV, par rate and payer/receiver P&L.

SYNTHETIC · CONTROLLED SCENARIOS
5Y par3.59%
10Y par3.84%
10Y receiver margin16.4 bp
Par / fixed rate by Swap maturity (years)

Base: Gently upward par curve.

  • par swap
  • 4.00% fixed coupon
Swap maturity (years): 1.0Y. par swap: 3.190%. 4.00% fixed coupon: 4.000%.

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

ACTIVE STATE

Base — Gently upward par curve. Move the control and inspect every series with pointer or touch.

08
FRONT OFFICE

Follow the trade through risk and lifecycle events.

ON THE DESK
“A swap is one headline rate wrapped around two schedules and two curve roles.”
VISIBLE INPUTS

fixed/floating schedules

projection curve

discount curve

notional and coupon

payer/receiver direction

CALIBRATION

Use swaps as bootstrap helpers only after short-end instruments and conventions are fixed. Every input quote should reprice within its market tolerance.

RISK

discount DV01

forward DV01

curve spread

fixing and carry

DAILY WORKFLOW
  1. build schedules
  2. project float
  3. discount legs
  4. solve par/PV
  5. 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.
MACRO CONNECTION

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.

01Macro regimetransmits

changes policy and inflation expectations

02Forward pathtransmits

moves projected coupons

03Swap par ratetransmits

balances discounted legs

04Duration bookoutput

realises level and curve P&L

10COMMON PITFALLSOpen the failure checklist.
01

Averaging projected forwards instead of annuity-weighting them.

02

Applying the telescoping formula in a multi-curve setup.

03

Reporting DV01 without direction and curve role.

04

Ignoring accrued and already-fixed coupons.

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

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
OPEN ORIGINAL SOURCE ↗
research

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
OPEN ORIGINAL SOURCE ↗
implementation reference

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
OPEN ORIGINAL SOURCE ↗