Class VolatilityInterpolationSpecifierabcd
The volatility interpolation of synthetic short rates on abcd curves: each long rate's a, b and d scaled, each short rate between two long ones on the mean of their a, b, c and d, those before the first and after the last on the nearest long rate's, the last rescaled to match the last caplet's volatility.
public sealed class VolatilityInterpolationSpecifierabcd : VolatilityInterpolationSpecifier
- Inheritance
-
VolatilityInterpolationSpecifierabcd
- Inherited Members
Remarks
Immutable: WithScalingFactors(ReadOnlySpan<double>) and WithLastCapletVol(double) return a new specifier, where QuantLib's setters change it in place.
One departure from QuantLib (Divergences/VolatilityInterpolationSpecifierOffsetTests.cs): a short rate
between two long rates resets at its own index, i + j·period + offset, where QuantLib's resets at i +
j·period, an earlier rate's, at an offset other than 0
(volatilityinterpolationspecifierabcd.cpp:169-170). A period of 0, which QuantLib divides by, no long rates,
whose last QuantLib reads, no short rate times, and long rates' times past the short ones, which QuantLib reads
past, are refused.
Constructors
VolatilityInterpolationSpecifierabcd(int, int, ReadOnlySpan<PiecewiseConstantAbcdVariance>, ReadOnlySpan<double>, double)
Initializes a new instance of the VolatilityInterpolationSpecifierabcd class.
public VolatilityInterpolationSpecifierabcd(int period, int offset, ReadOnlySpan<PiecewiseConstantAbcdVariance> originalVariances, ReadOnlySpan<double> timesForSmallRates, double lastCapletVol = 0)
Parameters
periodintThe short rates each long rate spans, at least 1.
offsetintThe short rates before the first long rate.
originalVariancesReadOnlySpan<PiecewiseConstantAbcdVariance>The long rates' abcd variances, at least one, on every period-th short rate time.
timesForSmallRatesReadOnlySpan<double>The short rates' rate times.
lastCapletVoldoubleThe last caplet's volatility; 0 for the last long rate's own total volatility.
Exceptions
- ArgumentException
The counts of long and short rates don't match the period and offset, a long rate's times aren't the short ones, or there are no long rates or short rate times.
- ArgumentOutOfRangeException
periodis below 1 oroffsetnegative.
Properties
InterpolatedVariances
Gets the short rates' interpolated variances, one per short rate.
public override ImmutableArray<PiecewiseConstantVariance> InterpolatedVariances { get; }
Property Value
NoBigRates
Gets the number of long rates.
public override int NoBigRates { get; }
Property Value
NoSmallRates
Gets the number of short rates.
public override int NoSmallRates { get; }
Property Value
Offset
Gets the short rates before the first long rate.
public override int Offset { get; }
Property Value
OriginalVariances
Gets the long rates' variances, one per long rate.
public override ImmutableArray<PiecewiseConstantVariance> OriginalVariances { get; }
Property Value
Period
Gets the short rates each long rate spans.
public override int Period { get; }
Property Value
Methods
WithLastCapletVol(double)
A specifier whose last short rate matches the caplet volatility given.
public override VolatilityInterpolationSpecifier WithLastCapletVol(double vol)
Parameters
voldoubleThe last caplet's volatility.
Returns
- VolatilityInterpolationSpecifier
The new specifier.
WithScalingFactors(ReadOnlySpan<double>)
A specifier whose long rates' variances are scaled by the factors given.
public override VolatilityInterpolationSpecifier WithScalingFactors(ReadOnlySpan<double> scales)
Parameters
scalesReadOnlySpan<double>The scaling factors, one per long rate.
Returns
- VolatilityInterpolationSpecifier
The new specifier.
Exceptions
- ArgumentException
The factors aren't one per long rate.