Table of Contents

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

settlementDate Date

The settlement date, the reference date.

calendar Calendar

The calendar of the option dates, or null, QuantLib's empty calendar, with which the option dates can't be computed.

bdc BusinessDayConvention

The convention adjusting the option dates.

optionTenors IEnumerable<Period>

The option tenors, positive and increasing.

strikes IEnumerable<double>

The strikes, increasing.

volatilities Matrix

The volatilities: a row per option tenor and a column per strike.

dc DayCounter

The 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

bdc isn'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

Date

OptionDates

Gets the option dates, computed from the reference date.

public ImmutableArray<Date> OptionDates { get; }

Property Value

ImmutableArray<Date>

OptionTenors

Gets the option tenors.

public ImmutableArray<Period> OptionTenors { get; }

Property Value

ImmutableArray<Period>

OptionTimes

Gets the option times, from the reference date.

public ImmutableArray<double> OptionTimes { get; }

Property Value

ImmutableArray<double>

Strikes

Gets the strikes.

public ImmutableArray<double> Strikes { get; }

Property Value

ImmutableArray<double>

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

settlementDays int

The business days from the evaluation date to the reference date.

calendar Calendar

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

bdc BusinessDayConvention

The convention adjusting the option dates.

optionTenors IEnumerable<Period>

The option tenors, positive and increasing.

strikes IEnumerable<double>

The strikes, increasing.

volatilities Matrix

The volatilities: a row per option tenor and a column per strike.

context EvaluationContext

The evaluation context.

dc DayCounter

The 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

settlementDays is negative, or bdc isn'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

length double

The time, from the reference date.

strike double

The strike.

Returns

double

The volatility.