Table of Contents

Struct SwaptionVolCubeZabrModel<TEvaluation>

Namespace
NanoQL.TermStructures
Assembly
NanoQL.dll

The ZABR model of a swaption volatility cube: QuantLib's SwaptionVolCubeZabrModel<Kernel> with its XabrModelTraits specialization, its smiles fitted by ZabrInterpolation<TEvaluation> and its sections ZabrSmileSection<TEvaluation>s, five parameters α, β, ν, ρ and γ.

public readonly struct SwaptionVolCubeZabrModel<TEvaluation> : IXabrCubeModel where TEvaluation : struct, IZabrEvaluation

Type Parameters

TEvaluation

The kernel: ZabrShortMaturityLognormal, QuantLib's default, or ZabrShortMaturityNormal.

Implements
Inherited Members

Remarks

A stateless trait: its members are static, and every instance, its zero value included, is the same model. Fewer than five guesses or fixed flags are refused, as QuantLib's traits refuse them; more are ignored. ZABR has no shifted form: a section on a shifted at-the-money structure is refused when it is built, at the cube's construction for an at-the-money-calibrated cube and at its first query otherwise, as QuantLib's is.

Explicit Interface Implementations

CreateInterpolation(ReadOnlySpan<double>, ReadOnlySpan<double>, double, double, ReadOnlySpan<double>, ReadOnlySpan<bool>, bool, EndCriteria?, OptimizationMethod?, double, bool, int, double, VolatilityType)

A ZABR smile fitted to discrete volatilities, from the five guesses and fixed flags.

static IXabrInterpolation CreateInterpolation(ReadOnlySpan<double> strikes, ReadOnlySpan<double> volatilities, double t, double forward, ReadOnlySpan<double> parameters, ReadOnlySpan<bool> paramIsFixed, bool vegaWeighted, EndCriteria? endCriteria, OptimizationMethod? optMethod, double errorAccept, bool useMaxError, int maxGuesses, double shift, VolatilityType volatilityType)

Parameters

strikes ReadOnlySpan<double>

The strikes, sorted.

volatilities ReadOnlySpan<double>

The volatilities, one per strike.

t double

The time to expiry.

forward double

The forward.

parameters ReadOnlySpan<double>

The guesses of α, β, ν, ρ and γ, at least five.

paramIsFixed ReadOnlySpan<bool>

Whether each of α, β, ν, ρ and γ is fixed at its guess, at least five flags.

vegaWeighted bool

Whether the errors are weighted by the strikes' Black vegas.

endCriteria EndCriteria

The end criteria, or null for the fit's default.

optMethod OptimizationMethod

The optimizer, or null for the fit's default.

errorAccept double

The error at or below which a fit is accepted and the restarts stop.

useMaxError bool

Whether a fit is scored by its maximum error, not its root-mean-square error.

maxGuesses int

The most minimizations.

shift double

Ignored, as QuantLib ignores it.

volatilityType VolatilityType

Ignored, as QuantLib ignores it.

Returns

IXabrInterpolation

The fitted ZabrInterpolation<TEvaluation>.

Exceptions

ArgumentException

There are fewer than five guesses or flags, or the fit refuses its arguments.

ArgumentOutOfRangeException

maxGuesses is negative.

NanoQLException

The optimizer or the model's integration fails.

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

The ZABR smile section at given parameters, on an unshifted structure.

static SmileSection CreateSmileSection(double optionTime, double forward, ReadOnlySpan<double> parameters, double shift, VolatilityType volatilityType)

Parameters

optionTime double

The exercise time.

forward double

The forward.

parameters ReadOnlySpan<double>

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

shift double

The at-the-money structure's shift, which must be 0.

volatilityType VolatilityType

Ignored, as QuantLib ignores it.

Returns

SmileSection

The ZabrSmileSection<TEvaluation>.

Exceptions

ArgumentException

shift isn't close to 0.

ArgumentException

The section refuses its arguments.

ExtractGamma(IXabrInterpolation)

The fitted γ.

static double ExtractGamma(IXabrInterpolation interpolation)

Parameters

interpolation IXabrInterpolation

The fitted interpolation, one CreateInterpolation(ReadOnlySpan<double>, ReadOnlySpan<double>, double, double, ReadOnlySpan<double>, ReadOnlySpan<bool>, bool, EndCriteria?, OptimizationMethod?, double, bool, int, double, VolatilityType) returned.

Returns

double

γ.

Exceptions

ArgumentNullException

interpolation is null.

InvalidCastException

interpolation isn't this model's.

NParams

Gets the model's parameter count: 5.

static int NParams { get; }

Returns

int