# Volatility surface implementations

Hi everyone,

I am using the NodalSurface class to implement an Fx volatility surface for vol values against strike and tenor. However, there is some confusion pertaining to the following points -

1. The nodal surface asks for interpolators, but no extrapolators. This isn’t ideal as several vol surface construction methods also require extrapolation techniques.
2. There doesn’t seem any easy way to override the interpolators for building the surface as I desire. (I intend to interpolate sigma^2*t along the time axis)
3. Lastly, is there a better way to implement and customize a Vol Surface than through a NodalSurface ?

Sincerely
Amitabh

Hi Amitabh,

1. The notion of “interpolator” has to be viewed in the generalized sense of “interpolator and extrapolator combined". For example the following code creates a 2-dimension “interpolator” based on linear interpolation and flat extrapolation in both dimensions.

Interpolator1D LINEAR_FLAT = CombinedInterpolatorExtrapolator.of(
CurveInterpolators.LINEAR.getName(),
CurveExtrapolators.FLAT.getName(),
CurveExtrapolators.FLAT.getName());
GridInterpolator2D INTERPOLATOR_2D = new GridInterpolator2D(LINEAR_FLAT, LINEAR_FLAT);

2. There is an interpolator doing “sigma^2*t”: TimeSquareInterpolator1D. The name is not perfect but it mean “time multiplied by the value to the square” (see https://github.com/OpenGamma/Strata/blob/master/modules/math/src/main/java/com/opengamma/strata/math/impl/interpolation/TimeSquareInterpolator1D.java)

3. Depending what you want to do. NodalSurface is the standard way for interpolated surfaces. We have also implemented functional form of surfaces for volatilities like SABR (https://github.com/OpenGamma/Strata/blob/master/modules/pricer/src/main/java/com/opengamma/strata/pricer/impl/volatility/smile/function/SabrHaganVolatilityFunctionProvider.java) and SSVI (https://github.com/OpenGamma/Strata/blob/master/modules/pricer/src/main/java/com/opengamma/strata/pricer/impl/volatility/smile/function/SsviVolatilityFunction.java).

Regards,

Marc

Hi Marc,

Thanks for the reply. That does clear up quite a lot of things.

Sincerely,
Amitabh

Just to note that at some point, `GridInterpolator2D` will be replaced as it is ported from older code (and is thus harder to use). See `InterpolatedNodalCurve` to see how the API is more obvious for curves.