Table of Contents

Class YoYInflationLeg

Namespace
NanoQL.Coupons
Assembly
NanoQL.dll

A helper class building a sequence of year-on-year inflation coupons: QuantLib's yoyInflationLeg.

public sealed record YoYInflationLeg : IEquatable<YoYInflationLeg>
Inheritance
YoYInflationLeg
Implements
Inherited Members

Remarks

An immutable builder: each method returns a modified copy. ToLeg() builds the leg, in place of QuantLib's conversion operator, and attaches QuantLib's default YoYInflationCouponPricer, as QuantLib does when there are no caps or floors; a leg with caps or floors needs a pricer set on it, as QuantLib's comment says. A period with a zero gearing is a fixed-rate coupon paying its spread, capped and floored; a period with a cap or a floor a CappedFlooredYoYInflationCoupon. A builder has no value equality.

Constructors

YoYInflationLeg(Schedule, Calendar?, YoYInflationIndex, Period, CPIInterpolationType)

Initializes a new instance of the YoYInflationLeg class.

public YoYInflationLeg(Schedule schedule, Calendar? paymentCalendar, YoYInflationIndex index, Period observationLag, CPIInterpolationType interpolation)

Parameters

schedule Schedule

The schedule of accrual dates.

paymentCalendar Calendar

The payment calendar, or null, QuantLib's empty calendar.

index YoYInflationIndex

The year-on-year inflation index.

observationLag Period

The observation lag.

interpolation CPIInterpolationType

How the index is observed.

Exceptions

ArgumentNullException

schedule or index is null.

ArgumentOutOfRangeException

interpolation isn't a member of its type.

Methods

Equals(YoYInflationLeg?)

public bool Equals(YoYInflationLeg? other)

Parameters

other YoYInflationLeg

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToLeg()

Builds the leg, with QuantLib's default pricer attached to each year-on-year coupon when there are no caps or floors.

public ImmutableArray<CashFlow> ToLeg()

Returns

ImmutableArray<CashFlow>

The leg, one coupon per schedule period.

Exceptions

NanoQLException

No payment day counter or notional was given; the schedule is empty; more notionals, gearings, spreads, caps or floors were given than there are periods; or a date is computed on QuantLib's empty calendar where it can't give one.

ArgumentException

A period's cap is below its floor, with the coupon's text.

ToString()

public override string ToString()

Returns

string

WithCaps(IEnumerable<double?>)

Sets the coupons' caps; the last one repeats for any further coupons.

public YoYInflationLeg WithCaps(IEnumerable<double?> caps)

Parameters

caps IEnumerable<double?>

The caps, each null for none.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentNullException

caps is null.

WithCaps(double?)

Sets one cap for every coupon.

public YoYInflationLeg WithCaps(double? cap)

Parameters

cap double?

The cap, or null for none.

Returns

YoYInflationLeg

The modified builder.

WithFixingDays(IEnumerable<int>)

Sets the coupons' fixing days; the last one repeats for any further coupons.

public YoYInflationLeg WithFixingDays(IEnumerable<int> fixingDays)

Parameters

fixingDays IEnumerable<int>

The fixing days.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentNullException

fixingDays is null.

ArgumentOutOfRangeException

A count is negative.

WithFixingDays(int)

Sets one number of fixing days for every coupon.

public YoYInflationLeg WithFixingDays(int fixingDays)

Parameters

fixingDays int

The fixing days.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

fixingDays is negative.

WithFloors(IEnumerable<double?>)

Sets the coupons' floors; the last one repeats for any further coupons.

public YoYInflationLeg WithFloors(IEnumerable<double?> floors)

Parameters

floors IEnumerable<double?>

The floors, each null for none.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentNullException

floors is null.

WithFloors(double?)

Sets one floor for every coupon.

public YoYInflationLeg WithFloors(double? floor)

Parameters

floor double?

The floor, or null for none.

Returns

YoYInflationLeg

The modified builder.

WithGearings(IEnumerable<double>)

Sets the coupons' gearings; the last one repeats for any further coupons.

public YoYInflationLeg WithGearings(IEnumerable<double> gearings)

Parameters

gearings IEnumerable<double>

The gearings.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentNullException

gearings is null.

WithGearings(double)

Sets one gearing for every coupon.

public YoYInflationLeg WithGearings(double gearing)

Parameters

gearing double

The gearing.

Returns

YoYInflationLeg

The modified builder.

WithNotionals(IEnumerable<double>)

Sets the coupons' notionals, the last repeated for the coupons after it.

public YoYInflationLeg WithNotionals(IEnumerable<double> notionals)

Parameters

notionals IEnumerable<double>

The notionals.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentNullException

notionals is null.

WithNotionals(double)

Sets one notional for every coupon.

public YoYInflationLeg WithNotionals(double notional)

Parameters

notional double

The notional.

Returns

YoYInflationLeg

The modified builder.

WithPaymentAdjustment(BusinessDayConvention)

Sets the convention adjusting the payment dates.

public YoYInflationLeg WithPaymentAdjustment(BusinessDayConvention convention)

Parameters

convention BusinessDayConvention

The convention.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

convention isn't a member of its type.

WithPaymentDayCounter(DayCounter?)

Sets the coupons' day counter.

public YoYInflationLeg WithPaymentDayCounter(DayCounter? dayCounter)

Parameters

dayCounter DayCounter

The day counter, or null, QuantLib's empty one, which the leg refuses.

Returns

YoYInflationLeg

The modified builder.

WithSpreads(IEnumerable<double>)

Sets the coupons' spreads; the last one repeats for any further coupons.

public YoYInflationLeg WithSpreads(IEnumerable<double> spreads)

Parameters

spreads IEnumerable<double>

The spreads.

Returns

YoYInflationLeg

The modified builder.

Exceptions

ArgumentNullException

spreads is null.

WithSpreads(double)

Sets one spread for every coupon.

public YoYInflationLeg WithSpreads(double spread)

Parameters

spread double

The spread.

Returns

YoYInflationLeg

The modified builder.

Operators

operator ==(YoYInflationLeg?, YoYInflationLeg?)

public static bool operator ==(YoYInflationLeg? left, YoYInflationLeg? right)

Parameters

left YoYInflationLeg
right YoYInflationLeg

Returns

bool

operator !=(YoYInflationLeg?, YoYInflationLeg?)

public static bool operator !=(YoYInflationLeg? left, YoYInflationLeg? right)

Parameters

left YoYInflationLeg
right YoYInflationLeg

Returns

bool