CouponInflationYearOnYearMonthlyDiscountingMethod { public MultipleCurrencyAmount netAmount(final CouponInflationYearOnYearMonthly coupon, final InflationProviderInterface inflation) { ArgumentChecker.notNull(coupon, "Coupon"); ArgumentChecker.notNull(inflation, "Inflation"); final double estimatedIndexStart = indexEstimationStart(coupon, inflation); final double estimatedIndexEnd = indexEstimationEnd(coupon, inflation); final double na = (estimatedIndexEnd / estimatedIndexStart - (coupon.payNotional() ? 0.0 : 1.0)) * coupon.getNotional(); return MultipleCurrencyAmount.of(coupon.getCurrency(), na); }  MultipleCurrencyAmount netAmount(final CouponInflationYearOnYearMonthly coupon, final InflationProviderInterface inflation); MultipleCurrencyAmount presentValue(final CouponInflationYearOnYearMonthly coupon, final InflationProviderInterface inflation); double indexEstimationStart(final CouponInflationYearOnYearMonthly coupon, final InflationProviderInterface inflation); double indexEstimationEnd(final CouponInflationYearOnYearMonthly coupon, final InflationProviderInterface inflation); MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final CouponInflationYearOnYearMonthly coupon, final InflationProviderInterface inflation);  }
@Test public void netAmountNoNotional() { final MultipleCurrencyAmount pv = METHOD.netAmount(YEAR_ON_YEAR_NO, MARKET.getInflationProvider()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(YEAR_ON_YEAR_NO.getReferenceEndTime()); final double initialIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(YEAR_ON_YEAR_NO.getReferenceStartTime()); final double pvExpected = (finalIndex / initialIndex - 1) * NOTIONAL; assertEquals("Year on year coupon inflation DiscountingMethod: net amount", pvExpected, pv.getAmount(YEAR_ON_YEAR_NO.getCurrency()), TOLERANCE_PV); }
@Test public void netAmountWithNotional() { final MultipleCurrencyAmount pv = METHOD.netAmount(YEAR_ON_YEAR_WITH, MARKET.getInflationProvider()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(YEAR_ON_YEAR_WITH.getReferenceEndTime()); final double initialIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(YEAR_ON_YEAR_NO.getReferenceStartTime()); final double pvExpected = (finalIndex / initialIndex) * NOTIONAL; assertEquals("Year on year coupon inflation DiscountingMethod: net amount", pvExpected, pv.getAmount(YEAR_ON_YEAR_WITH.getCurrency()), TOLERANCE_PV); }
@Test public void netAmountMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD.netAmount(YEAR_ON_YEAR_NO, MARKET.getInflationProvider()); final MultipleCurrencyAmount pvCalculator = YEAR_ON_YEAR_NO.accept(NAIC, MARKET.getInflationProvider()); assertEquals("Year on year coupon inflation DiscountingMethod: Net amount", pvMethod, pvCalculator); }