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. - Spread
Model 🔒 - The two rates a CMS spread observes: their adjusted means, their total standard deviations to the fixing, and the correlation joining them.
- Swap
Index - The swap a CMS rate observes: a registered fixed-versus-IBOR swap template and a tenor.
Enums§
- CmsSwap
Error - Why a CMS swap could not be built.
- Swap
Index Error - 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_NODESpoints. - 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 whenb ≤ a.- cms_
coupon_ rate - What one CMS coupon on
indexstill to fix pays, as a rate:g·CMS + swith the CMS rate fixing onfixingand paid onpayment, andpayoffon it when there is one — composed overcms_optionby 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
scheduleonindex, each period fixing in advance and paying on its end — the CMS leg of aCmsSwapas a leg of coupons.termssupplies the notional, the accrual day count, the side and the payment rule’s date. - cms_
model 🔒 - The linear TSR model a CMS payment on
indexfixing onfixingand paid onpaymentis valued under, at mean reversionmean_reversion. - cms_
option - A CMS caplet (
Call) or floorlet (Put) onindexatstrike, fixing onfixingand paid onpayment, 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 reversionmean_reversion. - cms_
rate - The CMS rate on
indexfixing onfixingand paid onpayment, under the linear terminal swap rate model with mean reversionmean_reversion. - cms_
spread_ coupon_ rate - What one CMS spread coupon still to fix pays, as a rate:
g·(m₁ − m₂) + son the two adjusted rates, withpayoffon it composed overcms_spread_optionwhen there is one. - cms_
spread_ leg - A leg of CMS spread coupons over
schedule,CMS(index) − CMS(minus), each period fixing in advance.correlationis a contract number (anf64converts) orCmsSpreadCorrelation::Market. - cms_
spread_ option - An option on the spread of two CMS rates,
S₁ − S₂, fixing onfixingand paid onpayment, 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 beyondedge:½·E[((S − K)⁺)²]above the forward (upper),½·E[((K − S)⁺)²]below it, withKthe forward plusedge, at total standard deviationsd.- flat_
tail_ 🔒at flat_tailfrom 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
spreadfrom the forward — a put below it, a call above — at total standard deviationsd(σ√T). - replicated_
variance 🔒 - The annuity-measure variance of the swap rate at expiry, replicated off
the smile
vol_atquoted atspreadsfrom the forward: see the module note. - spread_
model 🔒 - strike_
integral 🔒 ∫of the call fromat(a spread to the forward, in the mode) up, or of the put from below up to it, over the smile quoted atspreads(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 atstrikeon a forwardforward, at total standard deviationsd: 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.