BillSecurityDiscountingMethod { public double yieldFromCurves(final BillSecurity bill, final IssuerProviderInterface issuer) { ArgumentChecker.notNull(bill, "Bill"); ArgumentChecker.notNull(issuer, "Issuer and multi-curves provider"); final double pvBill = bill.getNotional() * issuer.getDiscountFactor(bill.getIssuerEntity(), bill.getEndTime()); final double price = pvBill / (bill.getNotional() * issuer.getMulticurveProvider().getDiscountFactor(bill.getCurrency(), bill.getSettlementTime())); return yieldFromCleanPrice(bill, price); } private  BillSecurityDiscountingMethod(); static BillSecurityDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final BillSecurity bill, final IssuerProviderInterface issuer); double priceFromYield(final BillSecurity bill, final double yield); double priceFromYield(final YieldConvention convention, final double yield, final double accrualFactor); double yieldFromCleanPrice(final BillSecurity bill, final double price); double yieldFromPriceDerivative(final BillSecurity bill, final double price); MultipleCurrencyAmount presentValueFromYield(final BillSecurity bill, final double yield, final IssuerProviderInterface issuer); MultipleCurrencyAmount presentValueFromPrice(final BillSecurity bill, final double price, final IssuerProviderInterface issuer); double priceFromCurves(final BillSecurity bill, final IssuerProviderInterface issuer); double yieldFromCurves(final BillSecurity bill, final IssuerProviderInterface issuer); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BillSecurity bill, final IssuerProviderInterface issuer);  }
@Test public void yieldFromCurves() { final double yieldComputed = METHOD_SECURITY.yieldFromCurves(BILL_BEL_IAM_SEC, ISSUER_MULTICURVE); final double priceComputed = METHOD_SECURITY.priceFromCurves(BILL_BEL_IAM_SEC, ISSUER_MULTICURVE); final double yieldExpected = METHOD_SECURITY.yieldFromCleanPrice(BILL_BEL_IAM_SEC, priceComputed); assertEquals("Bill Security: discounting method - yield", yieldExpected, yieldComputed, TOLERANCE_YIELD); }
@Test public void yieldFromCurvesMethodVsCalculator() { final double yieldMethod = METHOD_SECURITY.yieldFromCurves(BILL_BEL_IAM_SEC, ISSUER_MULTICURVE); final double yieldCalculator = BILL_BEL_IAM_SEC.accept(YFCC, ISSUER_MULTICURVE); assertEquals("Bill Security: discounting method - yield", yieldMethod, yieldCalculator, TOLERANCE_YIELD); }