"Swap leg must not define both '" + leg + FINAL_STUB_RATE_FIELD + "' and '" + leg + FINAL_STUB_AMOUNT_FIELD + "'"); finalStubRateOpt.ifPresent(v -> builder.finalStub( FixedRateStubCalculation.ofFixedRate(v))); finalStubAmountOpt.ifPresent(v -> builder.finalStub( FixedRateStubCalculation.ofKnownAmount(CurrencyAmount.of(currency, v)))); return builder.build();
}); stubsEl.findChild("finalStub").ifPresent(el -> { fixedRateBuilder.finalStub(parseStubCalculationForFixed(el, document)); }); });
public void test_builder() { FixedRateCalculation test = FixedRateCalculation.builder() .dayCount(ACT_365F) .rate(ValueSchedule.of(0.025d)) .initialStub(FixedRateStubCalculation.ofFixedRate(0.1d)) .finalStub(FixedRateStubCalculation.ofFixedRate(0.2d)) .futureValueNotional(FutureValueNotional.autoCalculate()) .build(); assertEquals(test.getRate(), ValueSchedule.of(0.025d)); assertEquals(test.getDayCount(), ACT_365F); assertEquals(test.getInitialStub(), Optional.of(FixedRateStubCalculation.ofFixedRate(0.1d))); assertEquals(test.getFinalStub(), Optional.of(FixedRateStubCalculation.ofFixedRate(0.2d))); assertEquals(test.getFutureValueNotional(), Optional.of(FutureValueNotional.autoCalculate())); }
.rate(ValueSchedule.of(0.025d)) .initialStub(FixedRateStubCalculation.ofKnownAmount(knownAmount)) .finalStub(FixedRateStubCalculation.ofFixedRate(0.1d)) .build()) .build();