BondTransactionDiscountingMethod { public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BondFixedTransaction bond, final IssuerProviderInterface issuerMulticurves) { ArgumentChecker.notNull(bond, "Bond"); final Currency ccy = bond.getBondTransaction().getCurrency(); final MulticurveProviderInterface multicurvesDecorated = new MulticurveProviderDiscountingDecoratedIssuer( issuerMulticurves, ccy, bond.getBondTransaction().getIssuerEntity()); final MultipleCurrencyMulticurveSensitivity pvcsNominal = bond.getBondTransaction().getNominal().accept(PVCSDC, multicurvesDecorated); final MultipleCurrencyMulticurveSensitivity pvcsCoupon = bond.getBondTransaction().getCoupon().accept(PVCSDC, multicurvesDecorated); final double settlementAmount = -(bond.getTransactionPrice() * bond.getBondTransaction().getCoupon().getNthPayment(0).getNotional() + bond.getBondTransaction().getAccruedInterest()) * bond.getQuantity(); final PaymentFixed settlement = new PaymentFixed(bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount); final MultipleCurrencyMulticurveSensitivity pvcsSettlement = settlement.accept(PVCSDC, issuerMulticurves.getMulticurveProvider()); return pvcsNominal.plus(pvcsCoupon).multipliedBy(bond.getQuantity()).plus(pvcsSettlement); } private  BondTransactionDiscountingMethod(); static BondTransactionDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final BondFixedTransaction bond, 
      final IssuerProviderInterface issuerMulticurves); MultipleCurrencyAmount presentValue(final BondIborTransaction bond, 
      final IssuerProviderInterface issuerMulticurves); MultipleCurrencyAmount presentValueFromCleanPrice(
      final BondTransaction<? extends BondSecurity<? extends Payment, ? extends Coupon>> bond, 
          final IssuerProviderInterface issuerMulticurves, final double cleanPrice); MultipleCurrencyAmount presentValueFromYield(
      final BondTransaction<? extends BondSecurity<? extends Payment, ? extends Coupon>> bond, 
          final IssuerProviderInterface issuerMulticurves, final double yield); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BondFixedTransaction bond, 
      final IssuerProviderInterface issuerMulticurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BondIborTransaction bond, 
      final IssuerProviderInterface issuerMulticurves); double parSpread(final BondFixedTransaction bond, final IssuerProviderInterface issuerMulticurves); double parSpread(final BondIborTransaction bond, final IssuerProviderInterface issuerMulticurves); double parSpreadYield(final BondFixedTransaction bond, final IssuerProviderInterface issuerMulticurves); MulticurveSensitivity parSpreadCurveSensitivity(final BondFixedTransaction bond, final IssuerProviderInterface issuerMulticurves); MulticurveSensitivity parSpreadCurveSensitivity(final BondIborTransaction bond, 
      final IssuerProviderInterface issuerMulticurves); MulticurveSensitivity parSpreadYieldCurveSensitivity(final BondFixedTransaction bond, 
      final IssuerProviderInterface issuerMulticurves);  }
@Test public void testPVCSFixedBond() { final MultipleCurrencyMulticurveSensitivity pvs = METHOD_BOND_TR.presentValueCurveSensitivity(BOND_TRANSACTION_FIXED_3, ISSUER_MULTICURVES); final MulticurveProviderInterface multicurvesDecorated = new MulticurveProviderDiscountingDecoratedIssuer(ISSUER_MULTICURVES, CUR, BOND_TRANSACTION_FIXED_1.getBondTransaction().getIssuerEntity()); final MultipleCurrencyMulticurveSensitivity pvsNominal = NOMINAL_TR_FIXED_3.accept(PVCSDC, multicurvesDecorated); final MultipleCurrencyMulticurveSensitivity pvsCoupon = COUPON_TR_FIXED_3.accept(PVCSDC, multicurvesDecorated); final MultipleCurrencyMulticurveSensitivity pvsSettlement = BOND_SETTLEMENT_FIXED_3.accept(PVCSDC, ISSUER_MULTICURVES.getMulticurveProvider()); final MultipleCurrencyMulticurveSensitivity expectedPvs = pvsNominal.plus(pvsCoupon).multipliedBy(QUANTITY_FRN).plus(pvsSettlement).cleaned(); assertEquals("Fixed bond present value sensitivity", expectedPvs, pvs.cleaned()); }
@Test(enabled = false) public void testPVSIborBond() { final MultipleCurrencyMulticurveSensitivity pvs = METHOD_BOND_TR.presentValueCurveSensitivity(BOND_TRANSACTION_FRN, ISSUER_MULTICURVES); final MultipleCurrencyMulticurveSensitivity pvsNominal = NOMINAL_TR_1_FRN.accept(PVCSIC, ISSUER_MULTICURVES); final MultipleCurrencyMulticurveSensitivity pvsCoupon = COUPON_TR_1_FRN.accept(PVCSIC, ISSUER_MULTICURVES); final MultipleCurrencyMulticurveSensitivity pvsSettlement = BOND_SETTLEMENT_FRN.accept(PVCSIC, ISSUER_MULTICURVES); final MultipleCurrencyMulticurveSensitivity expectedPvs = pvsNominal.plus(pvsCoupon).multipliedBy(QUANTITY_FRN).plus(pvsSettlement).cleaned(); assertEquals("FRN present value sensitivity", expectedPvs, pvs.cleaned()); }