Table of Contents

Class SabrSmileSection

Namespace
NanoQL.TermStructures
Assembly
NanoQL.dll

A SABR smile section: the shifted SABR volatility at given parameters.

public sealed class SabrSmileSection : SmileSection
Inheritance
SabrSmileSection
Inherited Members

Remarks

The volatility at a strike below 1e-5 minus the shift is the volatility there, a NaN strike's included, as QuantLib's std::max floors it. QuantLib's date constructor without a reference date, whose section floats with the evaluation date, is Create(Date, double, ReadOnlySpan<double>, EvaluationContext, DayCounter?, double, VolatilityType), which takes the evaluation context and fixes the date. QuantLib reads the parameters unchecked; fewer than four are refused here.

Constructors

SabrSmileSection(Date, double, ReadOnlySpan<double>, Date, DayCounter?, double, VolatilityType)

Initializes a new instance of the SabrSmileSection class for an exercise date.

public SabrSmileSection(Date d, double forward, ReadOnlySpan<double> sabrParameters, Date referenceDate, DayCounter? dc = null, double shift = 0, VolatilityType volatilityType = VolatilityType.ShiftedLognormal)

Parameters

d Date

The exercise date.

forward double

The forward.

sabrParameters ReadOnlySpan<double>

α, β, ν and ρ, in that order; values after the fourth are ignored.

referenceDate Date

The reference date.

dc DayCounter

The day counter of the exercise time, or null for QuantLib's default, Actual/365 (Fixed).

shift double

The shift.

volatilityType VolatilityType

The volatility type.

Exceptions

ArgumentException

A date is default(Date), the exercise date is before the reference date, there are fewer than four parameters, the forward plus the shift isn't positive, or a parameter is out of its range.

ArgumentOutOfRangeException

volatilityType isn't a member of its type.

SabrSmileSection(double, double, ReadOnlySpan<double>, double, VolatilityType)

Initializes a new instance of the SabrSmileSection class for an exercise time.

public SabrSmileSection(double timeToExpiry, double forward, ReadOnlySpan<double> sabrParameters, double shift = 0, VolatilityType volatilityType = VolatilityType.ShiftedLognormal)

Parameters

timeToExpiry double

The exercise time.

forward double

The forward.

sabrParameters ReadOnlySpan<double>

α, β, ν and ρ, in that order; values after the fourth are ignored.

shift double

The shift.

volatilityType VolatilityType

The volatility type.

Exceptions

ArgumentException

The time is negative, there are fewer than four parameters, the forward plus the shift isn't positive, or a parameter is out of its range.

ArgumentOutOfRangeException

volatilityType isn't a member of its type.

Properties

Alpha

Gets α.

public double Alpha { get; }

Property Value

double

Beta

Gets β.

public double Beta { get; }

Property Value

double

Nu

Gets ν.

public double Nu { get; }

Property Value

double

Rho

Gets ρ.

public double Rho { get; }

Property Value

double

Methods

AtmLevel()

The at-the-money level: the forward.

public override double? AtmLevel()

Returns

double?

The forward.

Create(Date, double, ReadOnlySpan<double>, EvaluationContext, DayCounter?, double, VolatilityType)

A SABR smile section for an exercise date, whose reference date is the evaluation date.

public static SabrSmileSection Create(Date d, double forward, ReadOnlySpan<double> sabrParameters, EvaluationContext context, DayCounter? dc = null, double shift = 0, VolatilityType volatilityType = VolatilityType.ShiftedLognormal)

Parameters

d Date

The exercise date.

forward double

The forward.

sabrParameters ReadOnlySpan<double>

α, β, ν and ρ, in that order.

context EvaluationContext

The evaluation context, whose evaluation date is the reference date.

dc DayCounter

The day counter of the exercise time, or null for Actual/365 (Fixed).

shift double

The shift.

volatilityType VolatilityType

The volatility type.

Returns

SabrSmileSection

The section, with a fixed reference date.

Exceptions

ArgumentNullException

context is null.

ArgumentException

The section refuses its arguments.

ArgumentOutOfRangeException

volatilityType isn't a member of its type.

MaxStrike()

The maximum strike: the largest real.

public override double MaxStrike()

Returns

double

The strike.

MinStrike()

The minimum strike: minus the shift.

public override double MinStrike()

Returns

double

The strike.

VarianceImpl(double)

The variance at a strike; by default the volatility squared times the exercise time.

protected override double VarianceImpl(double strike)

Parameters

strike double

The strike.

Returns

double

The variance.

VolatilityImpl(double)

The volatility at a strike.

protected override double VolatilityImpl(double strike)

Parameters

strike double

The strike.

Returns

double

The volatility.