Table of Contents

Class LinearTsrPricer

Namespace
NanoQL.Coupons
Assembly
NanoQL.dll

The pricing of a CMS coupon on a linear terminal swap rate model, whose slope is linked to a Gaussian short-rate model (Andersen and Piterbarg, Interest Rate Modeling, 16.3.2).

public sealed class LinearTsrPricer : CmsCouponPricer, IMeanRevertingPricer
Inheritance
LinearTsrPricer
Implements
Inherited Members

Remarks

The integration's cut-off is set by LinearTsrPricerSettings: explicit lower and upper bounds; the strike where a vanilla swaption has a given ratio (1%) of the at-the-money swaption's vega; the strike where the undeflated payer or receiver price falls below a threshold; or a number of standard deviations of a Black-Scholes process at the at-the-money volatility. The bounds are applied in every case: on a shifted lognormal section to the strike plus the shift, so a zero lower bound is the shifted model's lowest rate; on a normal one the lower bound is min(−upper, lower), unless the bounds are given explicitly.

Immutable: each public member computes, inside the call, what QuantLib's initialize(coupon) stores in the pricer, and a capped or collared coupon's rate reads its three rates from one such state. WithMeanReversion(double) and WithSwaptionVolatility(SwaptionVolatilityStructure?) return copies, where QuantLib's setters replace its quote and handle in place; the day counter of the model's slope is the volatility's the pricer holds, where QuantLib's keeps its constructor's volatility's after setSwaptionVolatility.

QuantLib's fixes here: the price-threshold strategy searches with its threshold, from the bracket's midpoint, where QuantLib's passes the vega ratio and a guess at the bracket's end, which Brent refuses, so every threshold gave the default bounds' price; the standard-deviations strategy sets each option's own bound, its lognormal width k·σ·√T and the shift subtracted once; below a reversion of 1e-4 the model's shape is −expm1(−a·τ)/a, τ at 0, where QuantLib's reads every such reversion as 0; on a lognormal section and a forward above −shift a caplet struck at or below −shift is the coupon's expected rate less the strike and a floorlet there 0, where QuantLib's refuses, a forward at or below −shift keeping QuantLib's refusal; every section is wrapped at the coupon's forward, where QuantLib's keeps a section's own at-the-money level, which on the SABR and ZABR cubes is an interpolated forward; and the vega-ratio search reads a normal section's vega from Bachelier's derivative, where QuantLib's section refuses it.

Constructors

LinearTsrPricer(SwaptionVolatilityStructure, double, YieldTermStructure?, LinearTsrPricerSettings?, Integrator?)

Initializes a new instance of the LinearTsrPricer class.

public LinearTsrPricer(SwaptionVolatilityStructure swaptionVol, double meanReversion, YieldTermStructure? couponDiscountCurve = null, LinearTsrPricerSettings? settings = null, Integrator? integrator = null)

Parameters

swaptionVol SwaptionVolatilityStructure

The swaption volatility.

meanReversion double

The mean reversion of the model's slope.

couponDiscountCurve YieldTermStructure

The coupon's discounting curve, which only the prices read; the swap index's discounting curve when null, QuantLib's empty handle.

settings LinearTsrPricerSettings

The integration's bounds; QuantLib's default, the rate bounds 0.0001 and 2, when null.

integrator Integrator

The integrator; QuantLib's GaussKronrodNonAdaptive(1e-10, 5000, 1e-10) when null.

Exceptions

ArgumentNullException

swaptionVol is null, QuantLib's empty handle, which its constructor dereferences.

ArgumentOutOfRangeException

The settings' strategy isn't a member of its type.

Properties

CouponDiscountCurve

Gets the coupon's discounting curve, or null for the swap index's.

public YieldTermStructure? CouponDiscountCurve { get; }

Property Value

YieldTermStructure

Integrator

Gets the integrator.

public Integrator Integrator { get; }

Property Value

Integrator

MeanReversion

Gets the mean reversion.

public double MeanReversion { get; }

Property Value

double

Settings

Gets the integration's bounds.

public LinearTsrPricerSettings Settings { get; }

Property Value

LinearTsrPricerSettings

Methods

CapletPrice(FloatingRateCoupon, double, EvaluationContext)

The price of a caplet on the coupon's rate.

public override double CapletPrice(FloatingRateCoupon coupon, double effectiveCap, EvaluationContext context)

Parameters

coupon FloatingRateCoupon

The coupon.

effectiveCap double

The cap on the index fixing.

context EvaluationContext

The evaluation context.

Returns

double

The price.

Exceptions

ArgumentException

The coupon isn't a CMS coupon.

NanoQLException

A curve or the volatility is missing.

CapletRate(FloatingRateCoupon, double, EvaluationContext)

The rate of a caplet on the coupon's rate.

public override double CapletRate(FloatingRateCoupon coupon, double effectiveCap, EvaluationContext context)

Parameters

coupon FloatingRateCoupon

The coupon.

effectiveCap double

The cap on the index fixing.

context EvaluationContext

The evaluation context.

Returns

double

The rate.

Exceptions

ArgumentException

The coupon isn't a CMS coupon.

NanoQLException

A curve or the volatility is missing.

FloorletPrice(FloatingRateCoupon, double, EvaluationContext)

The price of a floorlet on the coupon's rate.

public override double FloorletPrice(FloatingRateCoupon coupon, double effectiveFloor, EvaluationContext context)

Parameters

coupon FloatingRateCoupon

The coupon.

effectiveFloor double

The floor on the index fixing.

context EvaluationContext

The evaluation context.

Returns

double

The price.

Exceptions

ArgumentException

The coupon isn't a CMS coupon.

NanoQLException

A curve or the volatility is missing.

FloorletRate(FloatingRateCoupon, double, EvaluationContext)

The rate of a floorlet on the coupon's rate.

public override double FloorletRate(FloatingRateCoupon coupon, double effectiveFloor, EvaluationContext context)

Parameters

coupon FloatingRateCoupon

The coupon.

effectiveFloor double

The floor on the index fixing.

context EvaluationContext

The evaluation context.

Returns

double

The rate.

Exceptions

ArgumentException

The coupon isn't a CMS coupon.

NanoQLException

A curve or the volatility is missing.

SwapletPrice(FloatingRateCoupon, EvaluationContext)

The swaplet's price: the coupon's amount, discounted.

public override double SwapletPrice(FloatingRateCoupon coupon, EvaluationContext context)

Parameters

coupon FloatingRateCoupon

The coupon.

context EvaluationContext

The evaluation context.

Returns

double

The price.

Exceptions

ArgumentException

The coupon isn't a CMS coupon.

NanoQLException

A curve or the volatility is missing.

SwapletRate(FloatingRateCoupon, EvaluationContext)

The swaplet's rate: the coupon's rate.

public override double SwapletRate(FloatingRateCoupon coupon, EvaluationContext context)

Parameters

coupon FloatingRateCoupon

The coupon.

context EvaluationContext

The evaluation context.

Returns

double

The rate.

Exceptions

ArgumentException

The coupon isn't a CMS coupon.

NanoQLException

A curve or the volatility is missing.

WithMeanReversion(double)

A copy of the pricer with another mean reversion.

public LinearTsrPricer WithMeanReversion(double meanReversion)

Parameters

meanReversion double

The mean reversion.

Returns

LinearTsrPricer

The copy; the receiver is unchanged.

WithSwaptionVolatility(SwaptionVolatilityStructure?)

A copy of the pricer on another swaption volatility.

public override LinearTsrPricer WithSwaptionVolatility(SwaptionVolatilityStructure? swaptionVolatility)

Parameters

swaptionVolatility SwaptionVolatilityStructure

The swaption volatility, or null for none.

Returns

LinearTsrPricer

The copy; the receiver is unchanged.