Class CapFloorTermVolSurface
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The cap/floor smile volatility surface: the volatility for a given cap/floor, interpolated in a surface of the market term volatilities of a set of caps and floors of given lengths and strikes.
public sealed class CapFloorTermVolSurface : CapFloorTermVolatilityStructure
- Inheritance
-
CapFloorTermVolSurface
- Inherited Members
- Extension Methods
Remarks
The volatility matrix has a row per option tenor and a column per strike; the constructor copies it. The option dates and times are computed from the reference date when the surface is built, and the interpolation is a BicubicSpline over the strikes (x) and the option times (y), which always extrapolates inside the structure's range checks: a time before the first option time, or a strike between the strikes' range and the structure's, extrapolates.
QuantLib's constructors on quotes and on a Matrix coincide once a quote is a double: the Matrix forms are kept, so an empty matrix reaches QuantLib's own checks, where QuantLib's quote forms read its first row first. The floating forms, whose reference date QuantLib moves with the evaluation date, are Create(int, Calendar, BusinessDayConvention, IEnumerable<Period>, IEnumerable<double>, Matrix, EvaluationContext, DayCounter?): a surface under a later evaluation date is a new surface, whose option dates are that date's, where QuantLib's moving surface can keep the previous reference date's option dates (a documented divergence).
Constructors
CapFloorTermVolSurface(Date, Calendar?, BusinessDayConvention, IEnumerable<Period>, IEnumerable<double>, Matrix, DayCounter?)
Initializes a new instance of the CapFloorTermVolSurface class with a fixed reference date: the settlement date.
public CapFloorTermVolSurface(Date settlementDate, Calendar? calendar, BusinessDayConvention bdc, IEnumerable<Period> optionTenors, IEnumerable<double> strikes, Matrix volatilities, DayCounter? dc = null)
Parameters
settlementDateDateThe settlement date, the reference date.
calendarCalendarThe calendar of the option dates, or null, QuantLib's empty calendar, with which the option dates can't be computed.
bdcBusinessDayConventionThe convention adjusting the option dates.
optionTenorsIEnumerable<Period>The option tenors, positive and increasing.
strikesIEnumerable<double>The strikes, increasing.
volatilitiesMatrixThe volatilities: a row per option tenor and a column per strike.
dcDayCounterThe day counter; Actual365Fixed, QuantLib's default, when null.
Exceptions
- ArgumentNullException
A collection or the volatilities is null.
- ArgumentException
The option tenors are empty, not positive or not increasing, the strikes aren't increasing, the matrix's size isn't the grid's, or there are fewer than two strikes or option tenors.
- ArgumentOutOfRangeException
bdcisn't a member of its type.- NanoQLException
Two tenors can't be compared, or the calendar is null.
Properties
MaxDate
Gets the latest date for which the surface returns volatilities: the last option tenor's date.
public override Date MaxDate { get; }
Property Value
OptionDates
Gets the option dates, computed from the reference date.
public ImmutableArray<Date> OptionDates { get; }
Property Value
OptionTenors
Gets the option tenors.
public ImmutableArray<Period> OptionTenors { get; }
Property Value
OptionTimes
Gets the option times, from the reference date.
public ImmutableArray<double> OptionTimes { get; }
Property Value
Strikes
Gets the strikes.
public ImmutableArray<double> Strikes { get; }
Property Value
Methods
Create(int, Calendar, BusinessDayConvention, IEnumerable<Period>, IEnumerable<double>, Matrix, EvaluationContext, DayCounter?)
A surface whose reference date is the given number of business days after the evaluation date, on the calendar: QuantLib's floating forms.
public static CapFloorTermVolSurface Create(int settlementDays, Calendar calendar, BusinessDayConvention bdc, IEnumerable<Period> optionTenors, IEnumerable<double> strikes, Matrix volatilities, EvaluationContext context, DayCounter? dc = null)
Parameters
settlementDaysintThe business days from the evaluation date to the reference date.
calendarCalendarThe calendar of the business days and of the option dates.
bdcBusinessDayConventionThe convention adjusting the option dates.
optionTenorsIEnumerable<Period>The option tenors, positive and increasing.
strikesIEnumerable<double>The strikes, increasing.
volatilitiesMatrixThe volatilities: a row per option tenor and a column per strike.
contextEvaluationContextThe evaluation context.
dcDayCounterThe day counter; Actual365Fixed, QuantLib's default, when null.
Returns
- CapFloorTermVolSurface
The surface, with a fixed reference date.
Exceptions
- ArgumentNullException
context,calendar, a collection or the volatilities is null.- ArgumentOutOfRangeException
settlementDaysis negative, orbdcisn't a member of its type.- ArgumentException
The option tenors are empty, not positive or not increasing, the strikes aren't increasing, the matrix's size isn't the grid's, or there are fewer than two strikes or option tenors.
- NanoQLException
Two tenors can't be compared.
MaxStrike()
The maximum strike for which the structure returns values.
public override double MaxStrike()
Returns
- double
The strike.
MinStrike()
The minimum strike for which the structure returns values.
public override double MinStrike()
Returns
- double
The strike.
VolatilityImpl(double, double)
The volatility calculation, after the range and strike checks.
protected override double VolatilityImpl(double length, double strike)
Parameters
Returns
- double
The volatility.