Table of Contents

Class ZabrSmileSection<TEvaluation>

Namespace
NanoQL.TermStructures
Assembly
NanoQL.dll

A ZABR smile section: the volatilities and option prices of the ZABR model at given parameters, by the kernel TEvaluation names.

public class ZabrSmileSection<TEvaluation> : SmileSection where TEvaluation : struct, IZabrEvaluation

Type Parameters

TEvaluation

The kernel: ZabrShortMaturityLognormal, ZabrShortMaturityNormal, ZabrLocalVolatility or ZabrFullFd.

Inheritance
ZabrSmileSection<TEvaluation>
Derived
Inherited Members

Remarks

The section builds its ZabrModel from α, β, ν, ρ and γ at its exercise time and forward. With the short-maturity lognormal kernel its volatility is the model's lognormal volatility at the strike, floored at 1e-6, and its option prices are SmileSection's. With the normal kernel its option prices are Bachelier's with the model's normal volatility, and its volatility is the lognormal one implied from them, 0 where that can't be implied, as QuantLib's catches every failure. The finite-difference kernels price calls at a strike grid, the moneyness grid times the forward (by default 0.01 to 20, its non-positive strikes dropped) with fdRefinement points between two of its strikes: by FdPrice(ReadOnlySpan<double>), or by FullFdPrice(double) at each strike. A cubic spline through those prices and the forward at strike 0 prices up to the grid's last strike, an exponential fitted to its end beyond; puts by parity; and the volatility is the lognormal one implied from those prices, as the normal kernel's. The short-maturity kernels don't read the grid.

QuantLib's date constructor, whose section floats with the evaluation date, is Create(Date, double, ReadOnlySpan<double>, EvaluationContext, DayCounter?, ReadOnlySpan<double>, int), which takes the evaluation context and fixes the date. QuantLib's short-maturity kernels read the five parameters unchecked; fewer are refused here, for every kernel, with the text of QuantLib's local-volatility kernel.

Unsealed for its named classes, QuantLib-Python's (ZabrShortMaturityLognormalSmileSection, ZabrShortMaturityNormalSmileSection, ZabrLocalVolatilitySmileSection and ZabrFullFdSmileSection). Its constructor reads the exercise time, so ExerciseTime is sealed here.

Constructors

ZabrSmileSection(Date, double, ReadOnlySpan<double>, Date, DayCounter?, ReadOnlySpan<double>, int)

Initializes a new instance of the ZabrSmileSection<TEvaluation> class for an exercise date, the evaluation date of Create(Date, double, ReadOnlySpan<double>, EvaluationContext, DayCounter?, ReadOnlySpan<double>, int) its reference date.

protected ZabrSmileSection(Date d, double forward, ReadOnlySpan<double> zabrParameters, Date referenceDate, DayCounter? dc = null, ReadOnlySpan<double> moneyness = default, int fdRefinement = 5)

Parameters

d Date

The exercise date.

forward double

The forward.

zabrParameters ReadOnlySpan<double>

α, β, ν, ρ and γ, in that order; values after the fifth are ignored.

referenceDate Date

The reference date.

dc DayCounter

The day counter of the exercise time, or null for QuantLib's default, Actual/365 (Fixed).

moneyness ReadOnlySpan<double>

The finite-difference kernels' moneyness grid, empty for their default.

fdRefinement int

The finite-difference kernels' points between two of the grid's strikes.

Exceptions

ArgumentOutOfRangeException

fdRefinement is negative.

ArgumentException

A date is default(Date), the exercise date is before the reference date, there are fewer than five parameters, or the model refuses them, the forward or the exercise time.

ZabrSmileSection(double, double, ReadOnlySpan<double>, ReadOnlySpan<double>, int)

Initializes a new instance of the ZabrSmileSection<TEvaluation> class for an exercise time.

public ZabrSmileSection(double timeToExpiry, double forward, ReadOnlySpan<double> zabrParameters, ReadOnlySpan<double> moneyness = default, int fdRefinement = 5)

Parameters

timeToExpiry double

The exercise time, positive.

forward double

The forward.

zabrParameters ReadOnlySpan<double>

α, β, ν, ρ and γ, in that order; values after the fifth are ignored.

moneyness ReadOnlySpan<double>

The finite-difference kernels' moneyness grid, empty for their default.

fdRefinement int

The finite-difference kernels' points between two of the grid's strikes.

Exceptions

ArgumentOutOfRangeException

fdRefinement is negative.

ArgumentException

The time isn't positive, there are fewer than five parameters, or the model refuses them or the forward.

Properties

ExerciseTime

Gets the exercise time.

public override sealed double ExerciseTime { get; }

Property Value

double

Remarks

Sealed: the constructor reads it.

Model

Gets the section's model.

public ZabrModel Model { get; }

Property Value

ZabrModel

Methods

AtmLevel()

The at-the-money level: the model's forward.

public override double? AtmLevel()

Returns

double?

The forward.

Create(Date, double, ReadOnlySpan<double>, EvaluationContext, DayCounter?, ReadOnlySpan<double>, int)

A ZABR smile section for an exercise date, whose reference date is the evaluation date.

public static ZabrSmileSection<TEvaluation> Create(Date d, double forward, ReadOnlySpan<double> zabrParameters, EvaluationContext context, DayCounter? dc = null, ReadOnlySpan<double> moneyness = default, int fdRefinement = 5)

Parameters

d Date

The exercise date.

forward double

The forward.

zabrParameters ReadOnlySpan<double>

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

context EvaluationContext

The evaluation context, whose evaluation date is the reference date.

dc DayCounter

The day counter of the exercise time, or null for Actual/365 (Fixed).

moneyness ReadOnlySpan<double>

The finite-difference kernels' moneyness grid, empty for their default.

fdRefinement int

The finite-difference kernels' points between two of the grid's strikes.

Returns

ZabrSmileSection<TEvaluation>

The section, with a fixed reference date.

Exceptions

ArgumentNullException

context is null.

ArgumentOutOfRangeException

fdRefinement is negative.

ArgumentException

The section refuses its arguments.

MaxStrike()

The maximum strike: the largest real.

public override double MaxStrike()

Returns

double

The strike.

MinStrike()

The minimum strike: 0.

public override double MinStrike()

Returns

double

The strike.

OptionPrice(double, OptionType, double)

The price of an option on the forward, by the section's kernel.

public override double OptionPrice(double strike, OptionType type = OptionType.Call, double discount = 1)

Parameters

strike double

The strike.

type OptionType

Call or put.

discount double

The discount factor.

Returns

double

The price.

Exceptions

ArgumentOutOfRangeException

type isn't a member of its type.

ArgumentException

The kernel's formula or the model refuses the strike.

NanoQLException

The model's integration fails.

VolatilityImpl(double)

The volatility at a strike.

protected override double VolatilityImpl(double strike)

Parameters

strike double

The strike.

Returns

double

The volatility.