BondTransactionDiscountingMethod { public double parSpreadYield(final BondFixedTransaction bond, final IssuerProviderInterface issuerMulticurves) { final double parSpreadPrice = parSpread(bond, issuerMulticurves); final double yieldAtTrade = METHOD_BOND_SECURITY.yieldFromCleanPrice(bond.getBondStandard(), bond.getTransactionPrice()); final double yieldAtPar = METHOD_BOND_SECURITY.yieldFromCleanPrice(bond.getBondStandard(), bond.getTransactionPrice() + parSpreadPrice); return yieldAtPar - yieldAtTrade; } 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 parSpreadYield() { final ZonedDateTime settleDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, BOND_DESCRIPTION_DEFINITION_FIXED.getSettlementDays(), CALENDAR); final BondFixedTransactionDefinition bondTrDefinition = new BondFixedTransactionDefinition(BOND_DESCRIPTION_DEFINITION_FIXED, QUANTITY_FIXED, settleDate, PRICE_CLEAN_FIXED); final BondFixedTransaction bondTr = bondTrDefinition.toDerivative(REFERENCE_DATE); final double parSpreadYield = METHOD_BOND_TR.parSpreadYield(bondTr, ISSUER_MULTICURVES); final double yield = METHOD_BOND_SEC.yieldFromCleanPrice(bondTr.getBondStandard(), PRICE_CLEAN_FIXED); final BondFixedTransactionDefinition bond0Definition = BondFixedTransactionDefinition.fromYield(BOND_DESCRIPTION_DEFINITION_FIXED, QUANTITY_FIXED, settleDate, yield + parSpreadYield); final BondFixedTransaction bond0 = bond0Definition.toDerivative(REFERENCE_DATE); final MultipleCurrencyAmount pv0 = METHOD_BOND_TR.presentValue(bond0, ISSUER_MULTICURVES); assertEquals("Fixed bond: par spread yield", pv0.getAmount(CUR), 0, TOLERANCE_PV); final Double parSpreadYieldCalculator = bondTr.accept(PSRIDC, ISSUER_MULTICURVES); assertEquals("Fixed bond: par spread yield", parSpreadYieldCalculator, parSpreadYield, TOLERANCE_PRICE); }