SwaptionPhysicalFixedIborSABRExtrapolationRightMethod { public MultipleCurrencyAmount presentValue(final SwaptionPhysicalFixedIbor swaption, final SABRSwaptionProviderInterface sabrData) { ArgumentChecker.notNull(swaption, "Swaption"); ArgumentChecker.notNull(sabrData, "SABR swaption provider"); final DayCount dayCountModification = sabrData.getSABRGenerator().getFixedLegDayCount(); final MulticurveProviderInterface multicurves = sabrData.getMulticurveProvider(); final Currency ccy = swaption.getCurrency(); final double pvbpModified = METHOD_SWAP.presentValueBasisPoint(swaption.getUnderlyingSwap(), dayCountModification, multicurves); final double forwardModified = PRDC.visitFixedCouponSwap(swaption.getUnderlyingSwap(), dayCountModification, multicurves); final double strikeModified = METHOD_SWAP.couponEquivalent(swaption.getUnderlyingSwap(), pvbpModified, multicurves); final double maturity = swaption.getMaturityTime(); final EuropeanVanillaOption option = new EuropeanVanillaOption(strikeModified, swaption.getTimeToExpiry(), swaption.isCall()); if (strikeModified <= _cutOffStrike) { final BlackPriceFunction blackFunction = new BlackPriceFunction(); final double volatility = sabrData.getSABRParameter().getVolatility(swaption.getTimeToExpiry(), maturity, strikeModified, forwardModified); final BlackFunctionData dataBlack = new BlackFunctionData(forwardModified, pvbpModified, volatility); final Function1D<BlackFunctionData, Double> func = blackFunction.getPriceFunction(option); return MultipleCurrencyAmount.of(ccy, func.evaluate(dataBlack) * (swaption.isLong() ? 1.0 : -1.0)); } 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(forwardModified, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu); return MultipleCurrencyAmount.of(ccy, pvbpModified * sabrExtrapolation.price(option) * (swaption.isLong() ? 1.0 : -1.0)); } SwaptionPhysicalFixedIborSABRExtrapolationRightMethod(final double cutOffStrike, final double mu); MultipleCurrencyAmount presentValue(final SwaptionPhysicalFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final SwaptionPhysicalFixedIbor swaption, final SABRSwaptionProviderInterface sabrData); PresentValueSABRSensitivityDataBundle presentValueSABRSensitivity(final SwaptionPhysicalFixedIbor swaption, final SABRSwaptionProviderInterface sabrData);  }
@Test public void presentValueNoExtra() { final MultipleCurrencyAmount priceLongPayer = METHOD_SABR_EXTRAPOLATION.presentValue(SWAPTION_LONG_PAYER, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayer = METHOD_SABR_EXTRAPOLATION.presentValue(SWAPTION_SHORT_PAYER, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiver = METHOD_SABR_EXTRAPOLATION.presentValue(SWAPTION_LONG_RECEIVER, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortReceiver = METHOD_SABR_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 SABR extrapolation: below cut-off strike", priceLongPayerNoExtra.getAmount(EUR), priceLongPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: below cut-off strike", priceShortPayerNoExtra.getAmount(EUR), priceShortPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: below cut-off strike", priceLongReceiverNoExtra.getAmount(EUR), priceLongReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: below cut-off strike", priceShortReceiverNoExtra.getAmount(EUR), priceShortReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: below cut-off strike long/short parity", priceLongPayer.getAmount(EUR), -priceShortPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: below cut-off strike long/short parity", priceLongReceiver.getAmount(EUR), -priceShortReceiver.getAmount(EUR), TOLERANCE_PV); }
@Test public void presentValueLimit() { final double highStrike = 0.0801; final SwapFixedIborDefinition swapPayerHighStrike = SwapFixedIborDefinition.from(SETTLEMENT_DATE, ANNUITY_TENOR, EUR1YEURIBOR6M, NOTIONAL, highStrike, FIXED_IS_PAYER); final SwapFixedIborDefinition swapReceiverHighStrike = SwapFixedIborDefinition.from(SETTLEMENT_DATE, ANNUITY_TENOR, EUR1YEURIBOR6M, NOTIONAL, highStrike, !FIXED_IS_PAYER); final SwaptionPhysicalFixedIborDefinition swaptionDefinitionLongPayerHighStrike = SwaptionPhysicalFixedIborDefinition.from(EXPIRY_DATE, swapPayerHighStrike, true, IS_LONG); final SwaptionPhysicalFixedIborDefinition swaptionDefinitionShortPayerHighStrike = SwaptionPhysicalFixedIborDefinition.from(EXPIRY_DATE, swapPayerHighStrike, true, !IS_LONG); final SwaptionPhysicalFixedIborDefinition swaptionDefinitionLongReceiverHighStrike = SwaptionPhysicalFixedIborDefinition.from(EXPIRY_DATE, swapReceiverHighStrike, false, IS_LONG); final SwaptionPhysicalFixedIbor swaptionLongPayerHighStrike = swaptionDefinitionLongPayerHighStrike.toDerivative(REFERENCE_DATE); final SwaptionPhysicalFixedIbor swaptionShortPayerHighStrike = swaptionDefinitionShortPayerHighStrike.toDerivative(REFERENCE_DATE); final SwaptionPhysicalFixedIbor swaptionLongReceiverHighStrike = swaptionDefinitionLongReceiverHighStrike.toDerivative(REFERENCE_DATE); final MultipleCurrencyAmount priceLongPayer = METHOD_SABR_EXTRAPOLATION.presentValue(swaptionLongPayerHighStrike, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayer = METHOD_SABR_EXTRAPOLATION.presentValue(swaptionShortPayerHighStrike, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiver = METHOD_SABR_EXTRAPOLATION.presentValue(swaptionLongReceiverHighStrike, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongPayerSABR = swaptionLongPayerHighStrike.accept(PVSSXC, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiverSABR = swaptionLongReceiverHighStrike.accept(PVSSXC, SABR_MULTICURVES); assertEquals("Swaption SABR extrapolation: extrapolation limit", priceLongPayerSABR.getAmount(EUR), priceLongPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: extrapolation limit", priceLongReceiverSABR.getAmount(EUR), priceLongReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: long/short parity", priceLongPayer.getAmount(EUR), -priceShortPayer.getAmount(EUR), TOLERANCE_PV); }
@Test public void presentValueExtra() { final MultipleCurrencyAmount priceLongPayer = METHOD_SABR_EXTRAPOLATION.presentValue(SWAPTION_LONG_PAYER_HIGH, SABR_MULTICURVES); final MultipleCurrencyAmount priceShortPayer = METHOD_SABR_EXTRAPOLATION.presentValue(SWAPTION_SHORT_PAYER_HIGH, SABR_MULTICURVES); final MultipleCurrencyAmount priceLongReceiver = METHOD_SABR_EXTRAPOLATION.presentValue(SWAPTION_LONG_RECEIVER_HIGH, SABR_MULTICURVES); final MultipleCurrencyAmount pricePayer = SWAP_PAYER_HIGH.accept(PVDC, MULTICURVES); final double priceLongPayerExpected = 189776.119; final double priceLongReceiverExpected = 37512770.957; assertEquals("Swaption SABR extrapolation: fixed value", priceLongPayerExpected, priceLongPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: fixed value", priceLongReceiverExpected, priceLongReceiver.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: long/short parity", priceLongPayer.getAmount(EUR), -priceShortPayer.getAmount(EUR), TOLERANCE_PV); assertEquals("Swaption SABR extrapolation: payer/receiver/swap parity", pricePayer.getAmount(EUR), priceLongPayer.getAmount(EUR) - priceLongReceiver.getAmount(EUR), TOLERANCE_PV); }