BondCapitalIndexedTransactionDiscountingMethod { public MultipleCurrencyAmount presentValue(final BondCapitalIndexedTransaction<?> bond, final InflationIssuerProviderInterface provider) { double notional = bond.getNotionalStandard(); final MultipleCurrencyAmount pvBond = METHOD_SECURITY.presentValue(bond.getBondTransaction(), provider); final MultipleCurrencyAmount pvSettlement = bond.getBondTransaction().getSettlement(). accept(PVIC, provider.getInflationProvider()).multipliedBy(-bond.getQuantity() * (bond.getTransactionPrice() + bond.getBondStandard().getAccruedInterest() / notional)); return pvBond.multipliedBy(bond.getQuantity()).plus(pvSettlement); }  static BondCapitalIndexedTransactionDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final BondCapitalIndexedTransaction<?> bond, final InflationIssuerProviderInterface provider); MultipleCurrencyAmount presentValueFromCleanPriceReal(final BondCapitalIndexedTransaction<Coupon> bond, final InflationIssuerProviderInterface provider, final double cleanPriceReal); MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final BondCapitalIndexedTransaction<?> bond, 
      final ParameterInflationIssuerProviderInterface provider);  }
@Test public void presentValueTips1() { final MultipleCurrencyAmount pv = METHOD_BOND_TRANSACTION.presentValue(BOND_TIPS_1_TRANSACTION, MARKET); final MultipleCurrencyAmount pvSecurity = METHOD_BOND_SECURITY.presentValue(BOND_SECURITY_TIPS_1, MARKET); final MultipleCurrencyAmount pvSettlement = BOND_TIPS_1_TRANSACTION.getBondTransaction().getSettlement(). accept(PVDIC, MARKET.getInflationProvider()).multipliedBy(- BOND_TIPS_1_TRANSACTION.getQuantity() * (PRICE_TIPS_1 + BOND_TIPS_1_TRANSACTION.getBondTransaction().getAccruedInterest() / BOND_TIPS_1_TRANSACTION.getNotionalStandard())); assertEquals("Inflation Capital Indexed bond transaction: present value", pvSecurity.multipliedBy(QUANTITY_TIPS_1).plus(pvSettlement).getAmount(BOND_SECURITY_TIPS_1.getCurrency()), pv.getAmount(BOND_SECURITY_TIPS_1.getCurrency()), 1.0E-2); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD_BOND_TRANSACTION.presentValue(BOND_TIPS_1_TRANSACTION, MARKET); final MultipleCurrencyAmount pvCalculator = BOND_TIPS_1_TRANSACTION.accept(PVDIIC, MARKET); assertEquals("Inflation Capital Indexed bond transaction: Method vs Calculator", pvMethod, pvCalculator); }