Class CPICapFloorTermPriceSurface
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
CPI cap and floor prices by maturity and strike, filled across all strikes by put-call parity: QuantLib's
CPICapFloorTermPriceSurface.
[Experimental("NQL0001")]
public abstract class CPICapFloorTermPriceSurface : TermStructure
- Inheritance
-
CPICapFloorTermPriceSurface
- Derived
-
InterpolatedCPICapFloorTermPriceSurface<TInterpolator2D>
- Inherited Members
- Extension Methods
Remarks
A CPI cap or floor has one flow, on cumulative inflation to its maturity, so no stripping is needed, and the index's zero-inflation curve gives the at-the-money level. Strikes are quoted as yearly average inflation and become actual strikes as (1 + quote)^T, as zero-coupon inflation swaps quote; the observation lag is the quoted instruments'.
An extension point: InterpolatedCPICapFloorTermPriceSurface<TInterpolator2D> derives from it. QuantLib's
surface follows the evaluation date (TermStructure(0, …)), so a derived class's factory computes the
reference date and passes it in; AtmRate(Date, EvaluationContext) and Price(Date, double, EvaluationContext) read
the index's fixings, from the context. The protected range checks, which QuantLib never calls, are kept; a price
past the last maturity or strike extrapolates.
Constructors
CPICapFloorTermPriceSurface(Date, double, double, Period, Calendar, BusinessDayConvention, DayCounter, ZeroInflationIndex, CPIInterpolationType, YieldTermStructure, IReadOnlyList<double>, IReadOnlyList<double>, IReadOnlyList<Period>, Matrix, Matrix)
Initializes a new instance of the CPICapFloorTermPriceSurface class.
protected CPICapFloorTermPriceSurface(Date referenceDate, double nominal, double baseRate, Period observationLag, Calendar cal, BusinessDayConvention bdc, DayCounter dc, ZeroInflationIndex zii, CPIInterpolationType interpolationType, YieldTermStructure yts, IReadOnlyList<double> cStrikes, IReadOnlyList<double> fStrikes, IReadOnlyList<Period> cfMaturities, Matrix cPrice, Matrix fPrice)
Parameters
referenceDateDateThe reference date, the evaluation date adjusted.
nominaldoubleThe prices' nominal.
baseRatedoubleThe at-the-money rate at the reference date, where no inflation time has passed.
observationLagPeriodThe quoted instruments' observation lag.
calCalendarThe calendar adjusting option dates.
bdcBusinessDayConventionThe convention adjusting option dates.
dcDayCounterThe day counter.
ziiZeroInflationIndexThe zero-inflation index, which must hold a zero-inflation curve.
interpolationTypeCPIInterpolationTypeHow the index is observed.
ytsYieldTermStructureThe nominal curve.
cStrikesIReadOnlyList<double>The cap strikes, quoted.
fStrikesIReadOnlyList<double>The floor strikes, quoted.
cfMaturitiesIReadOnlyList<Period>The maturities, increasing.
cPriceMatrixThe cap prices, a row per cap strike and a column per maturity.
fPriceMatrixThe floor prices, a row per floor strike and a column per maturity.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentOutOfRangeException
An enum argument isn't a member of its enum.
- NanoQLException
The index has no zero-inflation curve, or the data are too few, mis-sized, non-positive or not monotonic, with QuantLib's texts.
Properties
BaseRate
Gets the at-the-money rate at the reference date.
public virtual double BaseRate { get; }
Property Value
BusinessDayConvention
Gets the convention adjusting option dates.
public virtual BusinessDayConvention BusinessDayConvention { get; }
Property Value
CapStrikes
Gets the cap strikes, quoted.
public virtual ImmutableArray<double> CapStrikes { get; }
Property Value
FloorStrikes
Gets the floor strikes, quoted.
public virtual ImmutableArray<double> FloorStrikes { get; }
Property Value
Frequency
Gets the index's frequency.
public virtual Frequency Frequency { get; }
Property Value
InterpolationType
Gets how the index is observed.
protected CPIInterpolationType InterpolationType { get; }
Property Value
Maturities
Gets the maturities.
public virtual ImmutableArray<Period> Maturities { get; }
Property Value
MaxDate
Gets the latest date for which the curve can return values.
public override Date MaxDate { get; }
Property Value
Remarks
The reference date plus the last maturity.
MaxStrike
Gets the highest strike.
public virtual double MaxStrike { get; }
Property Value
MinDate
Gets the earliest maturity's date, the reference date plus the first maturity.
public virtual Date MinDate { get; }
Property Value
MinStrike
Gets the lowest strike.
public virtual double MinStrike { get; }
Property Value
Nominal
Gets the prices' nominal.
public virtual double Nominal { get; }
Property Value
NominalTermStructure
Gets the nominal curve.
protected YieldTermStructure NominalTermStructure { get; }
Property Value
ObservationLag
Gets the quoted instruments' observation lag.
public virtual Period ObservationLag { get; }
Property Value
Strikes
Gets the strikes, the floors' and the caps' above them, quoted.
public virtual ImmutableArray<double> Strikes { get; }
Property Value
ZeroInflationIndex
Gets the zero-inflation index.
public ZeroInflationIndex ZeroInflationIndex { get; }
Property Value
Methods
AtmRate(Date, EvaluationContext)
The at-the-money rate to a maturity: the index's lagged fixing growth from the reference date, as a yearly rate over its inflation time; the base rate where no time has passed.
public double AtmRate(Date maturity, EvaluationContext context)
Parameters
maturityDateThe maturity.
contextEvaluationContextThe evaluation context, whose fixings the index reads.
Returns
- double
The rate.
Exceptions
- ArgumentNullException
contextis null.- NanoQLException
A fixing can't be read or forecast.
BaseDate()
The base date: the index's zero-inflation curve's.
public virtual Date BaseDate()
Returns
- Date
The date.
CapPrice(Date, double)
The cap price at a date and a quoted strike.
public abstract double CapPrice(Date d, double k)
Parameters
Returns
- double
The price.
CapPrice(Period, double)
The cap price at a tenor and a quoted strike.
public virtual double CapPrice(Period d, double k)
Parameters
Returns
- double
The price.
CapPrices()
The cap prices, a row per cap strike and a column per maturity.
public virtual Matrix CapPrices()
Returns
- Matrix
A copy.
CheckMaturity(Date)
Whether a date lies within the surface's maturities: QuantLib's protected check, which nothing calls.
protected virtual bool CheckMaturity(Date d)
Parameters
dDateThe date.
Returns
CheckStrike(double)
Whether a strike lies within the surface's strikes: QuantLib's protected check, which nothing calls.
protected virtual bool CheckStrike(double k)
Parameters
kdoubleThe strike.
Returns
CpiOptionDateFromTenor(Period)
The option date of a tenor: the reference date plus the tenor, adjusted.
public virtual Date CpiOptionDateFromTenor(Period p)
Parameters
pPeriodThe tenor.
Returns
- Date
The date.
FloorPrice(Date, double)
The floor price at a date and a quoted strike.
public abstract double FloorPrice(Date d, double k)
Parameters
Returns
- double
The price.
FloorPrice(Period, double)
The floor price at a tenor and a quoted strike.
public virtual double FloorPrice(Period d, double k)
Parameters
Returns
- double
The price.
FloorPrices()
The floor prices, a row per floor strike and a column per maturity.
public virtual Matrix FloorPrices()
Returns
- Matrix
A copy.
Price(Date, double, EvaluationContext)
The price at a date and a quoted strike, a cap's above the at-the-money rate and a floor's below.
public abstract double Price(Date d, double k, EvaluationContext context)
Parameters
dDateThe date.
kdoubleThe strike, quoted.
contextEvaluationContextThe evaluation context, whose fixings the at-the-money rate reads.
Returns
- double
The price.
Price(Period, double, EvaluationContext)
The price at a tenor and a quoted strike, a cap's above the at-the-money rate and a floor's below.
public virtual double Price(Period d, double k, EvaluationContext context)
Parameters
dPeriodThe tenor.
kdoubleThe strike, quoted.
contextEvaluationContextThe evaluation context, whose fixings the at-the-money rate reads.
Returns
- double
The price.