SwaptionCashFixedIborBlackMethod { public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final SwaptionCashFixedIbor swaption, final BlackSwaptionFlatProviderInterface curveBlack) { ArgumentChecker.notNull(swaption, "Swaption"); ArgumentChecker.notNull(curveBlack, "Curves with Black volatility"); final double tenor = swaption.getMaturityTime(); final double forward = swaption.getUnderlyingSwap().accept(PRDC, curveBlack.getMulticurveProvider()); final MulticurveSensitivity forwardDr = swaption.getUnderlyingSwap().accept(PRCS, curveBlack.getMulticurveProvider()); final double pvbp = METHOD_SWAP.getAnnuityCash(swaption.getUnderlyingSwap(), forward); final double pvbpDf = METHOD_SWAP.getAnnuityCashDerivative(swaption.getUnderlyingSwap(), forward); final BlackPriceFunction blackFunction = new BlackPriceFunction(); final double volatility = curveBlack.getBlackParameters().getVolatility(swaption.getTimeToExpiry(), tenor); final double discountFactorSettle = curveBlack.getMulticurveProvider().getDiscountFactor(swaption.getCurrency(), swaption.getSettlementTime()); final BlackFunctionData dataBlack = new BlackFunctionData(forward, 1.0, volatility); 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)); MulticurveSensitivity result = forwardDr.multipliedBy(discountFactorSettle * (pvbpDf * bsAdjoint[0] + pvbp * bsAdjoint[1])); if (!swaption.isLong()) { result = result.multipliedBy(-1); } return MultipleCurrencyMulticurveSensitivity.of(swaption.getCurrency(), result); } private  SwaptionCashFixedIborBlackMethod(); static SwaptionCashFixedIborBlackMethod getInstance(); MultipleCurrencyAmount presentValue(final SwaptionCashFixedIbor swaption, final BlackSwaptionFlatProviderInterface curveBlack); double impliedVolatility(final SwaptionCashFixedIbor swaption, final BlackSwaptionFlatProviderInterface blackMulticurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final SwaptionCashFixedIbor swaption, final BlackSwaptionFlatProviderInterface curveBlack); MultipleCurrencyMulticurveSensitivity presentValueSecondOrderCurveSensitivity(final SwaptionCashFixedIbor swaption, final BlackSwaptionFlatProviderInterface curveBlack); PresentValueSwaptionSurfaceSensitivity presentValueBlackSensitivity(final SwaptionCashFixedIbor swaption, final BlackSwaptionFlatProviderInterface curveBlack);  }
@Test(enabled = false) public void presentValueCurveSensitivity() { final MultipleCurrencyParameterSensitivity pvpsExact = PS_BS_C.calculateSensitivity(SWAPTION_LONG_REC, BLACK_MULTICURVES, BLACK_MULTICURVES.getMulticurveProvider().getAllNames()); final MultipleCurrencyParameterSensitivity pvpsFD = PS_BS_FDC.calculateSensitivity(SWAPTION_LONG_REC, BLACK_MULTICURVES); AssertSensitivityObjects.assertEquals("Swaption Black method: presentValueCurveSensitivity ", pvpsExact, pvpsFD, TOLERANCE_DELTA); }
@Test public void presentValueCurveSensitivityMethodVsCalculator() { final MultipleCurrencyMulticurveSensitivity pvcsMethod = METHOD_BLACK.presentValueCurveSensitivity(SWAPTION_LONG_REC, BLACK_MULTICURVES); final MultipleCurrencyMulticurveSensitivity pvcsCalculator = SWAPTION_LONG_REC.accept(PVCSBSC, BLACK_MULTICURVES); AssertSensitivityObjects.assertEquals("Swaption Black method: present value", pvcsMethod, pvcsCalculator, TOLERANCE_DELTA); }