}
}
@Test
public void presentValueSABRSensitivity() {
final PresentValueSABRSensitivityDataBundle pvcs = METHOD.presentValueSABRSensitivity(TRANSACTION, SABR_BUNDLE);
// SABR sensitivity vs finite difference
final double pv = METHOD.presentValue(TRANSACTION, SABR_BUNDLE).getAmount();
final double shift = 0.000001;
final double delay = EDU2.getLastTradingTime() - OPTION_EDU2.getExpirationTime();
final DoublesPair expectedExpiryDelay = new DoublesPair(OPTION_EDU2.getExpirationTime(), delay);
// Alpha sensitivity vs finite difference computation
final SABRInterestRateParameters sabrParameterAlphaBumped = TestsDataSetsSABR.createSABR1AlphaBumped(shift);
final SABRInterestRateDataBundle sabrBundleAlphaBumped = new SABRInterestRateDataBundle(sabrParameterAlphaBumped, CURVES_BUNDLE);
final double pvAlphaBumped = METHOD.presentValue(TRANSACTION, sabrBundleAlphaBumped).getAmount();
final double expectedAlphaSensi = (pvAlphaBumped - pv) / shift;
assertEquals("Number of alpha sensitivity", pvcs.getAlpha().getMap().keySet().size(), 1);
assertEquals("Alpha sensitivity expiry/tenor", pvcs.getAlpha().getMap().keySet().contains(expectedExpiryDelay), true);
assertEquals("Alpha sensitivity value", pvcs.getAlpha().getMap().get(expectedExpiryDelay), expectedAlphaSensi, 1.0E+1);
// Rho sensitivity vs finite difference computation
final SABRInterestRateParameters sabrParameterRhoBumped = TestsDataSetsSABR.createSABR1RhoBumped(shift);
final SABRInterestRateDataBundle sabrBundleRhoBumped = new SABRInterestRateDataBundle(sabrParameterRhoBumped, CURVES_BUNDLE);
final double pvRhoBumped = METHOD.presentValue(TRANSACTION, sabrBundleRhoBumped).getAmount();
final double expectedRhoSensi = (pvRhoBumped - pv) / shift;
assertEquals("Number of rho sensitivity", pvcs.getRho().getMap().keySet().size(), 1);
assertEquals("Rho sensitivity expiry/tenor", pvcs.getRho().getMap().keySet().contains(expectedExpiryDelay), true);
assertEquals("Rho sensitivity value", pvcs.getRho().getMap().get(expectedExpiryDelay), expectedRhoSensi, 1.0E+0);
// Alpha sensitivity vs finite difference computation
final SABRInterestRateParameters sabrParameterNuBumped = TestsDataSetsSABR.createSABR1NuBumped(shift);
final SABRInterestRateDataBundle sabrBundleNuBumped = new SABRInterestRateDataBundle(sabrParameterNuBumped, CURVES_BUNDLE);
final double pvNuBumped = METHOD.presentValue(TRANSACTION, sabrBundleNuBumped).getAmount();
final double expectedNuSensi = (pvNuBumped - pv) / shift;
assertEquals("Number of nu sensitivity", pvcs.getNu().getMap().keySet().size(), 1);
assertEquals("Nu sensitivity expiry/tenor", pvcs.getNu().getMap().keySet().contains(expectedExpiryDelay), true);
assertEquals("Nu sensitivity value", pvcs.getNu().getMap().get(expectedExpiryDelay), expectedNuSensi, 1.0E+0);
}