Class BMASwap
- Namespace
- NanoQL.Instruments
- Assembly
- NanoQL.dll
A swap paying Libor against BMA coupons.
public sealed class BMASwap : Swap
- Inheritance
-
BMASwap
- Inherited Members
Remarks
The type, payer or receiver, refers to the BMA leg. The Libor leg is the first leg, Ibor coupons geared by the Libor fraction with the Libor spread; the BMA leg is the second, average-BMA coupons. Each leg's payments follow its schedule's convention.
The constructor builds the Libor leg with the index's default pricer, which reads the context's at-par switch, so it takes the context. It refuses a type that isn't a member of SwapType on entry, before it builds the legs, where QuantLib refuses it after them. An engine's results are a BMASwapResults, with QuantLib's inspectors derived from the swap's results.
Constructors
BMASwap(SwapType, double, Schedule, double, double, IborIndex, DayCounter?, Schedule, BMAIndex, DayCounter?, EvaluationContext)
Initializes a new instance of the BMASwap class.
public BMASwap(SwapType type, double nominal, Schedule liborSchedule, double liborFraction, double liborSpread, IborIndex liborIndex, DayCounter? liborDayCount, Schedule bmaSchedule, BMAIndex bmaIndex, DayCounter? bmaDayCount, EvaluationContext context)
Parameters
typeSwapTypeWhether the BMA leg is paid or received.
nominaldoubleThe nominal of both legs.
liborScheduleScheduleThe Libor leg's schedule.
liborFractiondoubleThe gearing of the Libor fixings.
liborSpreaddoubleThe spread over the Libor leg.
liborIndexIborIndexThe Libor leg's index.
liborDayCountDayCounterThe Libor leg's day counter; the index's when null, QuantLib's empty day counter.
bmaScheduleScheduleThe BMA leg's schedule.
bmaIndexBMAIndexThe BMA index.
bmaDayCountDayCounterThe BMA leg's day counter; the index's when null, QuantLib's empty day counter.
contextEvaluationContextThe evaluation context, whose at-par switch the Libor leg reads.
Exceptions
- ArgumentNullException
An argument but a day counter is null.
- ArgumentOutOfRangeException
typeisn't a member of its type.- ArgumentException
A leg can't be built from its arguments, a zero gearing among them.
- NanoQLException
A leg can't be built from its arguments, an empty schedule among them.
Properties
BmaLeg
Gets the BMA leg.
public ImmutableArray<CashFlow> BmaLeg { get; }
Property Value
LiborFraction
Gets the gearing of the Libor fixings.
public double LiborFraction { get; }
Property Value
LiborLeg
Gets the Libor leg.
public ImmutableArray<CashFlow> LiborLeg { get; }
Property Value
LiborSpread
Gets the spread over the Libor leg.
public double LiborSpread { get; }
Property Value
Nominal
Gets the nominal of both legs.
public double Nominal { get; }
Property Value
Type
Gets whether the BMA leg is paid or received.
public SwapType Type { get; }
Property Value
Methods
FetchResults(InstrumentResults)
Reads an engine's results into the instrument's, applying any derivations the instrument makes.
public override BMASwapResults FetchResults(InstrumentResults results)
Parameters
resultsInstrumentResultsThe engine's results.
Returns
- BMASwapResults
The instrument's results.
Remarks
The fair Libor fraction and spread are derived from the swap's results, as QuantLib derives them.
Exceptions
- ArgumentException
The results aren't a swap's, or a per-leg result has the wrong number of legs.
SetupExpired()
The results of an expired instrument: a zero value and error estimate, and no valuation date.
public override BMASwapResults SetupExpired()
Returns
- BMASwapResults
The expired results.
Remarks
An expired swap has zero leg NPVs and BPS, so no fair Libor fraction, and a fair Libor spread of NaN, the quotient of zeros QuantLib computes.