Table of Contents

Struct Zabr<TEvaluation>

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

The ZABR interpolation's factory and traits: a ZabrInterpolation<TEvaluation> fitted with its parameters.

public readonly struct Zabr<TEvaluation> : IInterpolator where TEvaluation : struct, IZabrEvaluation

Type Parameters

TEvaluation

The kernel of the interpolation's smile section.

Implements
Inherited Members

Remarks

As QuantLib's, the factory's vega weighting defaults to off, where ZabrInterpolation<TEvaluation>'s defaults to on. QuantLib's Zabr has no default constructor, so the zero value is refused by every member with InvalidOperationException.

Constructors

Zabr(double, double, double?, double?, double?, double?, double?, bool, bool, bool, bool, bool, bool, EndCriteria?, OptimizationMethod?, double, bool, int)

Initializes a new instance of the Zabr<TEvaluation> struct.

public Zabr(double t, double forward, double? alpha, double? beta, double? nu, double? rho, double? gamma, bool alphaIsFixed, bool betaIsFixed, bool nuIsFixed, bool rhoIsFixed, bool gammaIsFixed, bool vegaWeighted = false, EndCriteria? endCriteria = null, OptimizationMethod? optMethod = null, double errorAccept = 0.002, bool useMaxError = false, int maxGuesses = 50)

Parameters

t double

The time to expiry.

forward double

The forward.

alpha double?

α's guess, or null for ZABR's default.

beta double?

β's guess, or null for 0.5.

nu double?

ν's guess, or null for √0.4.

rho double?

ρ's guess, or null for 0.

gamma double?

γ's guess, or null for 1.

alphaIsFixed bool

Whether α is fixed at its guess.

betaIsFixed bool

Whether β is fixed at its guess.

nuIsFixed bool

Whether ν is fixed at its guess.

rhoIsFixed bool

Whether ρ is fixed at its guess.

gammaIsFixed bool

Whether γ is fixed at its guess.

vegaWeighted bool

Whether the errors are vega-weighted.

endCriteria EndCriteria

The end criteria, or null for QuantLib's default.

optMethod OptimizationMethod

The optimizer, or null for QuantLib's default.

errorAccept double

The error at or below which a fit is accepted.

useMaxError bool

Whether a fit is scored by its maximum error.

maxGuesses int

The most minimizations.

Exceptions

ArgumentOutOfRangeException

maxGuesses is negative.

Methods

CheckPoints(int)

Runs the checks QuantLib's interpolation makes when it is built over a number of points, before it reads their values: the fewest points its implementation takes, and the counts its configuration needs.

public void CheckPoints(int points)

Parameters

points int

The number of points.

Remarks

The bootstraps read it on their first pass: QuantLib builds a curve's interpolation over its first nodes before their values are solved (interpolateWithoutUpdate), and takes linear interpolation where a global interpolation refuses to be built over that many points (iterativebootstrap.hpp:295-310). Interpolate(ReadOnlySpan<double>, ReadOnlySpan<double>) runs every check, these and the ones on the values alike. The default refuses none, so a factory of one's own keeps compiling; a factory overrides it with its construction checks, so that a curve on it takes the fallback where QuantLib's would.

Exceptions

ArgumentException

The interpolation can't be built over that many points.

NanoQLException

The interpolation's configuration can't be built over that many points.

InvalidOperationException

This is the zero value, which QuantLib can't construct.

Interpolate(ReadOnlySpan<double>, ReadOnlySpan<double>)

Builds and fits a ZabrInterpolation<TEvaluation> over the given points, with this factory's parameters.

public Interpolation Interpolate(ReadOnlySpan<double> x, ReadOnlySpan<double> y)

Parameters

x ReadOnlySpan<double>

The strikes, sorted.

y ReadOnlySpan<double>

The volatilities, one per strike.

Returns

Interpolation

The interpolation.

Exceptions

InvalidOperationException

This is the zero value, which QuantLib can't construct.

ArgumentException

The interpolation refuses the points or the parameters.

NanoQLException

The optimizer or the model's integration fails.

Explicit Interface Implementations

Global

Gets a value indicating whether the interpolation is global: true.

static bool Global { get; }

Returns

bool

RequiredPoints

Gets the fewest points the interpolation takes: 1, XABR's.

static int RequiredPoints { get; }

Returns

int