Table of Contents

Struct SurvivalProbability

Namespace
NanoQL.TermStructures
Assembly
NanoQL.dll

The survival-probability curve traits: the bootstrap of survival probabilities, and the formulas of InterpolatedSurvivalProbabilityCurve<TInterpolator>.

public readonly struct SurvivalProbability : 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: minus the interpolation's derivative, at the last node's hazard rate past it.

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' survival probabilities.

interpolation Interpolation

The interpolation of the probabilities.

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 base's, the default density over the survival probability, read through the curve.

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

Parameters

times ReadOnlySpan<double>

The nodes' times, which this kind doesn't read.

data ReadOnlySpan<double>

The nodes' data, which this kind doesn't read.

interpolation Interpolation

The interpolation, which this kind doesn't read.

t double

The time.

curve DefaultProbabilityTermStructure

The curve.

Returns

double

The rate.

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>)

The value at the reference date: 1.

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: 50.

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 interpolation's, at the last node's hazard rate past it.

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' survival probabilities.

interpolation Interpolation

The interpolation of the probabilities.

t double

The time.

Returns

double

The probability.

Exceptions

ArgumentException

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 p, int i)

Parameters

data double[]

The curve's data.

p double
i int

The node.

Exceptions

ArgumentOutOfRangeException

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