SwaptionCashFixedIborSABRMethod { public MultipleCurrencyAmount presentValue(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData) { ArgumentChecker.notNull(swaption, "Swaption"); ArgumentChecker.notNull(sabrData, "SABR swaption provider"); final double forward = swaption.getUnderlyingSwap().accept(PRDC, sabrData.getMulticurveProvider()); final double pvbp = METHOD_SWAP.getAnnuityCash(swaption.getUnderlyingSwap(), forward); final BlackPriceFunction blackFunction = new BlackPriceFunction(); final double volatility = sabrData.getSABRParameter().getVolatility(swaption.getTimeToExpiry(), swaption.getMaturityTime(), swaption.getStrike(), forward); final double discountFactorSettle = sabrData.getMulticurveProvider().getDiscountFactor(swaption.getCurrency(), swaption.getSettlementTime()); final BlackFunctionData dataBlack = new BlackFunctionData(forward, discountFactorSettle * pvbp, volatility); final Function1D<BlackFunctionData, Double> func = blackFunction.getPriceFunction(swaption); final double price = func.evaluate(dataBlack) * (swaption.isLong() ? 1.0 : -1.0); return MultipleCurrencyAmount.of(swaption.getCurrency(), price); } 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 presentValue() { final MultipleCurrencyAmount priceLongPayer = SWAPTION_LONG_PAYER.accept(PVSSC, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayer = SWAPTION_SHORT_PAYER.accept(PVSSC, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiver = SWAPTION_LONG_RECEIVER.accept(PVSSC, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortReceiver = SWAPTION_SHORT_RECEIVER.accept(PVSSC, SABR_MULTICURVES); final double expectedPriceLongPayer = 2419978.690; assertEquals("SwaptionCashFixedIborSABRMethod: presentValue", expectedPriceLongPayer, priceLongPayer.getAmount(EUR), TOLERANCE_PV); final double forward = SWAP_PAYER.accept(PRDC, MULTICURVES); final double pvbp = METHOD_SWAP.getAnnuityCash(SWAP_PAYER, forward); final double maturity = SWAP_PAYER.getFirstLeg().getNthPayment(SWAP_PAYER.getFirstLeg().getNumberOfPayments() - 1).getPaymentTime() - SWAPTION_LONG_PAYER.getSettlementTime(); assertEquals(maturity, ANNUITY_TENOR_YEAR, 1E-2); final double volatility = SABR_PARAMETER.getVolatility(SWAPTION_LONG_PAYER.getTimeToExpiry(), maturity, RATE, forward); final BlackFunctionData data = new BlackFunctionData(forward, 1.0, volatility); final Function1D<BlackFunctionData, Double> func = BLACK_FUNCTION.getPriceFunction(SWAPTION_LONG_PAYER); final double df = MULTICURVES.getDiscountFactor(EUR, SWAPTION_LONG_PAYER.getSettlementTime()); final double expectedPrice = df * pvbp * func.evaluate(data); assertEquals("SwaptionCashFixedIborSABRMethod: presentValue", expectedPrice, priceLongPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("SwaptionCashFixedIborSABRMethod: presentValue", priceLongPayer.getAmount(EUR), -priceShortPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("SwaptionCashFixedIborSABRMethod: presentValue", priceLongReceiver.getAmount(EUR), -priceShortReceiver.getAmount(EUR), TOLERANCE_PV); }