Skip to main content

Module cms

Module cms 

Expand description

Constant-maturity swap rates: a swap index observed on a fixing date and paid on another, adjusted for convexity by the linear terminal swap rate model.

A CMS coupon pays the swap rate S_T observed at T, at T_p. Under the annuity measure S_T has mean S₀, but the payment is worth A₀ · E^A[S_T · P(T, T_p) / A(T)], and the ratio P(T, T_p) / A(T) moves with the rate. Linear TSR approximates it by α(S) = α₀ + a·(S − S₀), α₀ = P(0, T_p) / A₀, which makes the rate the payment is worth

S₀ + a · Var^A(S_T) / α₀

With no smile the variance is the swaption surface’s ATM variance to the fixing — σ²T for a normal surface, S₀²(e^{σ²T} − 1) for a lognormal one — and the slope a is the one a one-factor Gaussian shift of the curve with mean reversion κ implies.

With a smile the variance is replicated off it: the payoff S·α(S) has the constant second derivative 2a, so static replication of the coupon is exact in the variance, and the variance of any distribution is twice the integral of its out-of-the-money options over strike,

Var^A(S_T) = 2 · [ ∫_{−∞}^{S₀} Put(K) dK + ∫_{S₀}^{∞} Call(K) dK ]

each option priced undiscounted under the annuity measure at the smile’s vol for its strike. Between the smile’s strike pillars the vol is linear and the integral is taken by Gauss–Legendre; beyond them it is flat, and the tail integral is in closed form. A flat smile gives back the ATM variance.

Structs§

CmsModel 🔒
What a CMS payment observes under linear TSR: the index swap’s forward, the annuity mapping α(S) = α₀ + a·(S − S₀), and the swaption smile at the fixing.
CmsPeriod
One period of a CMS leg: accrual, the fixing in advance and the year fraction the rate accrues over.
CmsRate
A CMS rate: the index swap’s forward and the rate a payment on it is worth.
CmsSwap
A CMS swap: a leg paying N·τ·(g·CMS + s) per period — the swap index’s CMS rate fixing in advance — against any other leg on the opposite side.
SpreadModel 🔒
The two rates a CMS spread observes: their adjusted means, their total standard deviations to the fixing, and the correlation joining them.
SwapIndex
The swap a CMS rate observes: a registered fixed-versus-IBOR swap template and a tenor.

Enums§

CmsSwapError
Why a CMS swap could not be built.
SwapIndexError
Why a swap index could not be built.

Constants§

SMILE_NODES 🔒
Gauss–Legendre points per piece of a smile interval.
SMILE_PIECE_SDS 🔒
The widest piece of a smile interval, in standard deviations of the rate: the integrand is smooth on that scale, so each piece is resolved to rounding by SMILE_NODES points.
SPREAD_NODES 🔒
Gauss–Hermite points the lognormal spread integral takes.

Functions§

between_pillars 🔒
[a, b] cut at every smile pillar strictly inside it, in order; empty when b ≤ a.
cms_coupon_rate
What one CMS coupon on index still to fix pays, as a rate: g·CMS + s with the CMS rate fixing on fixing and paid on payment, and payoff on it when there is one — composed over cms_option by the payoff axis every floating coupon shares, so a collar caps and floors the rate and a digital is its call spread.
cms_leg
A leg of CMS coupons over schedule on index, each period fixing in advance and paying on its end — the CMS leg of a CmsSwap as a leg of coupons. terms supplies the notional, the accrual day count, the side and the payment rule’s date.
cms_model 🔒
The linear TSR model a CMS payment on index fixing on fixing and paid on payment is valued under, at mean reversion mean_reversion.
cms_option
A CMS caplet (Call) or floorlet (Put) on index at strike, fixing on fixing and paid on payment, as a rate: what (S − K)⁺ (or (K − S)⁺) observed at the fixing is worth paid on the payment date, per unit of accrual and of the payment date’s discount factor, under the linear terminal swap rate model with mean reversion mean_reversion.
cms_rate
The CMS rate on index fixing on fixing and paid on payment, under the linear terminal swap rate model with mean reversion mean_reversion.
cms_spread_coupon_rate
What one CMS spread coupon still to fix pays, as a rate: g·(m₁ − m₂) + s on the two adjusted rates, with payoff on it composed over cms_spread_option when there is one.
cms_spread_leg
A leg of CMS spread coupons over schedule, CMS(index) − CMS(minus), each period fixing in advance. correlation is a contract number (an f64 converts) or CmsSpreadCorrelation::Market.
cms_spread_option
An option on the spread of two CMS rates, S₁ − S₂, fixing on fixing and paid on payment, as a rate: a call pays (S₁ − S₂ − K)⁺, a put (K − S₁ + S₂)⁺, each rate lognormal.
correlation_pair 🔒
A pair of swap-index codes in the order the market keys its spread correlation by: a correlation is symmetric, so (a, b) and (b, a) are one mark.
flat_tail 🔒
∫ of the out-of-the-money option over the flat-vol tail beyond edge: ½·E[((S − K)⁺)²] above the forward (upper), ½·E[((K − S)⁺)²] below it, with K the forward plus edge, at total standard deviation sd.
flat_tail_at 🔒
flat_tail from an edge in the mode: where a strike’s spread to the forward, which moves with it, bounds the integral.
gaussian_g 🔒
(1 − e^{−κτ}) / κ, τ itself at zero mean reversion.
out_of_the_money 🔒
The undiscounted out-of-the-money option at spread from the forward — a put below it, a call above — at total standard deviation sd (σ√T).
replicated_variance 🔒
The annuity-measure variance of the swap rate at expiry, replicated off the smile vol_at quoted at spreads from the forward: see the module note.
spread_model 🔒
strike_integral 🔒
∫ of the call from at (a spread to the forward, in the mode) up, or of the put from below up to it, over the smile quoted at spreads (flat at the at-the-money vol when there is none): the flat wings in closed form, the smile between its pillars by Gauss–Legendre. The piece the strike bounds is integrated in the mode, so its moving end differentiates.
vanilla 🔒
The undiscounted call (call) or put at strike on a forward forward, at total standard deviation sd: Bachelier or Black-76 by the surface’s convention. Below a zero strike the lognormal rate never goes, so the call is the forward less the strike and the put nothing.