Class InterpolatedForwardCurve<TInterpolator>
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
A yield term structure based on the interpolation of instantaneous forward rates.
public class InterpolatedForwardCurve<TInterpolator> : ZeroYieldStructure, IInterpolatedCurve<ForwardRate, TInterpolator> where TInterpolator : struct, IInterpolator
Type Parameters
TInterpolatorThe interpolator, whose interpolation must have a primitive.
- Inheritance
-
InterpolatedForwardCurve<TInterpolator>
- Implements
-
IInterpolatedCurve<ForwardRate, TInterpolator>
- Derived
- Inherited Members
- Extension Methods
Remarks
The zero rate at a time is the integral of the interpolated forward rates up to it, divided by the time; past the last node the curve extrapolates with the last forward rate. Its formula and maximum date are the ForwardRate traits', which a PiecewiseYieldCurve<TTraits, TInterpolator, TBootstrap> on those traits shares. Unsealed for its named classes, which add constructors only. QuantLib's protected constructors, through which its piecewise curve derives, aren't ported: no class derives through them here.
Constructors
InterpolatedForwardCurve(IEnumerable<Date>, IEnumerable<double>, DayCounter, Calendar?, IEnumerable<double>?, IEnumerable<Date>?, TInterpolator)
Initializes a new instance of the InterpolatedForwardCurve<TInterpolator> class from its nodes; the first date is the reference date.
public InterpolatedForwardCurve(IEnumerable<Date> dates, IEnumerable<double> forwards, DayCounter dayCounter, Calendar? calendar = null, IEnumerable<double>? jumps = null, IEnumerable<Date>? jumpDates = null, TInterpolator interpolator = default)
Parameters
datesIEnumerable<Date>The nodes' dates, sorted.
forwardsIEnumerable<double>The instantaneous forward rates at the nodes.
dayCounterDayCounterThe day counter.
calendarCalendarThe calendar, or null, QuantLib's empty calendar.
jumpsIEnumerable<double>The discount-factor jumps, or null for none.
jumpDatesIEnumerable<Date>The jumps' dates, or null for 31 December of successive years.
interpolatorTInterpolatorThe interpolator.
Exceptions
- ArgumentNullException
dates,forwardsordayCounteris null.- ArgumentException
There are fewer dates than the interpolation needs, the counts of dates and forwards differ, the dates aren't sorted or two of them give the same time, the jumps and their dates differ in number, or the interpolation refuses the nodes.
- NanoQLException
The interpolation refuses the nodes.
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.
Forwards()
The instantaneous forward rates at the curve's nodes, its data.
public ImmutableArray<double> Forwards()
Returns
- ImmutableArray<double>
The forward rates.
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.
Times()
The times of the curve's nodes, from the reference date.
public ImmutableArray<double> Times()
Returns
- ImmutableArray<double>
The times.
ZeroYieldImpl(double)
The zero yield at a time, continuously compounded. Range checks have already been performed, so it must assume that extrapolation is required.
protected override sealed double ZeroYieldImpl(double t)
Parameters
tdoubleThe time.
Returns
- double
The zero yield.