Class OvernightOvernightBasisSwapRateHelper
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
A rate helper for bootstrapping over overnight-overnight basis swaps.
[Experimental("NQL0001")]
public sealed class OvernightOvernightBasisSwapRateHelper : RelativeDateRateHelper, IBootstrapHelper
- Inheritance
-
OvernightOvernightBasisSwapRateHelper
- Implements
- Inherited Members
- Extension Methods
Remarks
The swap is assumed to pay the base index plus the basis and receive the other index. The helper can be used to bootstrap the forecast curve for either index; the other index must have an existing forecast curve.
An exogenous discount curve can be passed. If none is passed, the curve being bootstrapped is also used for discounting.
Both legs share the same schedule and payment lag, but their averaging methods can be configured independently. This allows, for instance, an arithmetically averaged Fed Funds leg to be matched against a compounded SOFR leg. Telescopic value dates are only applied to compounded legs. Arithmetically averaged legs retain their full value-date schedule so that they are priced exactly.
Passing NoFrequency as the payment frequency creates one coupon on each leg spanning the full swap tenor.
The helper builds its swap, on a nominal of 100, when it is constructed and when it is re-dated, so it reads the context's evaluation date then. Bound to the curve being built, its bootstrapped leg is rebuilt on the index cloned onto that curve, what QuantLib's relinked handle gives its coupons.
Constructors
OvernightOvernightBasisSwapRateHelper(double, Period, int, Calendar, BusinessDayConvention, bool, OvernightIndex, OvernightIndex, EvaluationContext, YieldTermStructure?, bool, int, Frequency, RateAveragingType, RateAveragingType, bool, DateGenerationRule)
Initializes a new instance of the OvernightOvernightBasisSwapRateHelper class.
public OvernightOvernightBasisSwapRateHelper(double basis, Period tenor, int settlementDays, Calendar calendar, BusinessDayConvention convention, bool endOfMonth, OvernightIndex baseIndex, OvernightIndex otherIndex, EvaluationContext context, YieldTermStructure? discountHandle = null, bool bootstrapBaseCurve = false, int paymentLag = 0, Frequency paymentFrequency = Frequency.Annual, RateAveragingType baseAveragingMethod = RateAveragingType.Compound, RateAveragingType otherAveragingMethod = RateAveragingType.Compound, bool telescopicValueDates = false, DateGenerationRule rule = DateGenerationRule.Backward)
Parameters
basisdoubleThe quoted basis, added to the base index.
tenorPeriodThe swap's maturity, from the settlement date.
settlementDaysintThe settlement days, counted from the evaluation date on the calendar.
calendarCalendarThe calendar of the settlement and the schedule.
conventionBusinessDayConventionThe schedule's business-day convention.
endOfMonthboolWhether the schedule follows the end-of-month rule.
baseIndexOvernightIndexThe index of the leg that pays the basis.
otherIndexOvernightIndexThe index of the other leg.
contextEvaluationContextThe evaluation context, read when the swap is built.
discountHandleYieldTermStructureThe exogenous discount curve; the curve being bootstrapped when null.
bootstrapBaseCurveboolWhether the base index's forecast curve is bootstrapped, rather than the other index's.
paymentLagintThe payment lag of both legs, in business days.
paymentFrequencyFrequencyThe legs' payment frequency.
baseAveragingMethodRateAveragingTypeThe base leg's averaging method.
otherAveragingMethodRateAveragingTypeThe other leg's averaging method.
telescopicValueDatesboolWhether the compounded legs use telescopic value dates.
ruleDateGenerationRuleThe schedule's date-generation rule.
Exceptions
- ArgumentNullException
An index, the calendar or the context is null.
- ArgumentOutOfRangeException
settlementDaysis negative, or an enum argument isn't a member of its enum or a frequency a period has.- ArgumentException
The swap can't be built from the arguments.
Properties
Swap
Gets the swap the helper prices: QuantLib's swap(), the base leg first.
public Swap Swap { get; }
Property Value
Methods
ImpliedQuote(EvaluationContext)
The quote implied by the term structure the helper is bound to.
public override double ImpliedQuote(EvaluationContext context)
Parameters
contextEvaluationContextThe evaluation context.
Returns
- double
The implied quote.
Exceptions
- ArgumentNullException
contextis null.- NanoQLException
The helper isn't bound to a term structure.
- NanoQLException
The swap's results aren't available.
InitializeDates(EvaluationContext)
Computes the helper's dates for an evaluation date: QuantLib's initializeDates(). A helper whose dates
follow the evaluation date overrides it and calls it from its constructor; the bootstraps call it on a fresh copy
to re-date the helper for a curve built under another evaluation date. The base does nothing.
protected override void InitializeDates(EvaluationContext context)
Parameters
contextEvaluationContextThe evaluation context whose evaluation date the dates are computed from.
WithTermStructure(YieldTermStructure)
A copy of the helper bound to a term structure: QuantLib's setTermStructure. A derived helper that prices
against the term structure overrides it, calls the base, and rebuilds on the copy what prices against it.
protected override BootstrapHelper<YieldTermStructure> WithTermStructure(YieldTermStructure t)
Parameters
tYieldTermStructureThe term structure.
Returns
- BootstrapHelper<YieldTermStructure>
The copy, of the receiver's runtime type; the receiver is unchanged.
Exceptions
- ArgumentNullException
tis null.