Table of Contents

Class HybridHestonHullWhiteProcess

Namespace
NanoQL.Processes
Assembly
NanoQL.dll

The three-factor hybrid of a Heston equity and a Hull-White short rate in its forward measure: its state is the underlying, its variance and the short rate, the equity correlated with the short rate.

public sealed class HybridHestonHullWhiteProcess : StochasticProcess
Inheritance
HybridHestonHullWhiteProcess
Inherited Members

Remarks

Immutable over its Heston process and its forward Hull-White process. The Hull-White process the hybrid evolves, its model and its numeraire's end discount are on the Heston process's risk-free curve, from the given process's reversion, volatility and forward-measure time, which HullWhiteProcess returns; the given process's own curve isn't read. QuantLib builds its model on the Heston curve but takes the short rate from the given process's curve (hybridhestonhullwhiteprocess.cpp:37-46, :64, :137, :179), so the numeraire prices a bond on one curve at a rate taken from the other; here all of it runs on the one curve, QuantLib's bits where the two curves are one.

The process's times run on the Heston process's model clock, from the earliest reference date of its curves on the risk-free curve's day counter, each curve read at the instant a time denotes, the Hull-White parts on the risk-free curve restated on that clock; QuantLib's process reads the dividend curve at the risk-free curve's times.

The step's terms m₂, m₄, m₅, v₁ and v₁₂, QuantLib's expressions, cancel as a·dt falls: below a·dt of NanoQL.Processes.HybridHestonHullWhiteProcess.StepCut they are evaluated in double-double, below its floor in quad-double and below that by the cubic in a through four quad-double values, QuantLib's double and bits from the cut up, the cut where QuantLib's double first departs from the expressions' exact values by more than 1e-12 relative, measured at the run. The in-place Evolve(double, ReadOnlySpan<double>, double, ReadOnlySpan<double>, Span<double>) steps by the same arithmetic without allocating.

Constructors

HybridHestonHullWhiteProcess(HestonProcess, HullWhiteForwardProcess, double, HybridHestonHullWhiteProcessDiscretization)

Initializes a new instance of the HybridHestonHullWhiteProcess class.

public HybridHestonHullWhiteProcess(HestonProcess hestonProcess, HullWhiteForwardProcess hullWhiteProcess, double corrEquityShortRate, HybridHestonHullWhiteProcessDiscretization discretization = HybridHestonHullWhiteProcessDiscretization.BSMHullWhite)

Parameters

hestonProcess HestonProcess

The Heston process.

hullWhiteProcess HullWhiteForwardProcess

The forward Hull-White process, whose reversion, volatility and forward-measure time are read.

corrEquityShortRate double

The correlation of the equity with the short rate.

discretization HybridHestonHullWhiteProcessDiscretization

The discretization.

Exceptions

ArgumentNullException

A process is null.

ArgumentOutOfRangeException

discretization isn't a member of its type.

ArgumentException

The correlations' squares sum past 1 ("correlation matrix is not positive definite"), or the Hull-White volatility isn't positive ("positive vol of Hull White process is required").

NanoQLException

The Hull-White process has no forward-measure time.

Properties

Discretization

Gets the discretization.

public HybridHestonHullWhiteProcessDiscretization Discretization { get; }

Property Value

HybridHestonHullWhiteProcessDiscretization

Eta

Gets the correlation of the equity with the short rate: QuantLib's eta().

public double Eta { get; }

Property Value

double

HestonProcess

Gets the Heston process.

public HestonProcess HestonProcess { get; }

Property Value

HestonProcess

HullWhiteProcess

Gets the forward Hull-White process the hybrid evolves: on the Heston process's risk-free curve, with the given process's reversion, volatility and forward-measure time.

public HullWhiteForwardProcess HullWhiteProcess { get; }

Property Value

HullWhiteForwardProcess

Size

Gets the number of dimensions of the process.

public override int Size { get; }

Property Value

int

Methods

Apply(Vector, Vector)

Applies a change to the state; by default x + Δx.

public override Vector Apply(Vector x0, Vector dx)

Parameters

x0 Vector

The state.

dx Vector

The change.

Returns

Vector

A new vector.

Exceptions

ArgumentException

The sizes differ.

ArgumentException

x0 or dx holds fewer values than the state, where QuantLib reads past its end.

Diffusion(double, Vector)

The diffusion part of the equation, σ(t, x_t).

public override Matrix Diffusion(double t, Vector x)

Parameters

t double

The time.

x Vector

The state.

Returns

Matrix

A new matrix.

Exceptions

ArgumentException

x holds fewer values than the Heston process's state, where QuantLib reads past its end.

Drift(double, Vector)

The drift part of the equation, μ(t, x_t).

public override Vector Drift(double t, Vector x)

Parameters

t double

The time.

x Vector

The state.

Returns

Vector

A new vector.

Exceptions

ArgumentException

x holds fewer values than the state, where QuantLib reads past its end.

Evolve(double, Vector, double, Vector)

The state after a time interval Δt; by default E(x0, t0, Δt) + S(x0, t0, Δt) · Δw, where E is the expectation and S the standard deviation, applied to the expectation by Apply(Vector, Vector).

public override Vector Evolve(double t0, Vector x0, double dt, Vector dw)

Parameters

t0 double

The start of the interval.

x0 Vector

The state at its start.

dt double

The interval's length.

dw Vector

The Brownian increments, one per factor.

Returns

Vector

A new vector.

Exceptions

ArgumentException

The sizes don't match.

NanoQLException

The step's variances aren't positive ("zero or negative variance given"), or its terminal correlation is invalid.

ArgumentException

x0 holds fewer values than the state, or dw fewer increments than the process's factors, where QuantLib reads past its end.

Evolve(double, ReadOnlySpan<double>, double, ReadOnlySpan<double>, Span<double>)

The state after a time interval Δt, written into the caller's span: the in-place form of Evolve(double, Vector, double, Vector), by default its values, copied.

public override void Evolve(double t0, ReadOnlySpan<double> x0, double dt, ReadOnlySpan<double> dw, Span<double> result)

Parameters

t0 double

The start of the interval.

x0 ReadOnlySpan<double>

The state at its start, of the process's Size.

dt double

The interval's length.

dw ReadOnlySpan<double>

The Brownian increments, one per factor.

result Span<double>

The state at the interval's end, of the process's size at least; it mustn't overlap x0 or dw.

Remarks

The same arithmetic without allocating, so the values are Evolve(double, Vector, double, Vector)'s bit for bit.

Exceptions

ArgumentException

The sizes don't match.

NanoQLException

The step's variances aren't positive, or its terminal correlation is invalid.

ArgumentException

x0 holds fewer values than the state, or dw fewer increments than the process's factors, where QuantLib reads past their end; or result is shorter than the state.

InitialValues()

The initial values of the state variables.

public override Vector InitialValues()

Returns

Vector

A new vector.

InitialValues(Span<double>)

The initial values of the state variables, written into the caller's span; by default InitialValues()'s values, copied.

public override void InitialValues(Span<double> result)

Parameters

result Span<double>

The values, of the process's Size at least.

Exceptions

ArgumentException

result is shorter than the process's size.

ArgumentException

result is shorter than the process's size.

Numeraire(double, Vector)

The numeraire at a time and state: the Hull-White zero bond to the forward-measure time over its initial discount.

public double Numeraire(double t, Vector x)

Parameters

t double

The time.

x Vector

The state.

Returns

double

The numeraire's value.

Exceptions

ArgumentException

x holds fewer values than the state, where QuantLib reads past its end.

Time(Date)

The time of a date: on the Heston process's model clock, QuantLib's, the risk-free curve's, where the dividend curve isn't dated before it.

public override double Time(Date date)

Parameters

date Date

The date.

Returns

double

The time.

Exceptions

ArgumentException

date is default(Date).