* Tests the correctness of Hull-White one factor calibration to swaptions with SABR price.
*/
public void calibration() {
final double meanReversion = 0.01;
final HullWhiteOneFactorPiecewiseConstantParameters hwParameters = new HullWhiteOneFactorPiecewiseConstantParameters(meanReversion, new double[] {0.01}, new double[0]);
final SuccessiveRootFinderHullWhiteCalibrationObjective objective = new SuccessiveRootFinderHullWhiteCalibrationObjective(hwParameters, EUR);
final SuccessiveRootFinderHullWhiteCalibrationEngine<SABRCapProviderInterface> calibrationEngine = new SuccessiveRootFinderHullWhiteCalibrationEngine<>(objective);
for (int loopexp = 0; loopexp < CAP.getNumberOfPayments(); loopexp++) {
calibrationEngine.addInstrument(CAP.getNthPayment(loopexp), PVSCC);
}
calibrationEngine.calibrate(SABR_MULTICURVES);
final MultipleCurrencyAmount[] pvSabr = new MultipleCurrencyAmount[CAP.getNumberOfPayments()];
final MultipleCurrencyAmount[] pvHw = new MultipleCurrencyAmount[CAP.getNumberOfPayments()];
for (int loopexp = 0; loopexp < CAP.getNumberOfPayments(); loopexp++) {
pvSabr[loopexp] = CAP.getNthPayment(loopexp).accept(PVSCC, SABR_MULTICURVES);
pvHw[loopexp] = METHOD_CAP_HW.presentValue((CapFloorIbor) CAP.getNthPayment(loopexp), objective.getHwProvider());
assertEquals("Hull-White calibration: cap/floor " + loopexp, pvSabr[loopexp].getAmount(EUR), pvHw[loopexp].getAmount(EUR), TOLERANCE_PV);
}
}