Table of Contents

Class DigitalIborLeg

Namespace
NanoQL.Coupons
Assembly
NanoQL.dll

A builder of a sequence of digital Ibor coupons: QuantLib's DigitalIborLeg.

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

Remarks

An immutable builder, as IborLeg: each method returns a modified copy, and ToLeg() builds the leg through FloatingDigitalLeg<TIndex, TCoupon>(Func<Date, double, Date, Date, int?, TIndex, double, double, Date, Date, DayCounter?, bool, TCoupon>, Func<TCoupon, double?, PositionType, bool, double?, double?, PositionType, bool, double?, DigitalReplication?, bool, CashFlow>, Schedule, IEnumerable<double>, TIndex, DayCounter?, BusinessDayConvention, IEnumerable<int?>, IEnumerable<double>, IEnumerable<double>, bool, IEnumerable<double?>, PositionType, bool, IEnumerable<double?>, IEnumerable<double?>, PositionType, bool, IEnumerable<double?>, DigitalReplication?, bool) in place of QuantLib's conversion operator. The coupons are built without pricers, as QuantLib's are. The leg pays the underlying's rate unless WithNakedOption(bool) is set: QuantLib's builder leaves its flag uninitialized until that call, an undefined read (QuantLib's check, its legs built with withNakedOption(false)). A builder has no value equality: its vectors compare by reference.

Constructors

DigitalIborLeg(Schedule, IborIndex)

Initializes a new instance of the DigitalIborLeg class.

public DigitalIborLeg(Schedule schedule, IborIndex index)

Parameters

schedule Schedule

The schedule of accrual dates.

index IborIndex

The index.

Exceptions

ArgumentNullException

An argument is null.

Methods

Equals(DigitalIborLeg?)

public bool Equals(DigitalIborLeg? other)

Parameters

other DigitalIborLeg

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 coupons fix at the end of their periods.

public DigitalIborLeg InArrears(bool flag = true)

Parameters

flag bool

Whether they do.

Returns

DigitalIborLeg

The modified builder.

ToLeg()

Builds the leg.

public ImmutableArray<CashFlow> ToLeg()

Returns

ImmutableArray<CashFlow>

The leg, one coupon per schedule period, without pricers.

Exceptions

NanoQLException

No notional was given; a setting has more values than the schedule has periods; the schedule is empty; or, after these, a period has a zero gearing and no payment day counter is set.

ArgumentOutOfRangeException

A position set with its strikes isn't a member of its type.

ToString()

public override string ToString()

Returns

string

WithCallAtm(bool)

Sets whether a fixed rate at a call's strike pays the call.

public DigitalIborLeg WithCallAtm(bool flag = true)

Parameters

flag bool

Whether it does.

Returns

DigitalIborLeg

The modified builder.

WithCallPayoffs(IEnumerable<double?>)

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

public DigitalIborLeg WithCallPayoffs(IEnumerable<double?> payoffs)

Parameters

payoffs IEnumerable<double?>

The cash payoffs, null elements for asset-or-nothing calls.

Returns

DigitalIborLeg

The modified builder.

WithCallPayoffs(double?)

Sets one call payoff for every coupon.

public DigitalIborLeg WithCallPayoffs(double? payoff)

Parameters

payoff double?

The cash payoff, or null for asset-or-nothing calls.

Returns

DigitalIborLeg

The modified builder.

WithCallStrikes(IEnumerable<double?>)

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

public DigitalIborLeg WithCallStrikes(IEnumerable<double?> strikes)

Parameters

strikes IEnumerable<double?>

The strikes, null elements for no call.

Returns

DigitalIborLeg

The modified builder.

WithCallStrikes(double?)

Sets one call strike for every coupon.

public DigitalIborLeg WithCallStrikes(double? strike)

Parameters

strike double?

The strike, or null for no call.

Returns

DigitalIborLeg

The modified builder.

WithFixingDays(IEnumerable<int?>)

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

public DigitalIborLeg WithFixingDays(IEnumerable<int?> fixingDays)

Parameters

fixingDays IEnumerable<int?>

The fixing days, null elements taking the index's.

Returns

DigitalIborLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

An element is negative.

WithFixingDays(int?)

Sets one count of fixing days for every coupon.

public DigitalIborLeg WithFixingDays(int? fixingDays)

Parameters

fixingDays int?

The fixing days; the index's when null.

Returns

DigitalIborLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

fixingDays is negative.

WithGearings(IEnumerable<double>)

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

public DigitalIborLeg WithGearings(IEnumerable<double> gearings)

Parameters

gearings IEnumerable<double>

The gearings.

Returns

DigitalIborLeg

The modified builder.

WithGearings(double)

Sets one gearing for every coupon.

public DigitalIborLeg WithGearings(double gearing)

Parameters

gearing double

The gearing; a zero gearing makes a fixed-rate coupon paying the spread.

Returns

DigitalIborLeg

The modified builder.

WithLongCallOption(PositionType)

Sets the calls' position.

public DigitalIborLeg WithLongCallOption(PositionType type)

Parameters

type PositionType

The position.

Returns

DigitalIborLeg

The modified builder.

WithLongPutOption(PositionType)

Sets the puts' position.

public DigitalIborLeg WithLongPutOption(PositionType type)

Parameters

type PositionType

The position.

Returns

DigitalIborLeg

The modified builder.

WithNakedOption(bool)

Sets whether the coupons pay the options alone, without the underlying's rate.

public DigitalIborLeg WithNakedOption(bool nakedOption = true)

Parameters

nakedOption bool

Whether they do.

Returns

DigitalIborLeg

The modified builder.

WithNotionals(IEnumerable<double>)

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

public DigitalIborLeg WithNotionals(IEnumerable<double> notionals)

Parameters

notionals IEnumerable<double>

The notionals.

Returns

DigitalIborLeg

The modified builder.

WithNotionals(double)

Sets one notional for every coupon.

public DigitalIborLeg WithNotionals(double notional)

Parameters

notional double

The notional.

Returns

DigitalIborLeg

The modified builder.

WithPaymentAdjustment(BusinessDayConvention)

Sets the business-day convention of the payment dates.

public DigitalIborLeg WithPaymentAdjustment(BusinessDayConvention convention)

Parameters

convention BusinessDayConvention

The convention.

Returns

DigitalIborLeg

The modified builder.

Exceptions

ArgumentOutOfRangeException

The convention isn't a member of the enum.

WithPaymentDayCounter(DayCounter?)

Sets the accrual day counter; the index's by default.

public DigitalIborLeg WithPaymentDayCounter(DayCounter? dayCounter)

Parameters

dayCounter 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.

Returns

DigitalIborLeg

The modified builder.

WithPutAtm(bool)

Sets whether a fixed rate at a put's strike pays the put.

public DigitalIborLeg WithPutAtm(bool flag = true)

Parameters

flag bool

Whether it does.

Returns

DigitalIborLeg

The modified builder.

WithPutPayoffs(IEnumerable<double?>)

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

public DigitalIborLeg WithPutPayoffs(IEnumerable<double?> payoffs)

Parameters

payoffs IEnumerable<double?>

The cash payoffs, null elements for asset-or-nothing puts.

Returns

DigitalIborLeg

The modified builder.

WithPutPayoffs(double?)

Sets one put payoff for every coupon.

public DigitalIborLeg WithPutPayoffs(double? payoff)

Parameters

payoff double?

The cash payoff, or null for asset-or-nothing puts.

Returns

DigitalIborLeg

The modified builder.

WithPutStrikes(IEnumerable<double?>)

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

public DigitalIborLeg WithPutStrikes(IEnumerable<double?> strikes)

Parameters

strikes IEnumerable<double?>

The strikes, null elements for no put.

Returns

DigitalIborLeg

The modified builder.

WithPutStrikes(double?)

Sets one put strike for every coupon.

public DigitalIborLeg WithPutStrikes(double? strike)

Parameters

strike double?

The strike, or null for no put.

Returns

DigitalIborLeg

The modified builder.

WithReplication(DigitalReplication?)

Sets the replication.

public DigitalIborLeg WithReplication(DigitalReplication? replication)

Parameters

replication DigitalReplication

The replication, or null for the digital coupon's default.

Returns

DigitalIborLeg

The modified builder.

WithSpreads(IEnumerable<double>)

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

public DigitalIborLeg WithSpreads(IEnumerable<double> spreads)

Parameters

spreads IEnumerable<double>

The spreads.

Returns

DigitalIborLeg

The modified builder.

WithSpreads(double)

Sets one spread for every coupon.

public DigitalIborLeg WithSpreads(double spread)

Parameters

spread double

The spread.

Returns

DigitalIborLeg

The modified builder.

Operators

operator ==(DigitalIborLeg?, DigitalIborLeg?)

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

Parameters

left DigitalIborLeg
right DigitalIborLeg

Returns

bool

operator !=(DigitalIborLeg?, DigitalIborLeg?)

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

Parameters

left DigitalIborLeg
right DigitalIborLeg

Returns

bool