Class InterpolatedCurve<TInterpolator>
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The data of an interpolated term structure: the times of its nodes, its data at them, their interpolation and the maximum date, which an interpolated curve holds and answers from.
public sealed class InterpolatedCurve<TInterpolator> where TInterpolator : struct, IInterpolator
Type Parameters
TInterpolatorThe interpolator.
- Inheritance
-
InterpolatedCurve<TInterpolator>
- Inherited Members
Remarks
QuantLib's InterpolatedCurve is a protected base its curves inherit their data members from; nanoql's curves
hold one instead, so no is-a relation is lost (QuantLib's inheritance is protected). Immutable: it copies its inputs
and builds its interpolation once.
Properties
Interpolation
Gets the interpolation of the data: the interpolator's, or a bootstrap's linear interpolation where the interpolator couldn't be built over the curve's nodes.
public Interpolation Interpolation { get; }
Property Value
Interpolator
Gets the interpolator the curve was built with.
public TInterpolator Interpolator { get; }
Property Value
- TInterpolator
MaxDate
Gets the latest date a bootstrap's helpers needed, which may be past the last node, or null
for a curve that wasn't bootstrapped: QuantLib's maxDate_.
public Date? MaxDate { get; }
Property Value
- Date?
Methods
Create(ReadOnlySpan<Date>, ReadOnlySpan<double>, Date, DayCounter, TInterpolator)
The data of a curve given its nodes' dates: the times from the reference date, checked as QuantLib's
setupTimes checks them, and the interpolation built over them: QuantLib's setupInterpolation.
public static InterpolatedCurve<TInterpolator> Create(ReadOnlySpan<Date> dates, ReadOnlySpan<double> data, Date referenceDate, DayCounter dayCounter, TInterpolator interpolator = default)
Parameters
datesReadOnlySpan<Date>The nodes' dates, sorted, each with its own time under the day counter.
dataReadOnlySpan<double>The data at the nodes, one per date.
referenceDateDateThe date the times are measured from.
dayCounterDayCounterThe day counter measuring the times.
interpolatorTInterpolatorThe interpolator.
Returns
- InterpolatedCurve<TInterpolator>
The curve's data.
Exceptions
- ArgumentNullException
dayCounteris null.- ArgumentException
No date is given, a date is
default(Date), the dates aren't sorted, two of them give the same time, or the interpolation refuses the points.- NanoQLException
The interpolation refuses the points.
Data()
The curve's data at its nodes.
public ImmutableArray<double> Data()
Returns
- ImmutableArray<double>
The data.
Times()
The times of the curve's nodes, from the reference date.
public ImmutableArray<double> Times()
Returns
- ImmutableArray<double>
The times.