Class DigitalIborLeg
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
Exceptions
- ArgumentNullException
An argument is null.
Methods
Equals(DigitalIborLeg?)
public bool Equals(DigitalIborLeg? other)
Parameters
otherDigitalIborLeg
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
InArrears(bool)
Sets whether the coupons fix at the end of their periods.
public DigitalIborLeg InArrears(bool flag = true)
Parameters
flagboolWhether 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
WithCallAtm(bool)
Sets whether a fixed rate at a call's strike pays the call.
public DigitalIborLeg WithCallAtm(bool flag = true)
Parameters
flagboolWhether 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
payoffsIEnumerable<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
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
strikesIEnumerable<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
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
fixingDaysIEnumerable<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
Returns
- DigitalIborLeg
The modified builder.
Exceptions
- ArgumentOutOfRangeException
fixingDaysis negative.
WithGearings(IEnumerable<double>)
Sets the coupons' gearings; the last one repeats for any further coupons.
public DigitalIborLeg WithGearings(IEnumerable<double> gearings)
Parameters
gearingsIEnumerable<double>The gearings.
Returns
- DigitalIborLeg
The modified builder.
WithGearings(double)
Sets one gearing for every coupon.
public DigitalIborLeg WithGearings(double gearing)
Parameters
gearingdoubleThe 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
typePositionTypeThe position.
Returns
- DigitalIborLeg
The modified builder.
WithLongPutOption(PositionType)
Sets the puts' position.
public DigitalIborLeg WithLongPutOption(PositionType type)
Parameters
typePositionTypeThe 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
nakedOptionboolWhether 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
notionalsIEnumerable<double>The notionals.
Returns
- DigitalIborLeg
The modified builder.
WithNotionals(double)
Sets one notional for every coupon.
public DigitalIborLeg WithNotionals(double notional)
Parameters
notionaldoubleThe notional.
Returns
- DigitalIborLeg
The modified builder.
WithPaymentAdjustment(BusinessDayConvention)
Sets the business-day convention of the payment dates.
public DigitalIborLeg WithPaymentAdjustment(BusinessDayConvention convention)
Parameters
conventionBusinessDayConventionThe 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
dayCounterDayCounterThe 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
flagboolWhether 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
payoffsIEnumerable<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
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
strikesIEnumerable<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
Returns
- DigitalIborLeg
The modified builder.
WithReplication(DigitalReplication?)
Sets the replication.
public DigitalIborLeg WithReplication(DigitalReplication? replication)
Parameters
replicationDigitalReplicationThe 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
spreadsIEnumerable<double>The spreads.
Returns
- DigitalIborLeg
The modified builder.
WithSpreads(double)
Sets one spread for every coupon.
public DigitalIborLeg WithSpreads(double spread)
Parameters
spreaddoubleThe spread.
Returns
- DigitalIborLeg
The modified builder.
Operators
operator ==(DigitalIborLeg?, DigitalIborLeg?)
public static bool operator ==(DigitalIborLeg? left, DigitalIborLeg? right)
Parameters
leftDigitalIborLegrightDigitalIborLeg
Returns
operator !=(DigitalIborLeg?, DigitalIborLeg?)
public static bool operator !=(DigitalIborLeg? left, DigitalIborLeg? right)
Parameters
leftDigitalIborLegrightDigitalIborLeg