Struct Zabr<TEvaluation>
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
TEvaluationThe 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
tdoubleThe time to expiry.
forwarddoubleThe forward.
alphadouble?α's guess, or null for ZABR's default.
betadouble?β's guess, or null for 0.5.
nudouble?ν's guess, or null for √0.4.
rhodouble?ρ's guess, or null for 0.
gammadouble?γ's guess, or null for 1.
alphaIsFixedboolWhether α is fixed at its guess.
betaIsFixedboolWhether β is fixed at its guess.
nuIsFixedboolWhether ν is fixed at its guess.
rhoIsFixedboolWhether ρ is fixed at its guess.
gammaIsFixedboolWhether γ is fixed at its guess.
vegaWeightedboolWhether the errors are vega-weighted.
endCriteriaEndCriteriaThe end criteria, or null for QuantLib's default.
optMethodOptimizationMethodThe optimizer, or null for QuantLib's default.
errorAcceptdoubleThe error at or below which a fit is accepted.
useMaxErrorboolWhether a fit is scored by its maximum error.
maxGuessesintThe most minimizations.
Exceptions
- ArgumentOutOfRangeException
maxGuessesis 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
pointsintThe 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
xReadOnlySpan<double>The strikes, sorted.
yReadOnlySpan<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
RequiredPoints
Gets the fewest points the interpolation takes: 1, XABR's.
static int RequiredPoints { get; }