Table of Contents

Struct HazardRate

Namespace
NanoQL.TermStructures
Assembly
NanoQL.dll

The hazard-rate curve traits: the bootstrap of hazard rates, and the formulas of InterpolatedHazardRateCurve<TInterpolator>.

public readonly struct HazardRate : IDefaultProbabilityTraits, IBootstrapTraits<DefaultProbabilityTermStructure>
Implements
Inherited Members

Remarks

A stateless configuration struct, as every bootstrap traits struct is.

Explicit Interface Implementations

DefaultDensityImpl(ReadOnlySpan<double>, ReadOnlySpan<double>, Interpolation, double)

The default density: the hazard rate times the survival probability, as for every HazardRateStructure.

static double DefaultDensityImpl(ReadOnlySpan<double> times, ReadOnlySpan<double> data, Interpolation interpolation, double t)

Parameters

times ReadOnlySpan<double>

The nodes' times.

data ReadOnlySpan<double>

The nodes' hazard rates.

interpolation Interpolation

The interpolation of the rates.

t double

The time.

Returns

double

The density.

Exceptions

ArgumentException

times is empty, or t is past the last time and data is empty, where QuantLib reads past their end.

Guess(int, BootstrapState<DefaultProbabilityTermStructure>, bool, int)

The guess for a node's value.

static double Guess(int i, BootstrapState<DefaultProbabilityTermStructure> c, bool validData, int firstAliveHelper)

Parameters

i int

The node.

c BootstrapState<DefaultProbabilityTermStructure>

The working state of the curve under construction.

validData bool

Whether the curve's data hold a previous pass's values.

firstAliveHelper int

The index of the first helper alive at the curve's first date.

Returns

double

The guess.

HazardRateImpl(ReadOnlySpan<double>, ReadOnlySpan<double>, Interpolation, double, DefaultProbabilityTermStructure)

The hazard rate: the interpolation's, flat past the last node.

static double HazardRateImpl(ReadOnlySpan<double> times, ReadOnlySpan<double> data, Interpolation interpolation, double t, DefaultProbabilityTermStructure curve)

Parameters

times ReadOnlySpan<double>

The nodes' times.

data ReadOnlySpan<double>

The nodes' hazard rates.

interpolation Interpolation

The interpolation of the rates.

t double

The time.

curve DefaultProbabilityTermStructure

The curve, which this kind doesn't read.

Returns

double

The rate.

Exceptions

ArgumentException

times is empty, or t is past the last time and data is empty, where QuantLib reads past their end.

InitialDate(BootstrapState<DefaultProbabilityTermStructure>)

The start of the curve's data: the reference date.

static Date InitialDate(BootstrapState<DefaultProbabilityTermStructure> c)

Parameters

c BootstrapState<DefaultProbabilityTermStructure>

The working state of the curve under construction.

Returns

Date

The date.

InitialValue(BootstrapState<DefaultProbabilityTermStructure>)

A dummy value at the reference date, which the first pillar's value overwrites.

static double InitialValue(BootstrapState<DefaultProbabilityTermStructure> c)

Parameters

c BootstrapState<DefaultProbabilityTermStructure>

The working state of the curve under construction.

Returns

double

The value.

MaxDate(ReadOnlySpan<Date>)

The maximum date: the last node's.

static Date MaxDate(ReadOnlySpan<Date> dates)

Parameters

dates ReadOnlySpan<Date>

The nodes' dates.

Returns

Date

The date.

Exceptions

ArgumentException

dates is empty, where QuantLib reads past its end.

MaxIterations

Gets the upper bound of the bootstrap's convergence loop: 30.

static int MaxIterations { get; }

Returns

int

MaxValueAfter(int, BootstrapState<DefaultProbabilityTermStructure>, bool, int)

The upper bound of a node's value, from the previous values.

static double MaxValueAfter(int i, BootstrapState<DefaultProbabilityTermStructure> c, bool validData, int firstAliveHelper)

Parameters

i int

The node.

c BootstrapState<DefaultProbabilityTermStructure>

The working state of the curve under construction.

validData bool

Whether the curve's data hold a previous pass's values.

firstAliveHelper int

The index of the first helper alive at the curve's first date.

Returns

double

The bound.

MinValueAfter(int, BootstrapState<DefaultProbabilityTermStructure>, bool, int)

The lower bound of a node's value, from the previous values.

static double MinValueAfter(int i, BootstrapState<DefaultProbabilityTermStructure> c, bool validData, int firstAliveHelper)

Parameters

i int

The node.

c BootstrapState<DefaultProbabilityTermStructure>

The working state of the curve under construction.

validData bool

Whether the curve's data hold a previous pass's values.

firstAliveHelper int

The index of the first helper alive at the curve's first date.

Returns

double

The bound.

SurvivalProbabilityImpl(ReadOnlySpan<double>, ReadOnlySpan<double>, Interpolation, double)

The survival probability: the exponential of minus the hazard rate's integral, flat past the last node.

static double SurvivalProbabilityImpl(ReadOnlySpan<double> times, ReadOnlySpan<double> data, Interpolation interpolation, double t)

Parameters

times ReadOnlySpan<double>

The nodes' times.

data ReadOnlySpan<double>

The nodes' hazard rates.

interpolation Interpolation

The interpolation of the rates.

t double

The time.

Returns

double

The probability.

Exceptions

ArgumentException

t isn't 0 and times is empty, or t is past the last time and data is empty, where QuantLib reads past their end.

UpdateGuess(double[], double, int)

Writes a root finder's trial value into the curve's data: QuantLib's updateGuess.

static void UpdateGuess(double[] data, double rate, int i)

Parameters

data double[]

The curve's data.

rate double
i int

The node.

Exceptions

ArgumentOutOfRangeException

i isn't a point of data, where QuantLib writes past its end.