SwaptionCashFixedIborSABRExtrapolationRightMethod { public MultipleCurrencyAmount presentValue(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 double pvbp = METHOD_SWAP.getAnnuityCash(swaption.getUnderlyingSwap(), forward); final double maturity = annuityFixed.getNthPayment(annuityFixed.getNumberOfPayments() - 1).getPaymentTime() - swaption.getSettlementTime(); final double discountFactorSettle = multicurves.getDiscountFactor(ccy, swaption.getSettlementTime()); double pv; if (swaption.getStrike() <= _cutOffStrike) { final BlackPriceFunction blackFunction = new BlackPriceFunction(); final double volatility = sabrData.getSABRParameter().getVolatility(swaption.getTimeToExpiry(), maturity, swaption.getStrike(), forward); final BlackFunctionData dataBlack = new BlackFunctionData(forward, discountFactorSettle * pvbp, volatility); final Function1D<BlackFunctionData, Double> func = blackFunction.getPriceFunction(swaption); pv = func.evaluate(dataBlack) * (swaption.isLong() ? 1.0 : -1.0); } else { final DoublesPair expiryMaturity = DoublesPair.of(swaption.getTimeToExpiry(), maturity); final double alpha = sabrData.getSABRParameter().getAlpha(expiryMaturity); final double beta = sabrData.getSABRParameter().getBeta(expiryMaturity); final double rho = sabrData.getSABRParameter().getRho(expiryMaturity); final double nu = sabrData.getSABRParameter().getNu(expiryMaturity); final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu); final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu); pv = discountFactorSettle * pvbp * sabrExtrapolation.price(swaption) * (swaption.isLong() ? 1.0 : -1.0); } return MultipleCurrencyAmount.of(ccy, pv); } SwaptionCashFixedIborSABRExtrapolationRightMethod(final double cutOffStrike, final double mu); MultipleCurrencyAmount presentValue(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); PresentValueSABRSensitivityDataBundle presentValueSABRSensitivity(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData);  }
@Test public void presentValueNoExtra() { final MultipleCurrencyAmount priceLongPayer = METHOD_EXTRAPOLATION.presentValue(SWAPTION_LONG_PAYER, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayer = METHOD_EXTRAPOLATION.presentValue(SWAPTION_SHORT_PAYER, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiver = METHOD_EXTRAPOLATION.presentValue(SWAPTION_LONG_RECEIVER, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortReceiver = METHOD_EXTRAPOLATION.presentValue(SWAPTION_SHORT_RECEIVER, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongPayerNoExtra = SWAPTION_LONG_PAYER.accept(PVSSC, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayerNoExtra = SWAPTION_SHORT_PAYER.accept(PVSSC, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiverNoExtra = SWAPTION_LONG_RECEIVER.accept(PVSSC, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortReceiverNoExtra = SWAPTION_SHORT_RECEIVER.accept(PVSSC, SABR_MULTICURVES); assertEquals("Swaption cash SABR extrapolation: below cut-off strike", priceLongPayerNoExtra.getAmount(EUR), priceLongPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: below cut-off strike", priceShortPayerNoExtra.getAmount(EUR), priceShortPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: below cut-off strike", priceLongReceiverNoExtra.getAmount(EUR), priceLongReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: below cut-off strike", priceShortReceiverNoExtra.getAmount(EUR), priceShortReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: below cut-off strike long/short parity", priceLongPayer.getAmount(EUR), -priceShortPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: below cut-off strike long/short parity", priceLongReceiver.getAmount(EUR), -priceShortReceiver.getAmount(EUR), TOLERANCE_PV); }
@Test public void presentValueExtra() { final MultipleCurrencyAmount priceLongPayer = METHOD_EXTRAPOLATION.presentValue(SWAPTION_LONG_PAYER_HIGH, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayer = METHOD_EXTRAPOLATION.presentValue(SWAPTION_SHORT_PAYER_HIGH, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiver = METHOD_EXTRAPOLATION.presentValue(SWAPTION_LONG_RECEIVER_HIGH, SABR_MULTICURVES); final double priceLongPayerExpected = 189696.404; final double priceLongReceiverExpected = 37678176.857; assertEquals("Swaption cash SABR extrapolation: fixed value", priceLongPayerExpected, priceLongPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: fixed value", priceLongReceiverExpected, priceLongReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption cash SABR extrapolation: long/short parity", priceLongPayer.getAmount(EUR), -priceShortPayer.getAmount(EUR), TOLERANCE_PV); }