public void test() {
assertEquals(MODEL.getSurface(OPTION, DATA).getVolatility(PAIR), 0.3454, EPS);
SABRDataBundle data1 = DATA.withRho(-0.75).withBeta(0.999);
SABRDataBundle data2 = DATA.withRho(0).withBeta(0.999);
SABRDataBundle data3 = DATA.withRho(0.5).withBeta(0.999);
OptionDefinition option = new EuropeanVanillaOptionDefinition(70, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.3668, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3165, EPS);
assertEquals(MODEL.getSurface(option, data3).getVolatility(PAIR), 0.2709, EPS);
option = new EuropeanVanillaOptionDefinition(80, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.3418, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3068, EPS);
assertEquals(MODEL.getSurface(option, data3).getVolatility(PAIR), 0.2774, EPS);
option = new EuropeanVanillaOptionDefinition(90, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.3197, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3016, EPS);
assertEquals(MODEL.getSurface(option, data3).getVolatility(PAIR), 0.2878, EPS);
option = new EuropeanVanillaOptionDefinition(100, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.3000, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3000, EPS);
assertEquals(MODEL.getSurface(option, data3).getVolatility(PAIR), 0.3000, EPS);
option = new EuropeanVanillaOptionDefinition(110, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.2826, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3013, EPS);
assertEquals(MODEL.getSurface(option, data3).getVolatility(PAIR), 0.3128, EPS);
option = new EuropeanVanillaOptionDefinition(120, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.2674, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3046, EPS);
assertEquals(MODEL.getSurface(option, data3).getVolatility(PAIR), 0.3255, EPS);
option = new EuropeanVanillaOptionDefinition(130, EXPIRY, false);
data1 = CALIBRATION.calibrate(option, data1);
data2 = CALIBRATION.calibrate(option, data2);
data3 = CALIBRATION.calibrate(option, data3);
assertEquals(MODEL.getSurface(option, data1).getVolatility(PAIR), 0.2546, EPS);
assertEquals(MODEL.getSurface(option, data2).getVolatility(PAIR), 0.3092, EPS);