DepositCounterpartDiscountingMethod { public double parSpread(final DepositCounterpart deposit, final IssuerProviderInterface multicurves) { ArgumentChecker.notNull(deposit, "Deposit"); ArgumentChecker.notNull(multicurves, "Multicurves"); ArgumentChecker.isTrue(deposit.getNotional() != 0.0, "Notional is 0"); final double dfStart = multicurves.getDiscountFactor(deposit.getCounterparty(), deposit.getStartTime()); final double dfEnd = multicurves.getDiscountFactor(deposit.getCounterparty(), deposit.getEndTime()); return (deposit.getInitialAmount() * dfStart - (deposit.getNotional() + deposit.getInterestAmount()) * dfEnd) / (deposit.getNotional() * deposit.getAccrualFactor() * dfEnd); } private  DepositCounterpartDiscountingMethod(); static DepositCounterpartDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final DepositCounterpart deposit, final IssuerProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final DepositCounterpart deposit, final IssuerProviderInterface multicurves); double parSpread(final DepositCounterpart deposit, final IssuerProviderInterface multicurves); MulticurveSensitivity parSpreadCurveSensitivity(final DepositCounterpart deposit, final IssuerProviderInterface multicurves);  }
@Test public void parSpreadMethodVsCalculator() { final ZonedDateTime referenceDate = TRADE_DATE; final DepositCounterpart deposit = DEPOSIT_CPTY_DEFINITION.toDerivative(referenceDate); final double parSpreadMethod = METHOD_DEPOSIT.parSpread(deposit, PROVIDER_ISSUER); final double parSpreadCalculator = deposit.accept(PSMQIDC, PROVIDER_ISSUER); assertEquals("DepositDefinition: present value", parSpreadMethod, parSpreadCalculator, TOLERANCE_SPREAD); }