public void test_of() { FixedRateCalculation test = FixedRateCalculation.of(0.025d, ACT_365F); assertEquals(test.getType(), SwapLegType.FIXED); assertEquals(test.getRate(), ValueSchedule.of(0.025d)); assertEquals(test.getDayCount(), ACT_365F); assertEquals(test.getInitialStub(), Optional.empty()); assertEquals(test.getFinalStub(), Optional.empty()); assertEquals(test.getFutureValueNotional(), Optional.empty()); }
public void test_toLeg1() { FixedRateSwapLegConvention base = FixedRateSwapLegConvention.of(GBP, ACT_365F, P3M, BDA_MOD_FOLLOW); LocalDate startDate = LocalDate.of(2015, 5, 5); LocalDate endDate = LocalDate.of(2020, 5, 5); RateCalculationSwapLeg test = base.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d); RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder() .payReceive(PAY) .accrualSchedule(PeriodicSchedule.builder() .frequency(P3M) .startDate(startDate) .endDate(endDate) .businessDayAdjustment(BDA_MOD_FOLLOW) .stubConvention(StubConvention.SMART_INITIAL) .build()) .paymentSchedule(PaymentSchedule.builder() .paymentFrequency(P3M) .paymentDateOffset(DaysAdjustment.NONE) .build()) .notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)) .calculation(FixedRateCalculation.of(0.25d, ACT_365F)) .build(); assertEquals(test, expected); }
.accrualSchedule(accSchedule) .calculation( FixedRateCalculation.of(fixedRate, ACT_360)) .paymentSchedule( PaymentSchedule.builder().paymentFrequency(frequency).paymentDateOffset(DaysAdjustment.NONE).build())
.build()) .notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL)) .calculation(FixedRateCalculation.of(RATE, ACT_360)) .build()) .build();