Struct NoArbSabr
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
The no-arbitrage SABR interpolation factory: builds a NoArbSabrInterpolation with its parameters over given points. Global: a change to one point changes the whole fit.
[Experimental("NQL0001")]
public readonly struct NoArbSabr : IInterpolator
- Implements
- Inherited Members
Constructors
NoArbSabr(double, double, double?, double?, double?, double?, bool, bool, bool, bool, bool, EndCriteria?, OptimizationMethod?, double, bool, int)
Initializes a new instance of the NoArbSabr struct.
public NoArbSabr(double t, double forward, double? alpha, double? beta, double? nu, double? rho, bool alphaIsFixed, bool betaIsFixed, bool nuIsFixed, bool rhoIsFixed, 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 the default.
betadouble?β's guess, or null for the default.
nudouble?ν's guess, or null for the default.
rhodouble?ρ's guess, or null for the default.
alphaIsFixedboolWhether α is fixed at its guess.
betaIsFixedboolWhether β is fixed at its guess.
nuIsFixedboolWhether ν is fixed at its guess.
rhoIsFixedboolWhether ρ is fixed at its guess.
vegaWeightedboolWhether the errors are weighted by the strikes' Black vegas.
endCriteriaEndCriteriaThe end criteria, or null for the fit's default.
optMethodOptimizationMethodThe optimizer, or null for the fit'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 NoArbSabrInterpolation over the given points.
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 fails.
Explicit Interface Implementations
Global
Gets a value indicating whether the interpolation is global: QuantLib's global, true.
static bool Global { get; }
Returns
RequiredPoints
Gets the fewest points the interpolation takes.
static int RequiredPoints { get; }