Table of Contents

Class OvernightLeg

Namespace
NanoQL.Coupons
Assembly
NanoQL.dll

A helper class building a sequence of overnight-indexed coupons.

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

Remarks

An immutable builder: each method returns a modified copy, so a builder kept and reused never changes under its holder. ToLeg() builds the leg, in place of QuantLib's conversion operator; it reads no evaluation date, since the coupons' value dates are always the full daily list. A builder has no value equality: its vectors compare by reference.

A period whose gearing is zero is a FixedRateCoupon at the spread, capped and floored; a period with a cap or a floor is a CappedFlooredOvernightIndexedCoupon. A coupon pricer given with WithCouponPricer(OvernightIndexedCouponPricer?) is set on each coupon and capped coupon; otherwise the coupons keep their default pricers, and the capped coupons have none.

Constructors

OvernightLeg(Schedule, OvernightIndex)

Initializes a new instance of the OvernightLeg record.

public OvernightLeg(Schedule schedule, OvernightIndex overnightIndex)

Parameters

schedule Schedule

The schedule; its calendar is the default payment calendar.

overnightIndex OvernightIndex

The overnight index.

Exceptions

ArgumentNullException

An argument is null.

Methods

CompoundingSpreadDaily(bool)

Sets whether the spread compounds daily.

public OvernightLeg CompoundingSpreadDaily(bool compoundSpreadDaily = true)

Parameters

compoundSpreadDaily bool

The flag.

Returns

OvernightLeg

The modified builder.

Equals(OvernightLeg?)

public bool Equals(OvernightLeg? other)

Parameters

other OvernightLeg

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

InArrears(bool)

Sets whether the rates are computed over each coupon's own period (in arrears, the default) or over the period before (in advance).

public OvernightLeg InArrears(bool inArrears)

Parameters

inArrears bool

The flag.

Returns

OvernightLeg

The modified builder.

ToLeg()

The leg: QuantLib's conversion to Leg.

public ImmutableArray<CashFlow> ToLeg()

Returns

ImmutableArray<CashFlow>

The leg; empty for a schedule of one date.

Exceptions

NanoQLException

No nominal is given, the coupon pricer doesn't suit the averaging method, the schedule is empty, the explicit payment dates don't match the periods, or, after every refusal QuantLib raises while it builds the leg, a period of zero gearing has no payment day counter.

ToString()

public override string ToString()

Returns

string

WithAveragingMethod(RateAveragingType)

Sets the averaging method.

public OvernightLeg WithAveragingMethod(RateAveragingType averagingMethod)

Parameters

averagingMethod RateAveragingType

The method.

Returns

OvernightLeg

The modified builder.

WithCaps(IEnumerable<double?>)

Sets the coupons' caps, null for none; the last one repeats past the end.

public OvernightLeg WithCaps(IEnumerable<double?> caps)

Parameters

caps IEnumerable<double?>

The caps.

Returns

OvernightLeg

The modified builder.

WithCaps(double?)

Sets one cap for every coupon.

public OvernightLeg WithCaps(double? cap)

Parameters

cap double?

The cap, or null, QuantLib's Null<Rate>(), for none: the coupons are then uncapped.

Returns

OvernightLeg

The modified builder.

WithCouponPricer(OvernightIndexedCouponPricer?)

Sets the pricer of every coupon and capped coupon: a compounding pricer for compounded coupons, an averaging pricer for averaged ones; null keeps the coupons' default pricers.

public OvernightLeg WithCouponPricer(OvernightIndexedCouponPricer? couponPricer)

Parameters

couponPricer OvernightIndexedCouponPricer

The pricer.

Returns

OvernightLeg

The modified builder.

WithDailyCapFloor(bool)

Sets whether the caps and floors apply to the daily rates.

public OvernightLeg WithDailyCapFloor(bool dailyCapFloor = true)

Parameters

dailyCapFloor bool

The flag.

Returns

OvernightLeg

The modified builder.

WithFloors(IEnumerable<double?>)

Sets the coupons' floors, null for none; the last one repeats past the end.

public OvernightLeg WithFloors(IEnumerable<double?> floors)

Parameters

floors IEnumerable<double?>

The floors.

Returns

OvernightLeg

The modified builder.

WithFloors(double?)

Sets one floor for every coupon.

public OvernightLeg WithFloors(double? floor)

Parameters

floor double?

The floor, or null, QuantLib's Null<Rate>(), for none: the coupons are then unfloored.

Returns

OvernightLeg

The modified builder.

WithGearings(IEnumerable<double>)

Sets the coupons' gearings; the last one repeats past the end, and 1 applies when none is set.

public OvernightLeg WithGearings(IEnumerable<double> gearings)

Parameters

gearings IEnumerable<double>

The gearings.

Returns

OvernightLeg

The modified builder.

WithGearings(double)

Sets one gearing for every coupon.

public OvernightLeg WithGearings(double gearing)

Parameters

gearing double

The gearing.

Returns

OvernightLeg

The modified builder.

WithLastRecentPeriod(Period?)

Sets the period before each rate computation's end where the computation starts, or null to compute over the whole period.

public OvernightLeg WithLastRecentPeriod(Period? lastRecentPeriod)

Parameters

lastRecentPeriod Period?

The period.

Returns

OvernightLeg

The modified builder.

WithLastRecentPeriodCalendar(Calendar?)

Sets the calendar of the last recent period; the schedule's when none is set.

public OvernightLeg WithLastRecentPeriodCalendar(Calendar? lastRecentPeriodCalendar)

Parameters

lastRecentPeriodCalendar Calendar

The calendar; the schedule's when null, QuantLib's empty calendar.

Returns

OvernightLeg

The modified builder.

WithLockoutDays(int)

Sets the lockout days.

public OvernightLeg WithLockoutDays(int lockoutDays)

Parameters

lockoutDays int

The lockout.

Returns

OvernightLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

The lockout is negative.

WithLookbackDays(int?)

Sets the lookback days.

public OvernightLeg WithLookbackDays(int? lookbackDays)

Parameters

lookbackDays int?

The lookback, or null, QuantLib's Null<Natural>() and its default, for none: the coupons then fix by the index's fixing days.

Returns

OvernightLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

The lookback is negative.

WithNakedOption(bool)

Sets whether the capped coupons pay the options alone.

public OvernightLeg WithNakedOption(bool nakedOption)

Parameters

nakedOption bool

The flag.

Returns

OvernightLeg

The modified builder.

WithNotionals(IEnumerable<double>)

Sets the coupons' nominals; the last one repeats past the end.

public OvernightLeg WithNotionals(IEnumerable<double> notionals)

Parameters

notionals IEnumerable<double>

The nominals.

Returns

OvernightLeg

The modified builder.

WithNotionals(double)

Sets one nominal for every coupon.

public OvernightLeg WithNotionals(double notional)

Parameters

notional double

The nominal.

Returns

OvernightLeg

The modified builder.

WithObservationShift(bool)

Sets whether the observation shift applies.

public OvernightLeg WithObservationShift(bool applyObservationShift = true)

Parameters

applyObservationShift bool

The flag.

Returns

OvernightLeg

The modified builder.

WithPaymentAdjustment(BusinessDayConvention)

Sets the convention adjusting the payment dates.

public OvernightLeg WithPaymentAdjustment(BusinessDayConvention convention)

Parameters

convention BusinessDayConvention

The convention.

Returns

OvernightLeg

The modified builder.

WithPaymentCalendar(Calendar?)

Sets the payment calendar; the schedule's when none is set.

public OvernightLeg WithPaymentCalendar(Calendar? cal)

Parameters

cal Calendar

The calendar; the schedule's when null, QuantLib's empty calendar, and WeekendsOnly when the schedule's is empty too.

Returns

OvernightLeg

The modified builder.

WithPaymentDates(IEnumerable<Date>)

Sets explicit payment dates, one per period, in place of the lagged and adjusted accrual ends.

public OvernightLeg WithPaymentDates(IEnumerable<Date> paymentDates)

Parameters

paymentDates IEnumerable<Date>

The dates.

Returns

OvernightLeg

The modified builder.

WithPaymentDayCounter(DayCounter?)

Sets the coupons' accrual day counter; the index's when none is set.

public OvernightLeg WithPaymentDayCounter(DayCounter? dc)

Parameters

dc DayCounter

The day counter; the index's when null, QuantLib's empty day counter. A period with a zero gearing then refuses the conversion, its fixed-rate coupon needing one, after every refusal QuantLib raises while it builds the leg.

Returns

OvernightLeg

The modified builder.

WithPaymentLag(int)

Sets the payment lag, in business days after each accrual end.

public OvernightLeg WithPaymentLag(int lag)

Parameters

lag int

The lag.

Returns

OvernightLeg

The modified builder.

WithRoundingPrecision(int)

Sets the decimal places the coupons' rates are rounded to before their amounts are computed.

public OvernightLeg WithRoundingPrecision(int roundingPrecision)

Parameters

roundingPrecision int

The precision.

Returns

OvernightLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

The precision is outside [0, 16].

WithSpreads(IEnumerable<double>)

Sets the coupons' spreads; the last one repeats past the end, and 0 applies when none is set.

public OvernightLeg WithSpreads(IEnumerable<double> spreads)

Parameters

spreads IEnumerable<double>

The spreads.

Returns

OvernightLeg

The modified builder.

WithSpreads(double)

Sets one spread for every coupon.

public OvernightLeg WithSpreads(double spread)

Parameters

spread double

The spread.

Returns

OvernightLeg

The modified builder.

WithTelescopicValueDates(bool)

Sets QuantLib's telescopic value dates, which on averaged coupons select the averaging pricer's approximation; the value dates are the full daily list either way.

public OvernightLeg WithTelescopicValueDates(bool telescopicValueDates)

Parameters

telescopicValueDates bool

The flag.

Returns

OvernightLeg

The modified builder.

Operators

operator ==(OvernightLeg?, OvernightLeg?)

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

Parameters

left OvernightLeg
right OvernightLeg

Returns

bool

operator !=(OvernightLeg?, OvernightLeg?)

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

Parameters

left OvernightLeg
right OvernightLeg

Returns

bool