SwaptionCashFixedIborSABRMethod { public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData) { ArgumentChecker.notNull(swaption, "Swaption"); ArgumentChecker.notNull(sabrData, "SABR swaption provider"); final MulticurveProviderInterface multicurves = sabrData.getMulticurveProvider(); final Currency ccy = swaption.getCurrency(); final AnnuityCouponFixed annuityFixed = swaption.getUnderlyingSwap().getFixedLeg(); final double forward = swaption.getUnderlyingSwap().accept(PRDC, multicurves); final MulticurveSensitivity forwardDr = swaption.getUnderlyingSwap().accept(PRCSDC, multicurves); final double pvbp = METHOD_SWAP.getAnnuityCash(swaption.getUnderlyingSwap(), forward); final double pvbpDf = METHOD_SWAP.getAnnuityCashDerivative(swaption.getUnderlyingSwap(), forward); final double maturity = annuityFixed.getNthPayment(annuityFixed.getNumberOfPayments() - 1).getPaymentTime() - swaption.getSettlementTime(); final BlackPriceFunction blackFunction = new BlackPriceFunction(); final double[] volatilityAdjoint = sabrData.getSABRParameter().getVolatilityAdjoint(swaption.getTimeToExpiry(), maturity, swaption.getStrike(), forward); final double discountFactorSettle = multicurves.getDiscountFactor(ccy, swaption.getSettlementTime()); final BlackFunctionData dataBlack = new BlackFunctionData(forward, 1.0, volatilityAdjoint[0]); final double[] bsAdjoint = blackFunction.getPriceAdjoint(swaption, dataBlack); final double sensiDF = -swaption.getSettlementTime() * discountFactorSettle * pvbp * bsAdjoint[0]; final List<DoublesPair> list = new ArrayList<>(); list.add(DoublesPair.of(swaption.getSettlementTime(), sensiDF)); final Map<String, List<DoublesPair>> resultMap = new HashMap<>(); resultMap.put(multicurves.getName(ccy), list); MulticurveSensitivity result = MulticurveSensitivity.ofYieldDiscounting(resultMap); result = result.plus(forwardDr.multipliedBy(discountFactorSettle * (pvbpDf * bsAdjoint[0] + pvbp * (bsAdjoint[1] + bsAdjoint[2] * volatilityAdjoint[1])))); if (!swaption.isLong()) { result = result.multipliedBy(-1); } return MultipleCurrencyMulticurveSensitivity.of(ccy, result); } private  SwaptionCashFixedIborSABRMethod(); static SwaptionCashFixedIborSABRMethod getInstance(); MultipleCurrencyAmount presentValue(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); PresentValueSABRSensitivityDataBundle presentValueSABRSensitivity(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); double impliedVolatility(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData);  }
@Test public void presentValueCurveSensitivity() { final MultipleCurrencyParameterSensitivity pvpsExact = PS_SS_C.calculateSensitivity(SWAPTION_LONG_PAYER, SABR_MULTICURVES, SABR_MULTICURVES.getMulticurveProvider().getAllNames()); final MultipleCurrencyParameterSensitivity pvpsFD = PS_SS_FDC.calculateSensitivity(SWAPTION_LONG_PAYER, SABR_MULTICURVES); AssertSensitivityObjects.assertEquals("SwaptionPhysicalFixedIborSABRMethod: presentValueCurveSensitivity ", pvpsExact, pvpsFD, TOLERANCE_PV_DELTA); }