Table of Contents

Class MarketModelPathwiseDiscounter

Namespace
NanoQL.Models
Assembly
NanoQL.dll

The number of units of the discretely compounding money-market account a unit paid at a time buys on a step's rates, and its derivative with respect to each forward rate, for the pathwise Greeks: the discount factors of the rate times bracketing the payment, log-linearly interpolated between them.

public sealed class MarketModelPathwiseDiscounter
Inheritance
MarketModelPathwiseDiscounter
Inherited Members

Remarks

Discounting reads the simulated rates only: to discount back to time 0, multiply by the discount factor of the first rate time.

Immutable: a pure function of a step's discount factors.

The bracket (a documented divergence): the period's start is the last rate time at or before the payment, clamped to the periods, as MarketModelDiscounter's. QuantLib's lower_bound takes the first rate time at or after the payment (pathwisediscounter.cpp:32), so a payment strictly inside a period but the last is extrapolated from the next period (Divergences/MarketModelDiscounterBracketTests.cs). A payment on a rate time, before the first or after the last gives QuantLib's bits.

Constructors

MarketModelPathwiseDiscounter(double, ReadOnlySpan<double>)

Initializes a new instance of the MarketModelPathwiseDiscounter class.

public MarketModelPathwiseDiscounter(double paymentTime, ReadOnlySpan<double> rateTimes)

Parameters

paymentTime double

The payment time.

rateTimes ReadOnlySpan<double>

The rate times, at least two, increasing.

Exceptions

ArgumentException

There are fewer than two rate times, or they aren't increasing.

Methods

GetFactors(Matrix, Matrix, int, Span<double>)

Writes the money-market units a unit paid at the payment time buys at a step, then its derivative with respect to each forward rate.

public void GetFactors(Matrix liborRates, Matrix discounts, int currentStep, Span<double> factors)

Parameters

liborRates Matrix

The rates at each step; not read, as in QuantLib.

discounts Matrix

The discount factors P(t_0, t_j), j = 0 to the number of rates, at each step.

currentStep int

The step's row in discounts.

factors Span<double>

The units, then the derivatives: 1 + the number of rates entries, written.

Exceptions

ArgumentException

factors holds fewer than 1 + the number of rates entries.

ArgumentOutOfRangeException

currentStep isn't a row of discounts, where QuantLib reads past its end.

ArgumentException

discounts doesn't reach the column after the step's rate, where QuantLib reads past its end.