Table of Contents

Class YoYInflationCapFloor

Namespace
NanoQL.Instruments
Assembly
NanoQL.dll

The base class of year-on-year inflation cap-like instruments: caps, floors and collars on a YoY leg.

public class YoYInflationCapFloor : Instrument
Inheritance
YoYInflationCapFloor
Derived
Inherited Members

Remarks

The standard YoY inflation cap or floor differs from a nominal one: a nominal cap has no first optionlet, since it sets in advance, while a YoY one sets (effectively) in arrears, against a lag of a few months, so its first optionlet counts; the parity test needs no special definition of the instrument. The relationship between the values of caps, floors and collars is checked, and so are the put-call parity with swaps and a known good value.

Unsealed, as in QuantLib, where YoYInflationCap, YoYInflationFloor and YoYInflationCollar derive from it and engines take it. It holds its leg and its rates; an engine computes QuantLib's arguments from them with the context (NanoQL.Instruments.YoYInflationCapFloor.SetupArguments(NanoQL.EvaluationContext)) and returns the instrument's results, QuantLib's plain Instrument::results with the engine's additional results. A cash flow of the leg that isn't a year-on-year inflation coupon is refused when the instrument is priced, as QuantLib refuses it, not when it is built. Equality is by reference.

Constructors

YoYInflationCapFloor(YoYInflationCapFloorType, ImmutableArray<CashFlow>, IEnumerable<double>)

Initializes a new instance of the YoYInflationCapFloor class with strikes: a cap or a floor.

public YoYInflationCapFloor(YoYInflationCapFloorType type, ImmutableArray<CashFlow> yoyLeg, IEnumerable<double> strikes)

Parameters

type YoYInflationCapFloorType

The type: Cap or Floor.

yoyLeg ImmutableArray<CashFlow>

The year-on-year leg.

strikes IEnumerable<double>

The strikes, extended to the leg's length with the last one: the cap rates of a cap, the floor rates of a floor.

Exceptions

ArgumentException

The leg is default or holds a null cash flow, or there are no strikes.

ArgumentNullException

strikes is null.

ArgumentOutOfRangeException

type is Collar or isn't a member of its type.

YoYInflationCapFloor(YoYInflationCapFloorType, ImmutableArray<CashFlow>, IEnumerable<double>, IEnumerable<double>)

Initializes a new instance of the YoYInflationCapFloor class with cap and floor rates.

public YoYInflationCapFloor(YoYInflationCapFloorType type, ImmutableArray<CashFlow> yoyLeg, IEnumerable<double> capRates, IEnumerable<double> floorRates)

Parameters

type YoYInflationCapFloorType

The type.

yoyLeg ImmutableArray<CashFlow>

The year-on-year leg.

capRates IEnumerable<double>

The cap rates, extended to the leg's length with the last one; read for a cap or a collar, and kept as given for a floor.

floorRates IEnumerable<double>

The floor rates, extended to the leg's length with the last one; read for a floor or a collar, and kept as given for a cap.

Exceptions

ArgumentOutOfRangeException

type isn't a member of its type.

ArgumentException

The leg is default or holds a null cash flow, or the rates the type reads are empty.

ArgumentNullException

A rate sequence is null.

Properties

CapRates

Gets the cap rates, extended to the leg's length for a cap or a collar.

public ImmutableArray<double> CapRates { get; }

Property Value

ImmutableArray<double>

FloorRates

Gets the floor rates, extended to the leg's length for a floor or a collar.

public ImmutableArray<double> FloorRates { get; }

Property Value

ImmutableArray<double>

Type

Gets the type.

public YoYInflationCapFloorType Type { get; }

Property Value

YoYInflationCapFloorType

YoYLeg

Gets the year-on-year leg.

public ImmutableArray<CashFlow> YoYLeg { get; }

Property Value

ImmutableArray<CashFlow>

Methods

AtmRate(YieldTermStructure, EvaluationContext)

The at-the-money rate on a discount curve: the leg's at-the-money rate (AtmRate(ImmutableArray<CashFlow>, YieldTermStructure, EvaluationContext, bool?, Date?, Date?, double?)) at the curve's reference date, without the cash flows paid on it.

public virtual double AtmRate(YieldTermStructure discountCurve, EvaluationContext context)

Parameters

discountCurve YieldTermStructure

The discount curve.

context EvaluationContext

The evaluation context: the coupons' amounts read its fixings and forecasts.

Returns

double

The rate; 0 for an empty leg.

Exceptions

ArgumentNullException

An argument is null.

NanoQLException

The leg's BPS is 0, or a coupon can't be priced.

ImpliedVolatility(double, YoYInflationTermStructure?, double, EvaluationContext, double, int, double, double)

The implied volatility: not implemented, as in QuantLib.

public virtual double ImpliedVolatility(double price, YoYInflationTermStructure? yoyCurve, double guess, EvaluationContext context, double accuracy = 0.0001, int maxEvaluations = 100, double minVol = 1E-07, double maxVol = 4)

Parameters

price double

The price.

yoyCurve YoYInflationTermStructure

The year-on-year inflation curve.

guess double

The solver's initial guess.

context EvaluationContext

The evaluation context.

accuracy double

The solver's accuracy.

maxEvaluations int

The solver's maximum number of evaluations.

minVol double

The lower end of the bracket.

maxVol double

The upper end of the bracket.

Returns

double

Never returns.

Exceptions

NanoQLException

Always: "not implemented yet".

IsExpired(EvaluationContext)

Whether every cash flow of the leg has occurred, an empty leg among them.

public override bool IsExpired(EvaluationContext context)

Parameters

context EvaluationContext

The evaluation context.

Returns

bool

true when the instrument has expired.

Exceptions

ArgumentNullException

context is null.

LastYoYInflationCoupon()

The leg's last cash flow as a year-on-year inflation coupon.

public YoYInflationCoupon? LastYoYInflationCoupon()

Returns

YoYInflationCoupon

The coupon, or null when the last cash flow isn't a year-on-year inflation coupon.

Exceptions

NanoQLException

The leg is empty, where QuantLib reads past its end, which is undefined: a documented divergence.

MaturityDate()

The latest accrual end date of the leg's coupons.

public Date MaturityDate()

Returns

Date

The maturity date.

Exceptions

ArgumentException

The leg is empty.

Optionlet(int)

The i-th optionlet, a new YoYInflationCapFloor of the same type on that cash flow alone, with its cap and floor rates.

public YoYInflationCapFloor Optionlet(int i)

Parameters

i int

The optionlet's index, from 0.

Returns

YoYInflationCapFloor

The optionlet.

Exceptions

ArgumentOutOfRangeException

i is negative.

ArgumentException

The leg has no cash flow at i.

StartDate()

The earliest accrual start date of the leg's coupons.

public Date StartDate()

Returns

Date

The start date.

Exceptions

ArgumentException

The leg is empty.