SkewnessKurtosisBlackScholesMertonEquivalentVolatilitySurfaceModel implements VolatilitySurfaceModel<OptionDefinition, SkewKurtosisOptionDataBundle> { @Override public VolatilitySurface getSurface(final OptionDefinition option, final SkewKurtosisOptionDataBundle data) { Validate.notNull(option, "option"); Validate.notNull(data, "data"); final double s = data.getSpot(); final double t = option.getTimeToExpiry(data.getDate()); final double k = option.getStrike(); final double sigma = data.getVolatility(t, k); final double b = data.getCostOfCarry(); final double skew = data.getAnnualizedSkew(); final double kurtosis = data.getAnnualizedFisherKurtosis(); final double d1 = (Math.log(s / k) + t * (b + sigma * sigma * 0.5)) / sigma / Math.sqrt(t); return new VolatilitySurface(ConstantDoublesSurface.from(sigma * (1 - skew * d1 / 6 - kurtosis * (1 - d1 * d1) / 24))); }  @Override VolatilitySurface getSurface(final OptionDefinition option, final SkewKurtosisOptionDataBundle data);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullOption() { MODEL.getSurface(null, DATA); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { MODEL.getSurface(OPTION, null); }
@Test public void test() { assertEquals(MODEL.getSurface(OPTION, DATA).getVolatility(DoublesPair.of(1., 1.)), SIGMA, 1e-15); }