Table of Contents

Class CoxIngersollRoss

Namespace
NanoQL.Models
Assembly
NanoQL.dll

The Cox-Ingersoll-Ross model: dr(t) = k(θ − r(t))dt + σ√r(t) dW(t).

public class CoxIngersollRoss : OneFactorAffineModel, ICalibratedModel, IAffineModel
Inheritance
CoxIngersollRoss
Implements
Derived
Inherited Members
Extension Methods

Remarks

Its arguments are θ, k, σ and r₀, in that order, each a constant parameter, positive. QuantLib's header warns that the class "was not tested enough to guarantee its functionality". Its dynamics simulate the short rate directly, on CoxIngersollRossProcess's quadratic-exponential scheme.

The Feller constraint (K1): with it, the model's parameters satisfy σ² < 2kθ at each vector's own k and θ, through ParametersConstraint(), and σ's own constraint is positivity: a divergence, QuantLib's testing σ against the constructor's k and θ (coxingersollross.cpp:24-37), so a calibration can leave the Feller region and σ stops at a bound the constructor set (Divergences/CirFellerConstraintTests.cs). The constructor refuses a σ outside it with QuantLib's text.

The tree (K2): on QuantLib's dynamics before its 1.23, the square root y = √r of the short rate, of constant volatility σ/2, Euler-discretized, the short rate y², which the trinomial tree's state-independent variance fits: a divergence, QuantLib's tree reading CoxIngersollRossProcess, whose variance depends on the state, at its initial value, so that its prices stall away from its own analytic ones (Divergences/CirTreeConvergenceTests.cs).

An extension point, as in QuantLib: the extended Cox-Ingersoll-Ross model derives from it.

Constructors

CoxIngersollRoss(double, double, double, double, bool)

Initializes a new instance of the CoxIngersollRoss class.

public CoxIngersollRoss(double r0 = 0.05, double theta = 0.1, double k = 0.1, double sigma = 0.1, bool withFellerConstraint = true)

Parameters

r0 double

The initial short rate, positive.

theta double

The level θ, positive.

k double

The speed k, positive.

sigma double

The volatility σ, positive, and with the Feller constraint below √(2kθ).

withFellerConstraint bool

Whether the parameters satisfy the Feller condition σ² < 2kθ.

Exceptions

ArgumentException

A parameter is outside its constraint.

Properties

K

Gets the speed k.

protected double K { get; }

Property Value

double

Sigma

Gets the volatility σ.

protected double Sigma { get; }

Property Value

double

Theta

Gets the level θ.

protected double Theta { get; }

Property Value

double

X0

Gets the initial short rate.

protected double X0 { get; }

Property Value

double

Methods

A(double, double)

The affine discount bond's A(t, T).

protected override double A(double t, double T)

Parameters

t double

The time.

T double

The bond's maturity.

Returns

double

A(t, T).

B(double, double)

The affine discount bond's B(t, T).

protected override double B(double t, double T)

Parameters

t double

The time.

T double

The bond's maturity.

Returns

double

B(t, T).

DiscountBondOption(OptionType, double, double, double)

The price of an option on a discount bond, by the non-central χ² distribution.

public override double DiscountBondOption(OptionType type, double strike, double maturity, double bondMaturity)

Parameters

type OptionType

The option's type.

strike double

The strike, positive.

maturity double

The option's maturity.

bondMaturity double

The bond's maturity.

Returns

double

The price.

Exceptions

ArgumentException

strike isn't positive.

ArgumentOutOfRangeException

type isn't a member of its type.

Dynamics()

The model's short-rate dynamics: the short rate itself, a CoxIngersollRossProcess.

public override OneFactorModelShortRateDynamics Dynamics()

Returns

OneFactorModelShortRateDynamics

A new dynamics object.

ParametersConstraint()

The Feller condition σ² < 2kθ at the vector's own k and θ, when the model was built with it.

protected override Constraint? ParametersConstraint()

Returns

Constraint

The constraint, or null without the Feller constraint.

Tree(TimeGrid)

Builds the model's trinomial tree on a time grid, on the square root of the short rate.

public override Lattice Tree(TimeGrid grid)

Parameters

grid TimeGrid

The time grid.

Returns

Lattice

The tree, an unfitted OneFactorModelShortRateTree.

Exceptions

ArgumentNullException

grid is null.