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
dDateThe exercise date.
forwarddoubleThe forward.
sabrParametersReadOnlySpan<double>α, β, ν and ρ, in that order; values after the fourth are ignored.
referenceDateDateThe reference date.
dcDayCounterThe day counter of the exercise time, or null for QuantLib's default, Actual/365 (Fixed).
shiftdoubleThe shift.
volatilityTypeVolatilityTypeThe 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
volatilityTypeisn'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
timeToExpirydoubleThe exercise time.
forwarddoubleThe forward.
sabrParametersReadOnlySpan<double>α, β, ν and ρ, in that order; values after the fourth are ignored.
shiftdoubleThe shift.
volatilityTypeVolatilityTypeThe 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
volatilityTypeisn't a member of its type.
Properties
Alpha
Gets α.
public double Alpha { get; }
Property Value
Beta
Gets β.
public double Beta { get; }
Property Value
Nu
Gets ν.
public double Nu { get; }
Property Value
Rho
Gets ρ.
public double Rho { get; }
Property Value
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
dDateThe exercise date.
forwarddoubleThe forward.
sabrParametersReadOnlySpan<double>α, β, ν and ρ, in that order.
contextEvaluationContextThe evaluation context, whose evaluation date is the reference date.
dcDayCounterThe day counter of the exercise time, or null for Actual/365 (Fixed).
shiftdoubleThe shift.
volatilityTypeVolatilityTypeThe volatility type.
Returns
- SabrSmileSection
The section, with a fixed reference date.
Exceptions
- ArgumentNullException
contextis null.- ArgumentException
The section refuses its arguments.
- ArgumentOutOfRangeException
volatilityTypeisn'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
strikedoubleThe strike.
Returns
- double
The variance.
VolatilityImpl(double)
The volatility at a strike.
protected override double VolatilityImpl(double strike)
Parameters
strikedoubleThe strike.
Returns
- double
The volatility.