BillSecurityDiscountingMethod { public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BillSecurity bill, final IssuerProviderInterface issuer) { ArgumentChecker.notNull(bill, "Bill"); ArgumentChecker.notNull(issuer, "Issuer and multi-curves provider"); final double dfEnd = issuer.getDiscountFactor(bill.getIssuerEntity(), bill.getEndTime()); final double pvBar = 1.0; final double dfEndBar = bill.getNotional() * pvBar; final Map<String, List<DoublesPair>> resultMapCredit = new HashMap<>(); final List<DoublesPair> listDiscounting = new ArrayList<>(); listDiscounting.add(DoublesPair.of(bill.getEndTime(), -bill.getEndTime() * dfEnd * dfEndBar)); resultMapCredit.put(issuer.getName(bill.getIssuerEntity()), listDiscounting); final MulticurveSensitivity result = MulticurveSensitivity.ofYieldDiscounting(resultMapCredit); return MultipleCurrencyMulticurveSensitivity.of(bill.getCurrency(), result); } 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 presentValueCurveSensitivity() { final MultipleCurrencyParameterSensitivity pvpsDepositExact = PS_PVI_C.calculateSensitivity(BILL_BEL_IAM_SEC, ISSUER_MULTICURVE, ISSUER_MULTICURVE.getAllNames()); final MultipleCurrencyParameterSensitivity pvpsDepositFD = PS_PVI_FDC.calculateSensitivity(BILL_BEL_IAM_SEC, ISSUER_MULTICURVE); AssertSensitivityObjects.assertEquals("DepositCounterpartDiscountingMethod: presentValueCurveSensitivity ", pvpsDepositExact, pvpsDepositFD, TOLERANCE_PV_DELTA); }
@Test public void presentValueCurveSensitivityMethodVsCalculator() { final MultipleCurrencyMulticurveSensitivity pvcsMethod = METHOD_SECURITY.presentValueCurveSensitivity(BILL_BEL_IAM_SEC, ISSUER_MULTICURVE); final MultipleCurrencyMulticurveSensitivity pvcsCalculator = BILL_BEL_IAM_SEC.accept(PVCSIC, ISSUER_MULTICURVE); AssertSensitivityObjects.assertEquals("Bill Security: discounting method - curve sensitivity", pvcsMethod, pvcsCalculator, TOLERANCE_PV); }