Class ZeroCouponSwap
- Namespace
- NanoQL.Instruments
- Assembly
- NanoQL.dll
A zero-coupon interest-rate swap: at maturity a fixed amount N[(1 + R)^α(T₀, T_K) − 1], or a given one, is swapped for the floating amount N[∏(1 + α(T_k, T_{k+1}) L(T_k, T_{k+1})) − 1], the index's fixings compounded over its own periods.
public sealed class ZeroCouponSwap : Swap
- Inheritance
-
ZeroCouponSwap
- Inherited Members
Remarks
The legs carry one cash flow each, on unadjusted dates; only the payment date is adjusted, the payment delay's business days after maturity. The fixed leg is the first, the floating leg the second. An engine's results are a ZeroCouponSwapResults, whose fair payment DiscountingSwapEngine's overload gives at the fixed flow's payment date, where QuantLib's reads the discount at the fixed leg's maturity date, the accrual end for the fixed-rate constructor's coupon, so with a payment delay its fair payment fed back leaves a non-zero NPV.
Constructors
ZeroCouponSwap(SwapType, double, Date, Date, double, IborIndex, Calendar, BusinessDayConvention, int)
Initializes a new instance of the ZeroCouponSwap class paying a fixed amount.
public ZeroCouponSwap(SwapType type, double baseNominal, Date startDate, Date maturityDate, double fixedPayment, IborIndex iborIndex, Calendar paymentCalendar, BusinessDayConvention paymentConvention = BusinessDayConvention.Following, int paymentDelay = 0)
Parameters
typeSwapTypeWhether the fixed amount is paid (payer) or received.
baseNominaldoubleThe nominal before compounding.
startDateDateThe start date.
maturityDateDateThe maturity date.
fixedPaymentdoubleThe fixed amount.
iborIndexIborIndexThe index compounded on the floating leg.
paymentCalendarCalendarThe calendar the payment date is adjusted on.
paymentConventionBusinessDayConventionThe payment date's convention.
paymentDelayintThe payment delay, in business days after maturity.
Exceptions
- ArgumentNullException
The index or the calendar is null.
- ArgumentOutOfRangeException
The type or the convention isn't a member of its enum, or the delay is negative.
- ArgumentException
The base nominal is negative, or the start isn't before maturity, with QuantLib's texts.
ZeroCouponSwap(SwapType, double, Date, Date, double, DayCounter, IborIndex, Calendar, BusinessDayConvention, int)
Initializes a new instance of the ZeroCouponSwap class paying a fixed rate, compounded annually over the swap's term.
public ZeroCouponSwap(SwapType type, double baseNominal, Date startDate, Date maturityDate, double fixedRate, DayCounter fixedDayCounter, IborIndex iborIndex, Calendar paymentCalendar, BusinessDayConvention paymentConvention = BusinessDayConvention.Following, int paymentDelay = 0)
Parameters
typeSwapTypeWhether the fixed amount is paid (payer) or received.
baseNominaldoubleThe nominal before compounding.
startDateDateThe start date.
maturityDateDateThe maturity date.
fixedRatedoubleThe fixed rate.
fixedDayCounterDayCounterThe fixed rate's day counter.
iborIndexIborIndexThe index compounded on the floating leg.
paymentCalendarCalendarThe calendar the payment date is adjusted on.
paymentConventionBusinessDayConventionThe payment date's convention.
paymentDelayintThe payment delay, in business days after maturity.
Exceptions
- ArgumentNullException
The day counter, the index or the calendar is null.
- ArgumentOutOfRangeException
The type or the convention isn't a member of its enum, or the delay is negative.
- ArgumentException
The base nominal is negative, or the start isn't before maturity, with QuantLib's texts.
Properties
BaseNominal
Gets the nominal before compounding.
public double BaseNominal { get; }
Property Value
FixedLeg
Gets the fixed leg.
public ImmutableArray<CashFlow> FixedLeg { get; }
Property Value
FloatingLeg
Gets the floating leg.
public ImmutableArray<CashFlow> FloatingLeg { get; }
Property Value
IborIndex
Gets the index compounded on the floating leg.
public IborIndex IborIndex { get; }
Property Value
PaymentDate
Gets the payment date of both amounts.
public Date PaymentDate { get; }
Property Value
Type
Gets whether the fixed amount is paid (payer) or received.
public SwapType Type { get; }
Property Value
Methods
FairFixedRate(ZeroCouponSwapResults, DayCounter)
The fixed rate, compounded annually over the swap's term on a day counter, that gives the swap a zero
NPV: QuantLib's fairFixedRate, from the results' fair payment.
public double FairFixedRate(ZeroCouponSwapResults results, DayCounter dayCounter)
Parameters
resultsZeroCouponSwapResultsThe swap's results.
dayCounterDayCounterThe rate's day counter.
Returns
- double
The rate.
Exceptions
- ArgumentNullException
An argument is null.
- NanoQLException
The results have no fair payment, QuantLib's "result not available".
FetchResults(InstrumentResults)
The swap's results, with the engine's fair payment when it gave one.
public override ZeroCouponSwapResults FetchResults(InstrumentResults results)
Parameters
resultsInstrumentResultsThe engine's results.
Returns
- ZeroCouponSwapResults
The results.
FixedPayment(EvaluationContext)
The fixed amount.
public double FixedPayment(EvaluationContext context)
Parameters
contextEvaluationContextThe evaluation context.
Returns
- double
The amount.
MaturityDate()
The maturity date.
public override Date MaturityDate()
Returns
- Date
The date the swap was given.
SetupExpired()
The results of an expired instrument: a zero value and error estimate, and no valuation date.
public override ZeroCouponSwapResults SetupExpired()
Returns
- ZeroCouponSwapResults
The expired results.
StartDate()
The start date.
public override Date StartDate()
Returns
- Date
The date the swap was given.