Class SmileSectionRNDCalculator
The risk-neutral density of the logarithm of the underlying at a smile section's expiry, by the Breeden-Litzenberger identity: the density and distribution from the section's prices, the inverse from a table of log-moneyness against the normal quantile z = Φ⁻¹(P(S ≤ K)), linear for a lognormal law and well conditioned in the wings.
public sealed class SmileSectionRNDCalculator : RiskNeutralDensityCalculator
- Inheritance
-
SmileSectionRNDCalculator
- Inherited Members
Remarks
Immutable. The quantile table is built at construction (the playbook's LazyObject row), where QuantLib builds
it at the first inverse; where it can't be built, the refusal is recorded and raised from
InvCdf(double, double), QuantLib's point, since the density and distribution never need the table. Its
argument x is ln(S); its only time is the section's exercise time.
Constructors
SmileSectionRNDCalculator(SmileSection, int, double)
Initializes a new instance of the SmileSectionRNDCalculator class.
public SmileSectionRNDCalculator(SmileSection smile, int nStrikes = 200, double nStd = 8)
Parameters
smileSmileSectionThe smile section.
nStrikesintThe quantile table's size, at least 4.
nStddoubleThe table's half-width in normal quantiles, positive; the inverse saturates there, or at the deepest the smile still prices.
Exceptions
- ArgumentNullException
smileis null.- ArgumentException
Fewer than 4 strikes, or a non-positive half-width, with QuantLib's messages.
Methods
Cdf(double)
The distribution function of ln(S) at the section's exercise time.
public double Cdf(double x)
Parameters
xdoubleThe logarithm of the underlying.
Returns
- double
The probability.
Cdf(double, double)
The distribution function of ln(S) at the section's exercise time, each tail from its own option type.
public override double Cdf(double x, double t)
Parameters
Returns
- double
The probability.
Exceptions
- ArgumentException
The time isn't the section's, with QuantLib's message.
InvCdf(double)
The inverse of the distribution function at the section's exercise time.
public double InvCdf(double p)
Parameters
pdoubleThe probability, in (0, 1).
Returns
- double
The logarithm of the underlying.
Exceptions
- ArgumentException
The probability is outside (0, 1).
- NanoQLException
The quantile table couldn't be built.
InvCdf(double, double)
The inverse of the distribution function at the section's exercise time, from the quantile table.
public override double InvCdf(double p, double t)
Parameters
Returns
- double
The logarithm of the underlying.
Exceptions
- ArgumentException
The time isn't the section's, or the probability is outside (0, 1), with QuantLib's messages.
- NanoQLException
The quantile table couldn't be built: QuantLib's refusal, raised here, as QuantLib raises it.
Pdf(double)
The density of ln(S) at the section's exercise time.
public double Pdf(double x)
Parameters
xdoubleThe logarithm of the underlying.
Returns
- double
The density.
Pdf(double, double)
The density of ln(S) at the section's exercise time.
public override double Pdf(double x, double t)
Parameters
xdoubleThe logarithm of the underlying.
tdoubleThe time, the section's exercise time within QuantLib's
close_enough.
Returns
- double
The density.
Exceptions
- ArgumentException
The time isn't the section's, with QuantLib's message.