Class CPIVolatilitySurface
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The base class of zero-inflation (CPI, RPI, HICP) volatility structures, which observe an index with a lag.
public abstract class CPIVolatilitySurface : VolatilityTermStructure
- Inheritance
-
CPIVolatilitySurface
- Derived
- Inherited Members
- Extension Methods
Remarks
CPI volatility is always with respect to a base date. An observation lag of null, or QuantLib's
sentinel Period(-1, Days), means the structure's own ObservationLag.
An extension point. QuantLib's only constructor computes the reference date from settlement days and the evaluation
date; here the derived class's Create computes it and passes it in, so every built structure has a fixed
reference date.
Constructors
CPIVolatilitySurface(Date, int, Calendar, BusinessDayConvention, DayCounter, Period, Frequency, bool)
Initializes a new instance of the CPIVolatilitySurface class.
protected CPIVolatilitySurface(Date referenceDate, int settlementDays, Calendar calendar, BusinessDayConvention bdc, DayCounter dc, Period observationLag, Frequency frequency, bool indexIsInterpolated)
Parameters
referenceDateDateThe reference date, the given business days after the evaluation date.
settlementDaysintThe business days the reference date was computed with.
calendarCalendarThe calendar of the business days and of the option dates.
bdcBusinessDayConventionThe convention adjusting option dates computed from tenors.
dcDayCounterThe day counter.
observationLagPeriodThe lag the structure observes the index with.
frequencyFrequencyThe index's frequency.
indexIsInterpolatedboolWhether the index is observed with linear interpolation.
Exceptions
- ArgumentNullException
calendarordcis null.- ArgumentOutOfRangeException
settlementDaysis negative, orbdcorfrequencyisn't a member of its type.
Properties
Frequency
Gets the index's frequency.
public virtual Frequency Frequency { get; }
Property Value
IndexIsInterpolated
Gets a value indicating whether the index is observed with linear interpolation.
public virtual bool IndexIsInterpolated { get; }
Property Value
ObservationLag
Gets the lag the structure observes the index with, which usually differs from the index's availability lag.
public virtual Period ObservationLag { get; }
Property Value
Methods
BaseDate()
The base date: the reference date less the observation lag, at the start of its inflation period unless the index is interpolated. It is in the past because of the lag.
public virtual Date BaseDate()
Returns
- Date
The date.
Exceptions
- ArgumentOutOfRangeException
The index isn't interpolated and its frequency isn't one InflationPeriod(Date, Frequency) handles.
BaseLevel()
The volatility at the base date, which acts as the zero-time value for bootstrapping.
public virtual double BaseLevel()
Returns
- double
The volatility.
Exceptions
- NanoQLException
The structure has no base level.
CheckRange(Date, double, bool)
Checks that a date and a strike are within the structure's range, or that extrapolation is allowed.
protected virtual void CheckRange(Date d, double strike, bool extrapolate)
Parameters
Exceptions
- NanoQLException
The date is before the base date, or past the maximum date, or the strike is outside the domain, without extrapolation.
CheckRange(double, double, bool)
Checks that a time and a strike are within the structure's range, or that extrapolation is allowed.
protected virtual void CheckRange(double t, double strike, bool extrapolate)
Parameters
Exceptions
- NanoQLException
The time is before the base date's, or past the maximum time, or the strike is outside the domain, without extrapolation.
SetBaseLevel(double)
Sets the base level, QuantLib's protected baseLevel_, while a derived structure is built.
protected void SetBaseLevel(double v)
Parameters
vdoubleThe volatility at the base date.
TimeFromBase(Date, Period?)
The time from the base date to a date observed with a lag.
public virtual double TimeFromBase(Date date, Period? obsLag = null)
Parameters
Returns
- double
The time, by the structure's day counter.
TotalVariance(Date, double, Period?, bool)
The total integrated variance for an exercise date and a strike: the squared volatility times the time from the base date. "Total" because the structure doesn't know whether it is Black, Bachelier or displaced-diffusion variance.
public virtual double TotalVariance(Date exerciseDate, double strike, Period? obsLag = null, bool extrapolate = false)
Parameters
exerciseDateDateThe exercise date.
strikedoubleThe strike.
obsLagPeriod?The observation lag, or null for the structure's.
extrapolateboolWhether to extrapolate.
Returns
- double
The variance.
Exceptions
- NanoQLException
The observed date or the strike is out of range.
TotalVariance(Period, double, Period?, bool)
The total integrated variance for an option tenor and a strike.
public virtual double TotalVariance(Period optionTenor, double strike, Period? obsLag = null, bool extrapolate = false)
Parameters
optionTenorPeriodThe option tenor.
strikedoubleThe strike.
obsLagPeriod?The observation lag, or null for the structure's.
extrapolateboolWhether to extrapolate.
Returns
- double
The variance.
Exceptions
- NanoQLException
The observed date or the strike is out of range.
Volatility(Date, double, Period?, bool)
The volatility for a maturity date and a strike, observed with a lag.
public double Volatility(Date maturityDate, double strike, Period? obsLag = null, bool extrapolate = false)
Parameters
maturityDateDateThe maturity date.
strikedoubleThe strike.
obsLagPeriod?The observation lag, or null for the structure's.
extrapolateboolWhether to extrapolate.
Returns
- double
The volatility.
Exceptions
- NanoQLException
The observed date or the strike is out of range.
Volatility(Period, double, Period?, bool)
The volatility for an option tenor and a strike, observed with a lag.
public double Volatility(Period optionTenor, double strike, Period? obsLag = null, bool extrapolate = false)
Parameters
optionTenorPeriodThe option tenor.
strikedoubleThe strike.
obsLagPeriod?The observation lag, or null for the structure's.
extrapolateboolWhether to extrapolate.
Returns
- double
The volatility.
Exceptions
- NanoQLException
The observed date or the strike is out of range.
Volatility(double, double)
The volatility for a time and a strike, with no lag or interpolation applied to the time.
public double Volatility(double time, double strike)
Parameters
Returns
- double
The volatility.
VolatilityImpl(double, double)
The volatility at a time and a strike, which a derived structure computes.
protected abstract double VolatilityImpl(double length, double strike)
Parameters
Returns
- double
The volatility.