Class InterpolatedZeroInflationCurve<TInterpolator>
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
An inflation term structure interpolating zero-coupon inflation rates.
public class InterpolatedZeroInflationCurve<TInterpolator> : ZeroInflationTermStructure, IInterpolatedCurve<ZeroInflationTraits, TInterpolator> where TInterpolator : struct, IInterpolator
Type Parameters
TInterpolatorThe interpolator.
- Inheritance
-
InterpolatedZeroInflationCurve<TInterpolator>
- Implements
-
IInterpolatedCurve<ZeroInflationTraits, TInterpolator>
- Derived
- Inherited Members
- Extension Methods
Remarks
The first date is the base date. A rate is the interpolation's value at the start of the date's inflation period, extrapolated, with the seasonality's correction. The curve implements IInterpolatedCurve<TTraits, TInterpolator> over ZeroInflationTraits, as the piecewise zero-inflation curve does.
QuantLib's protected constructor without nodes, through which its piecewise curve derives, isn't ported: the piecewise curve implements the interface itself. An extension point, for its named class.
QuantLib reads the first date before it checks how many there are, so with no date it throws
std::out_of_range; here an empty list is refused at that point with QuantLib's own "too few dates", the
playbook's convention for such an exception.
Constructors
InterpolatedZeroInflationCurve(Date, IEnumerable<Date>, IEnumerable<double>, Frequency, DayCounter, Seasonality?, TInterpolator)
Initializes a new instance of the InterpolatedZeroInflationCurve<TInterpolator> class.
public InterpolatedZeroInflationCurve(Date referenceDate, IEnumerable<Date> dates, IEnumerable<double> rates, Frequency frequency, DayCounter dayCounter, Seasonality? seasonality = null, TInterpolator interpolator = default)
Parameters
referenceDateDateThe reference date.
datesIEnumerable<Date>The nodes' dates, sorted, the first one the base date.
ratesIEnumerable<double>The zero-coupon inflation rates at the nodes, one per date.
frequencyFrequencyThe frequency of the index the curve forecasts.
dayCounterDayCounterThe day counter.
seasonalitySeasonalityThe seasonality, or null for none.
interpolatorTInterpolatorThe interpolator.
Exceptions
- ArgumentNullException
dates,ratesordayCounteris null.- ArgumentException
There are fewer than two dates, a date is
default(Date), the rates aren't one per date, a rate after the first isn't above -100%, the dates aren't sorted or two give the same time, or the interpolation refuses the points.- ArgumentOutOfRangeException
frequencyisn't a member of its type.- NanoQLException
The seasonality is inconsistent with the curve.
Properties
MaxDate
Gets the latest date for which the curve can return values.
public override sealed Date MaxDate { get; }
Property Value
Methods
Data()
The curve's data at its nodes, as its traits read them (discount factors, rates).
public ImmutableArray<double> Data()
Returns
- ImmutableArray<double>
The data.
Dates()
The dates of the curve's nodes.
public ImmutableArray<Date> Dates()
Returns
- ImmutableArray<Date>
The dates.
Nodes()
The curve's nodes: each date with the data at it.
public ImmutableArray<KeyValuePair<Date, double>> Nodes()
Returns
- ImmutableArray<KeyValuePair<Date, double>>
The nodes.
Rates()
The zero-coupon inflation rates at the nodes.
public ImmutableArray<double> Rates()
Returns
- ImmutableArray<double>
The rates.
Times()
The times of the curve's nodes, from the reference date.
public ImmutableArray<double> Times()
Returns
- ImmutableArray<double>
The times.
ZeroRateImpl(double)
The zero-coupon inflation rate at a time, which a derived structure computes.
protected override sealed double ZeroRateImpl(double t)
Parameters
tdoubleThe time.
Returns
- double
The rate.