Table of Contents

Class MakeMultipleResetsSwap

Namespace
NanoQL.Instruments
Assembly
NanoQL.dll

A helper building multiple-resets swaps: QuantLib's MakeMultipleResetsSwap.

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

Remarks

An immutable builder: each method returns a modified copy, and ToSwap(EvaluationContext) builds the swap under a context, in place of QuantLib's conversion operators. By default the fixed leg's frequency is the coupons' period, the index's tenor times the resets per coupon. With no fixed rate given, the swap is built at its par rate, priced by the engine set, or by DiscountingSwapEngine on the index's forwarding curve; the engine is never stored on the swap, where QuantLib's builder attaches it. A builder has no value equality. An option the builder isn't given that QuantLib's builder fixes takes the builder's provider's default (Defaults(ConventionProvider)), read when the swap is built: QuantLib's values with nothing configured.

Constructors

MakeMultipleResetsSwap(Period, IborIndex, int)

Initializes a new instance of the MakeMultipleResetsSwap record.

public MakeMultipleResetsSwap(Period tenor, IborIndex iborIndex, int resetsPerCoupon)

Parameters

tenor Period

The swap's tenor.

iborIndex IborIndex

The index whose fixings the floating coupons combine.

resetsPerCoupon int

The number of resets per floating coupon.

Exceptions

ArgumentNullException

iborIndex is null.

ArgumentOutOfRangeException

resetsPerCoupon isn't positive.

Methods

Defaults(ConventionProvider)

The defaults a builder takes under a provider for the options it isn't given.

public static MultipleResetsSwapDefaults Defaults(ConventionProvider provider)

Parameters

provider ConventionProvider

The provider, the index's, which a builder on the index takes.

Returns

MultipleResetsSwapDefaults

The provider's defaults; QuantLib's under QuantLib.

Exceptions

ArgumentNullException

provider is null.

ArgumentException

The provider has no defaults (a set without QuantLib's presets).

Equals(MakeMultipleResetsSwap?)

public bool Equals(MakeMultipleResetsSwap? other)

Parameters

other MakeMultipleResetsSwap

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ReceiveFixed(bool)

Sets whether the fixed rate is received.

public MakeMultipleResetsSwap ReceiveFixed(bool flag = true)

Parameters

flag bool

Whether it is.

Returns

MakeMultipleResetsSwap

The modified builder.

ToString()

public override string ToString()

Returns

string

ToSwap(EvaluationContext)

Builds the swap.

public MultipleResetsSwap ToSwap(EvaluationContext context)

Parameters

context EvaluationContext

The evaluation context, whose evaluation date the start is counted from.

Returns

MultipleResetsSwap

The swap.

Exceptions

ArgumentNullException

context is null.

NanoQLException

Both a start date and settlement days were given; or, with no fixed rate given, the index has no forwarding curve and no engine was set, or the engine gives no fair rate; each with QuantLib's text.

WithAveragingMethod(RateAveragingType)

Sets how the floating fixings combine.

public MakeMultipleResetsSwap WithAveragingMethod(RateAveragingType m)

Parameters

m RateAveragingType

The method.

Returns

MakeMultipleResetsSwap

The modified builder.

Exceptions

ArgumentOutOfRangeException

The method isn't a member of the enum.

WithDiscountingTermStructure(YieldTermStructure?)

Sets DiscountingSwapEngine on a discount curve, without the settlement date's flows, as the engine that computes the par rate when no fixed rate is given.

public MakeMultipleResetsSwap WithDiscountingTermStructure(YieldTermStructure? d)

Parameters

d YieldTermStructure

The discount curve, or null, QuantLib's empty handle: the engine then refuses to price, so a build at the par rate is refused.

Returns

MakeMultipleResetsSwap

The modified builder.

WithEffectiveDate(Date?)

Sets the start date, in place of the settlement days.

public MakeMultipleResetsSwap WithEffectiveDate(Date? d)

Parameters

d Date?

The date, or null, QuantLib's Date(), for none.

Returns

MakeMultipleResetsSwap

The modified builder.

WithFixedLegConvention(BusinessDayConvention)

Sets the fixed leg's convention.

public MakeMultipleResetsSwap WithFixedLegConvention(BusinessDayConvention bdc)

Parameters

bdc BusinessDayConvention

The convention.

Returns

MakeMultipleResetsSwap

The modified builder.

Exceptions

ArgumentOutOfRangeException

The convention isn't a member of the enum.

WithFixedLegDayCount(DayCounter)

Sets the fixed leg's day counter, the index's by default.

public MakeMultipleResetsSwap WithFixedLegDayCount(DayCounter dc)

Parameters

dc DayCounter

The day counter.

Returns

MakeMultipleResetsSwap

The modified builder.

Exceptions

ArgumentNullException

dc is null.

WithFixedLegFrequency(Frequency)

Sets the fixed leg's frequency, the coupons' period by default.

public MakeMultipleResetsSwap WithFixedLegFrequency(Frequency f)

Parameters

f Frequency

The frequency, or NoFrequency for the default.

Returns

MakeMultipleResetsSwap

The modified builder.

Exceptions

ArgumentOutOfRangeException

The frequency isn't a member of the enum.

WithFixedRate(double?)

Sets the fixed rate; with none the swap is built at its par rate.

public MakeMultipleResetsSwap WithFixedRate(double? fixedRate)

Parameters

fixedRate double?

The rate, or null, QuantLib's Null<Rate>().

Returns

MakeMultipleResetsSwap

The modified builder.

WithFloatingLegSpread(double)

Sets the spread added to each floating fixing.

public MakeMultipleResetsSwap WithFloatingLegSpread(double sp)

Parameters

sp double

The spread.

Returns

MakeMultipleResetsSwap

The modified builder.

WithForwardStart(Period)

Sets the forward start from the spot date.

public MakeMultipleResetsSwap WithForwardStart(Period fwdStart)

Parameters

fwdStart Period

The forward start.

Returns

MakeMultipleResetsSwap

The modified builder.

WithNominal(double)

Sets the nominal.

public MakeMultipleResetsSwap WithNominal(double n)

Parameters

n double

The nominal.

Returns

MakeMultipleResetsSwap

The modified builder.

WithPricingEngine(Func<FixedVsFloatingSwap, EvaluationContext, FixedVsFloatingSwapResults>?)

Sets the engine that computes the par rate when no fixed rate is given; it is never stored on the swap.

public MakeMultipleResetsSwap WithPricingEngine(Func<FixedVsFloatingSwap, EvaluationContext, FixedVsFloatingSwapResults>? engine)

Parameters

engine Func<FixedVsFloatingSwap, EvaluationContext, FixedVsFloatingSwapResults>

The engine, or null for the default: a DiscountingSwapEngine on the index's forwarding curve.

Returns

MakeMultipleResetsSwap

The modified builder.

WithSettlementDays(int?)

Sets the settlement days from the evaluation date to the start, the index's fixing days by default.

public MakeMultipleResetsSwap WithSettlementDays(int? settlementDays)

Parameters

settlementDays int?

The days, or null for the default.

Returns

MakeMultipleResetsSwap

The modified builder.

Exceptions

ArgumentOutOfRangeException

The days are negative.

WithTerminationDate(Date?)

Sets the end date, in place of the tenor.

public MakeMultipleResetsSwap WithTerminationDate(Date? d)

Parameters

d Date?

The date, or null, QuantLib's Date(), for none.

Returns

MakeMultipleResetsSwap

The modified builder.

WithType(SwapType)

Sets whether the fixed rate is paid or received.

public MakeMultipleResetsSwap WithType(SwapType type)

Parameters

type SwapType

The type.

Returns

MakeMultipleResetsSwap

The modified builder.

Exceptions

ArgumentOutOfRangeException

The type isn't a member of the enum.

Operators

operator ==(MakeMultipleResetsSwap?, MakeMultipleResetsSwap?)

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

Parameters

left MakeMultipleResetsSwap
right MakeMultipleResetsSwap

Returns

bool

operator !=(MakeMultipleResetsSwap?, MakeMultipleResetsSwap?)

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

Parameters

left MakeMultipleResetsSwap
right MakeMultipleResetsSwap

Returns

bool