Class ImpliedTrinomialTreeLocalVolatilityCalculator
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.volatility.local.ImpliedTrinomialTreeLocalVolatilityCalculator
-
- All Implemented Interfaces:
LocalVolatilityCalculator
public class ImpliedTrinomialTreeLocalVolatilityCalculator extends Object implements LocalVolatilityCalculator
Local volatility calculation based on trinomila tree model.Emanuel Derman, Iraj Kani and Neil Chriss, "Implied Trinomial Trees of the Volatility Smile" (1996).
-
-
Constructor Summary
Constructors Constructor Description ImpliedTrinomialTreeLocalVolatilityCalculator()
Creates an instance with default setups.ImpliedTrinomialTreeLocalVolatilityCalculator(int nSteps, double maxTime)
Creates an instance with the number of steps and maximum time fixed.ImpliedTrinomialTreeLocalVolatilityCalculator(int nSteps, double maxTime, SurfaceInterpolator interpolator)
Creates an instance by specifying the number of steps, maximum time, and 2D interpolator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecombiningTrinomialTreeData
calibrateImpliedVolatility(Function<DoublesPair,Double> impliedVolatilitySurface, double spot, Function<Double,Double> interestRate, Function<Double,Double> dividendRate)
Calibrate trinomial tree to implied volatility surface.InterpolatedNodalSurface
localVolatilityFromImpliedVolatility(Surface impliedVolatilitySurface, double spot, Function<Double,Double> interestRate, Function<Double,Double> dividendRate)
Computes local volatility surface from implied volatility surface.InterpolatedNodalSurface
localVolatilityFromPrice(Surface callPriceSurface, double spot, Function<Double,Double> interestRate, Function<Double,Double> dividendRate)
Computes local volatility surface from call price surface.
-
-
-
Constructor Detail
-
ImpliedTrinomialTreeLocalVolatilityCalculator
public ImpliedTrinomialTreeLocalVolatilityCalculator()
Creates an instance with default setups.The number of time steps is 20, and the tree covers up to 3 years. The time square linear interpolator is used for time direction, whereas the linear interpolator is used for spot dimension. The extrapolation is flat for both the dimensions.
-
ImpliedTrinomialTreeLocalVolatilityCalculator
public ImpliedTrinomialTreeLocalVolatilityCalculator(int nSteps, double maxTime)
Creates an instance with the number of steps and maximum time fixed.The default interpolators are used: the time square linear interpolator for time direction, the linear interpolator for spot dimension, and flat extrapolator for both the dimensions.
- Parameters:
nSteps
- the number of stepsmaxTime
- the maximum time
-
ImpliedTrinomialTreeLocalVolatilityCalculator
public ImpliedTrinomialTreeLocalVolatilityCalculator(int nSteps, double maxTime, SurfaceInterpolator interpolator)
Creates an instance by specifying the number of steps, maximum time, and 2D interpolator.- Parameters:
nSteps
- number of stepsmaxTime
- the maximum timeinterpolator
- the interpolator
-
-
Method Detail
-
localVolatilityFromImpliedVolatility
public InterpolatedNodalSurface localVolatilityFromImpliedVolatility(Surface impliedVolatilitySurface, double spot, Function<Double,Double> interestRate, Function<Double,Double> dividendRate)
Description copied from interface:LocalVolatilityCalculator
Computes local volatility surface from implied volatility surface.The implied volatility surface must be spanned by time to expiry and strike.
The interest rate and dividend rate must be zero-coupon continuously compounded rates based on respective day count convention. Thus
interestRate
anddividendRate
are functions from year fraction to zero rate.- Specified by:
localVolatilityFromImpliedVolatility
in interfaceLocalVolatilityCalculator
- Parameters:
impliedVolatilitySurface
- the implied volatility surfacespot
- the spotinterestRate
- the interest ratedividendRate
- the dividend- Returns:
- the local volatility surface
-
calibrateImpliedVolatility
public RecombiningTrinomialTreeData calibrateImpliedVolatility(Function<DoublesPair,Double> impliedVolatilitySurface, double spot, Function<Double,Double> interestRate, Function<Double,Double> dividendRate)
Calibrate trinomial tree to implied volatility surface.- Parameters:
impliedVolatilitySurface
- the implied volatility surfacespot
- the spotinterestRate
- the interest ratedividendRate
- the dividend rate- Returns:
- the trinomial tree
-
localVolatilityFromPrice
public InterpolatedNodalSurface localVolatilityFromPrice(Surface callPriceSurface, double spot, Function<Double,Double> interestRate, Function<Double,Double> dividendRate)
Description copied from interface:LocalVolatilityCalculator
Computes local volatility surface from call price surface.The interest rate and dividend rate must be zero-coupon continuously compounded rates based on respective day count convention. Thus
interestRate
anddividendRate
are functions from year fraction to zero rate.- Specified by:
localVolatilityFromPrice
in interfaceLocalVolatilityCalculator
- Parameters:
callPriceSurface
- the price surfacespot
- the spotinterestRate
- the interest ratedividendRate
- the dividend rate- Returns:
- the local volatility surface
-
-