Class MarketModelPathwiseDiscounter
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
paymentTimedoubleThe payment time.
rateTimesReadOnlySpan<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
liborRatesMatrixThe rates at each step; not read, as in QuantLib.
discountsMatrixThe discount factors P(t_0, t_j), j = 0 to the number of rates, at each step.
currentStepintThe step's row in
discounts.factorsSpan<double>The units, then the derivatives: 1 + the number of rates entries, written.
Exceptions
- ArgumentException
factorsholds fewer than 1 + the number of rates entries.- ArgumentOutOfRangeException
currentStepisn't a row ofdiscounts, where QuantLib reads past its end.- ArgumentException
discountsdoesn't reach the column after the step's rate, where QuantLib reads past its end.