Table of Contents

Class MakeSwaption

Namespace
NanoQL.Instruments
Assembly
NanoQL.dll

A builder of standard market swaptions on a swap index.

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

Remarks

An immutable builder: each method returns a modified copy, so a builder kept and reused never changes under its holder. ToSwaption(EvaluationContext) builds the swaption, in place of QuantLib's conversion operators. It computes the fixing date from the context's evaluation date at every conversion, where QuantLib's builder keeps the fixing date its first conversion computed: a reused builder follows the context it is converted under.

With no strike, the swaption is struck at the money: at the fair rate of the index's own underlying swap, priced without the settlement date's flows on the index's exogenous discounting curve, or on its forwarding curve. That swap is the index's, so it can differ from the swaption's underlying, which the builder's settings build, as in QuantLib: an Ibor index's swap always reads the context's at-par switch, and an overnight index's takes its telescopic value dates and averaging method, which the underlying doesn't.

WithPricingEngine(Func<Swaption, EvaluationContext, InstrumentResults>?) is kept and changes nothing: QuantLib's builder only attaches the engine to the swaption, computing nothing with it, and a nanoql swaption holds no engine. 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 swaption is built: QuantLib's values with nothing configured.

Constructors

MakeSwaption(SwapIndex, Date, double?)

Initializes a new instance of the MakeSwaption record, from a fixing date.

public MakeSwaption(SwapIndex swapIndex, Date fixingDate, double? strike = null)

Parameters

swapIndex SwapIndex

The swap index, whose swap and conventions the swaption takes.

fixingDate Date

The fixing date.

strike double?

The strike, or null, QuantLib's Null<Rate>(), for the at-the-money strike.

Exceptions

ArgumentNullException

swapIndex is null, which QuantLib dereferences at the conversion.

ArgumentException

fixingDate is default(Date).

MakeSwaption(SwapIndex, Period, double?)

Initializes a new instance of the MakeSwaption record, from an option tenor.

public MakeSwaption(SwapIndex swapIndex, Period optionTenor, double? strike = null)

Parameters

swapIndex SwapIndex

The swap index, whose swap and conventions the swaption takes.

optionTenor Period

The option tenor, from the evaluation date adjusted on the exercise calendar.

strike double?

The strike, or null, QuantLib's Null<Rate>(), for the at-the-money strike.

Exceptions

ArgumentNullException

swapIndex is null, which QuantLib dereferences at the conversion.

Methods

Defaults(ConventionProvider)

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

public static SwaptionDefaults Defaults(ConventionProvider provider)

Parameters

provider ConventionProvider

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

Returns

SwaptionDefaults

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(MakeSwaption?)

public bool Equals(MakeSwaption? other)

Parameters

other MakeSwaption

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

ToSwaption(EvaluationContext)

The swaption: QuantLib's conversion to ext::shared_ptr<Swaption>.

public Swaption ToSwaption(EvaluationContext context)

Parameters

context EvaluationContext

The evaluation context: the fixing date is computed from its evaluation date, and an Ibor underlying's floating leg and an at-the-money strike's Ibor swap read its at-par switch.

Returns

Swaption

The swaption.

Exceptions

ArgumentNullException

The context is null.

NanoQLException

The exercise date is after the fixing date; or, with no strike, the index has no forwarding curve, or its swap can't be priced.

ArgumentException

The fixing date isn't a valid fixing date of the index.

WithAtParCoupons(bool)

Sets whether an Ibor underlying's floating coupons use par coupons rather than indexed coupons.

public MakeSwaption WithAtParCoupons(bool b = true)

Parameters

b bool

The flag.

Returns

MakeSwaption

The modified builder.

WithExerciseCalendar(Calendar?)

Sets the calendar the evaluation date is adjusted on and the option tenor advanced on; by default the index's fixing calendar.

public MakeSwaption WithExerciseCalendar(Calendar? cal)

Parameters

cal Calendar

The calendar, or null, QuantLib's empty calendar, for the index's fixing calendar.

Returns

MakeSwaption

The modified builder.

WithExerciseDate(Date?)

Sets the exercise date, on or before the fixing date; by default the exercise is on the fixing date.

public MakeSwaption WithExerciseDate(Date? date)

Parameters

date Date?

The exercise date, or null, QuantLib's Date(), for the fixing date.

Returns

MakeSwaption

The modified builder.

Exceptions

ArgumentException

date is default(Date).

WithIndexedCoupons(bool?)

Sets whether an Ibor underlying's floating coupons use indexed coupons rather than par coupons; null for the context's switch, the default.

public MakeSwaption WithIndexedCoupons(bool? b = true)

Parameters

b bool?

The flag.

Returns

MakeSwaption

The modified builder.

WithNominal(double)

Sets the underlying swap's nominal.

public MakeSwaption WithNominal(double n)

Parameters

n double

The nominal.

Returns

MakeSwaption

The modified builder.

WithOptionConvention(BusinessDayConvention)

Sets the convention the option tenor's fixing date is adjusted with.

public MakeSwaption WithOptionConvention(BusinessDayConvention bdc)

Parameters

bdc BusinessDayConvention

The convention.

Returns

MakeSwaption

The modified builder.

Exceptions

ArgumentOutOfRangeException

The convention isn't a member of the enum.

WithPricingEngine(Func<Swaption, EvaluationContext, InstrumentResults>?)

Kept from QuantLib, where it attaches the engine to the swaption: it changes nothing, since nothing at build time uses the engine and a swaption holds none. Price the swaption by calling the engine.

public MakeSwaption WithPricingEngine(Func<Swaption, EvaluationContext, InstrumentResults>? engine)

Parameters

engine Func<Swaption, EvaluationContext, InstrumentResults>

The engine, a function of the swaption and the context, such as (s, c) => BlackSwaptionEngine.Calculate(s, c, curve, volatility).

Returns

MakeSwaption

The builder, unchanged.

WithSettlementMethod(SettlementMethod)

Sets the settlement method.

public MakeSwaption WithSettlementMethod(SettlementMethod settlementMethod)

Parameters

settlementMethod SettlementMethod

The settlement method.

Returns

MakeSwaption

The modified builder.

Exceptions

ArgumentOutOfRangeException

The method isn't a member of the enum.

WithSettlementType(SettlementType)

Sets the settlement type.

public MakeSwaption WithSettlementType(SettlementType delivery)

Parameters

delivery SettlementType

The settlement type.

Returns

MakeSwaption

The modified builder.

Exceptions

ArgumentOutOfRangeException

The type isn't a member of the enum.

WithUnderlyingType(SwapType)

Sets the underlying swap's type: payer or receiver of the fixed rate.

public MakeSwaption WithUnderlyingType(SwapType type)

Parameters

type SwapType

The type.

Returns

MakeSwaption

The modified builder.

Exceptions

ArgumentOutOfRangeException

The type isn't a member of the enum.

Operators

operator ==(MakeSwaption?, MakeSwaption?)

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

Parameters

left MakeSwaption
right MakeSwaption

Returns

bool

operator !=(MakeSwaption?, MakeSwaption?)

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

Parameters

left MakeSwaption
right MakeSwaption

Returns

bool