Table of Contents

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

referenceDate Date

The reference date, the given business days after the evaluation date.

settlementDays int

The business days the reference date was computed with.

calendar Calendar

The calendar of the business days and of the option dates.

bdc BusinessDayConvention

The convention adjusting option dates computed from tenors.

dc DayCounter

The day counter.

observationLag Period

The lag the structure observes the index with.

frequency Frequency

The index's frequency.

indexIsInterpolated bool

Whether the index is observed with linear interpolation.

Exceptions

ArgumentNullException

calendar or dc is null.

ArgumentOutOfRangeException

settlementDays is negative, or bdc or frequency isn't a member of its type.

Properties

Frequency

Gets the index's frequency.

public virtual Frequency Frequency { get; }

Property Value

Frequency

IndexIsInterpolated

Gets a value indicating whether the index is observed with linear interpolation.

public virtual bool IndexIsInterpolated { get; }

Property Value

bool

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

Period

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

d Date

The date.

strike double

The strike.

extrapolate bool

Whether this call extrapolates.

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

t double

The time.

strike double

The strike.

extrapolate bool

Whether this call extrapolates.

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

v double

The 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

date Date

The date.

obsLag Period?

The observation lag, or null for the structure's.

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

exerciseDate Date

The exercise date.

strike double

The strike.

obsLag Period?

The observation lag, or null for the structure's.

extrapolate bool

Whether 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

optionTenor Period

The option tenor.

strike double

The strike.

obsLag Period?

The observation lag, or null for the structure's.

extrapolate bool

Whether 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

maturityDate Date

The maturity date.

strike double

The strike.

obsLag Period?

The observation lag, or null for the structure's.

extrapolate bool

Whether 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

optionTenor Period

The option tenor.

strike double

The strike.

obsLag Period?

The observation lag, or null for the structure's.

extrapolate bool

Whether 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

time double

The time.

strike double

The strike.

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

length double

The time.

strike double

The strike.

Returns

double

The volatility.