Class DupireLocalVolatility
- All Implemented Interfaces:
LocalVolatility
The class supports two formulas:
- Dupire's formula from option prices,
- Gatheral's formula from Black-Scholes implied lognormal volatilities.
The class is a concrete implementation of LocalVolatility. It is
intended to be framework-neutral and may be used by finite-difference models
and Monte Carlo models alike.
The supplied OptionSurfaceDataInterpolated remains responsible only
for interpolation and quoting-convention conversion. This class is
responsible
only for computing the local volatility from that surface.
If the formula is set to DupireLocalVolatility.LocalVolatilityFormula.AUTOMATIC, then:
VolatilitySurface.QuotingConvention.PRICEuses Dupire's price formula,VolatilitySurface.QuotingConvention.VOLATILITYLOGNORMALuses Gatheral's formula.
If a formula is selected explicitly, the constructor creates the appropriate
converted surface at the original nodes by using
OptionSurfaceDataInterpolated.getCloneForQuotingConvention(QuotingConv ention).
- Author:
- Alessandro Gnoatto
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumFormula used to compute the local volatility.static enumPolicy for negative or numerically unstable local variances. -
Constructor Summary
ConstructorsConstructorDescriptionDupireLocalVolatility(OptionSurfaceDataInterpolated quoteSurface) Creates a Dupire local volatility provider using automatic formula selection.DupireLocalVolatility(OptionSurfaceDataInterpolated quoteSurface, DupireLocalVolatility.LocalVolatilityFormula formula) Creates a Dupire local volatility provider using the selected formula.DupireLocalVolatility(OptionSurfaceDataInterpolated quoteSurface, DupireLocalVolatility.LocalVolatilityFormula formula, double timeEpsilon, double strikeEpsilonFactor, double varianceFloor, DupireLocalVolatility.NegativeLocalVarianceHandling negativeLocalVarianceHandling) Creates a Dupire local volatility provider. -
Method Summary
Modifier and TypeMethodDescriptionReturns the effective formula.Returns the surface actually used by the formula.doublegetLocalVarianceFromImpliedVolatilities(double time, double strike) Returns the local variance from Gatheral's implied-volatility formula.doublegetLocalVarianceFromOptionPrices(double time, double strike) Returns the local variance from Dupire's formula applied to option prices.doublegetLocalVolatilityFromImpliedVolatilities(double time, double strike) Returns the local volatility from Gatheral's implied-volatility formula.doublegetLocalVolatilityFromOptionPrices(double time, double strike) Returns the local volatility from Dupire's formula applied to option prices.Returns the negative local variance handling policy.Returns the input quote surface.Returns the requested formula.doubleReturns the relative finite-difference bump in strike.doubleReturns the finite-difference bump in time.doublegetValue(double time, double assetValue) Returns the local volatilitysigma(t, S).doubleReturns the local variance floor.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LocalVolatility
getLocalVolatility, getLocalVolatility, getValue
-
Constructor Details
-
DupireLocalVolatility
Creates a Dupire local volatility provider using automatic formula selection.- Parameters:
quoteSurface- The interpolated option surface.
-
DupireLocalVolatility
public DupireLocalVolatility(OptionSurfaceDataInterpolated quoteSurface, DupireLocalVolatility.LocalVolatilityFormula formula) Creates a Dupire local volatility provider using the selected formula.- Parameters:
quoteSurface- The interpolated option surface.formula- The formula to be used.
-
DupireLocalVolatility
public DupireLocalVolatility(OptionSurfaceDataInterpolated quoteSurface, DupireLocalVolatility.LocalVolatilityFormula formula, double timeEpsilon, double strikeEpsilonFactor, double varianceFloor, DupireLocalVolatility.NegativeLocalVarianceHandling negativeLocalVarianceHandling) Creates a Dupire local volatility provider.- Parameters:
quoteSurface- The interpolated option surface.formula- The formula to be used.timeEpsilon- The finite-difference bump in time.strikeEpsilonFactor- The relative finite-difference bump in strike.varianceFloor- The local variance floor.negativeLocalVarianceHandling- The policy for negative local variances.
-
-
Method Details
-
getValue
public double getValue(double time, double assetValue) Description copied from interface:LocalVolatilityReturns the local volatilitysigma(t, S).- Specified by:
getValuein interfaceLocalVolatility- Parameters:
time- The evaluation time.assetValue- The asset value.- Returns:
- The local volatility.
-
getLocalVarianceFromOptionPrices
public double getLocalVarianceFromOptionPrices(double time, double strike) Returns the local variance from Dupire's formula applied to option prices.- Parameters:
time- The option maturity.strike- The strike, interpreted as the asset value at which local volatility is evaluated.- Returns:
- The local variance.
-
getLocalVolatilityFromOptionPrices
public double getLocalVolatilityFromOptionPrices(double time, double strike) Returns the local volatility from Dupire's formula applied to option prices.- Parameters:
time- The option maturity.strike- The strike, interpreted as the asset value at which local volatility is evaluated.- Returns:
- The local volatility.
-
getLocalVarianceFromImpliedVolatilities
public double getLocalVarianceFromImpliedVolatilities(double time, double strike) Returns the local variance from Gatheral's implied-volatility formula.- Parameters:
time- The option maturity.strike- The strike, interpreted as the asset value at which local volatility is evaluated.- Returns:
- The local variance.
-
getLocalVolatilityFromImpliedVolatilities
public double getLocalVolatilityFromImpliedVolatilities(double time, double strike) Returns the local volatility from Gatheral's implied-volatility formula.- Parameters:
time- The option maturity.strike- The strike, interpreted as the asset value at which local volatility is evaluated.- Returns:
- The local volatility.
-
getQuoteSurface
Returns the input quote surface.- Returns:
- The input quote surface.
-
getFormulaSurface
Returns the surface actually used by the formula.For Dupire from prices, this is a price surface. For Gatheral, this is a lognormal implied-volatility surface.
- Returns:
- The formula surface.
-
getRequestedFormula
Returns the requested formula.- Returns:
- The requested formula.
-
getEffectiveFormula
Returns the effective formula.- Returns:
- The effective formula.
-
getTimeEpsilon
public double getTimeEpsilon()Returns the finite-difference bump in time.- Returns:
- The time bump.
-
getStrikeEpsilonFactor
public double getStrikeEpsilonFactor()Returns the relative finite-difference bump in strike.- Returns:
- The strike bump factor.
-
getVarianceFloor
public double getVarianceFloor()Returns the local variance floor.- Returns:
- The variance floor.
-
getNegativeLocalVarianceHandling
Returns the negative local variance handling policy.- Returns:
- The policy.
-