CapFloorInflationYearOnYearMonthlyBlackNormalSmileMethod { public MultipleCurrencyAmount presentValue(final CapFloorInflationYearOnYearMonthly cap, final BlackSmileCapInflationYearOnYearProviderInterface black) { final MultipleCurrencyAmount nonDiscountedPresentValue = netAmount(cap, black); final double df = black.getMulticurveProvider().getDiscountFactor(cap.getCurrency(), cap.getPaymentTime()); return nonDiscountedPresentValue.multipliedBy(df); } private  CapFloorInflationYearOnYearMonthlyBlackNormalSmileMethod(); static CapFloorInflationYearOnYearMonthlyBlackNormalSmileMethod getInstance(); MultipleCurrencyAmount netAmount(final CapFloorInflationYearOnYearMonthly cap, final BlackSmileCapInflationYearOnYearProviderInterface black); MultipleCurrencyAmount presentValue(final CapFloorInflationYearOnYearMonthly cap, final BlackSmileCapInflationYearOnYearProviderInterface black); MultipleCurrencyAmount presentValue(final InstrumentDerivative instrument, final BlackSmileCapInflationYearOnYearProviderInterface black); MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final CapFloorInflationYearOnYearMonthly cap, final BlackSmileCapInflationYearOnYearProviderInterface black);  }
@Test public void presentValue() { final MultipleCurrencyAmount pv = METHOD.presentValue(YEAR_ON_YEAR_CAP, BLACK_INFLATION); final double df = MARKET.getCurve(YEAR_ON_YEAR_CAP.getCurrency()).getDiscountFactor(YEAR_ON_YEAR_CAP.getPaymentTime()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(YEAR_ON_YEAR_CAP.getReferenceEndTime()); final double initialIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(YEAR_ON_YEAR_CAP.getReferenceStartTime()); final double forward = finalIndex / initialIndex - 1; final double timeToMaturity = YEAR_ON_YEAR_CAP.getReferenceEndTime() - YEAR_ON_YEAR_CAP.getLastKnownFixingTime(); final EuropeanVanillaOption option = new EuropeanVanillaOption(YEAR_ON_YEAR_CAP.getStrike(), timeToMaturity, YEAR_ON_YEAR_CAP.isCap()); final double volatility = BLACK_INFLATION.getBlackParameters().getVolatility(YEAR_ON_YEAR_CAP.getReferenceEndTime(), YEAR_ON_YEAR_CAP.getStrike()); final NormalFunctionData dataBlack = new NormalFunctionData(forward, 1.0, volatility); final Function1D<NormalFunctionData, Double> func = NORMAL_FUNCTION.getPriceFunction(option); final double pvExpected = df * func.evaluate(dataBlack) * YEAR_ON_YEAR_CAP.getNotional() * YEAR_ON_YEAR_CAP.getPaymentYearFraction(); assertEquals("Year on year coupon inflation DiscountingMethod: Present value", pvExpected, pv.getAmount(YEAR_ON_YEAR_CAP.getCurrency()), TOLERANCE_PV); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD.presentValue(YEAR_ON_YEAR_CAP, BLACK_INFLATION); final MultipleCurrencyAmount pvCalculator = YEAR_ON_YEAR_CAP.accept(PVIC, BLACK_INFLATION); assertEquals("Year on year coupon inflation DiscountingMethod: Present value", pvMethod, pvCalculator); }