private static PaymentSchedule parsePaymentSchedule(CsvRow row, String leg, Frequency accrualFrequency) { PaymentSchedule.Builder builder = PaymentSchedule.builder(); // basics builder.paymentFrequency(findValue(row, leg, PAYMENT_FREQUENCY_FIELD) .map(s -> Frequency.parse(s)) .orElse(accrualFrequency)); Optional<DaysAdjustment> offsetOpt = parseDaysAdjustment( row, leg, PAYMENT_OFFSET_DAYS_FIELD, PAYMENT_OFFSET_CAL_FIELD, PAYMENT_OFFSET_ADJ_CNV_FIELD, PAYMENT_OFFSET_ADJ_CAL_FIELD); builder.paymentDateOffset(offsetOpt.orElse(DaysAdjustment.NONE)); // optionals findValue(row, leg, PAYMENT_RELATIVE_TO_FIELD) .map(s -> PaymentRelativeTo.of(s)) .ifPresent(v -> builder.paymentRelativeTo(v)); findValue(row, leg, COMPOUNDING_METHOD_FIELD) .map(s -> CompoundingMethod.of(s)) .ifPresent(v -> builder.compoundingMethod(v)); findValue(row, leg, PAYMENT_FIRST_REGULAR_START_DATE_FIELD) .map(s -> LoaderUtils.parseDate(s)) .ifPresent(v -> builder.firstRegularStartDate(v)); findValue(row, leg, PAYMENT_LAST_REGULAR_END_DATE_FIELD) .map(s -> LoaderUtils.parseDate(s)) .ifPresent(v -> builder.lastRegularEndDate(v)); return builder.build(); }
paymentScheduleBuilder.compoundingMethod(CompoundingMethod.of(compoundingEl.getContent())); }); return paymentScheduleBuilder.build();
.paymentFrequency(Frequency.ofYears(5)) .paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)) .compoundingMethod(STRAIGHT) .build(); FixedRateCalculation rateCalc = FixedRateCalculation.builder()
.paymentFrequency(Frequency.ofYears(5)) .paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)) .compoundingMethod(STRAIGHT) .build(); FixedRateCalculation rateCalc = FixedRateCalculation.builder()
.paymentFrequency(P2M) .paymentDateOffset(PLUS_TWO_DAYS) .compoundingMethod(STRAIGHT) .build()) .notionalSchedule(NotionalSchedule.builder()
.paymentFrequency(Frequency.P6M) .paymentDateOffset(DaysAdjustment.ofBusinessDays(5, SAT_SUN)) .compoundingMethod(CompoundingMethod.FLAT) .build()) .notionalSchedule(notional)
.paymentFrequency(Frequency.P12M) .paymentDateOffset(DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, EUTA))) .compoundingMethod(CompoundingMethod.NONE) .firstRegularStartDate(date(2004, 11, 20)) .build())
.paymentFrequency(P3M) .paymentDateOffset(PLUS_TWO_DAYS) .compoundingMethod(STRAIGHT) .build()) .notionalSchedule(NotionalSchedule.of(GBP, 1000d))
.paymentFrequency(Frequency.P6M) .paymentDateOffset(DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO_USNY))) .compoundingMethod(CompoundingMethod.STRAIGHT) .build()) .notionalSchedule(notional)
.paymentFrequency(getPaymentFrequency()) .paymentDateOffset(getPaymentDateOffset()) .compoundingMethod(getCompoundingMethod()) .build()) .notionalSchedule(NotionalSchedule.builder()
.paymentFrequency(Frequency.TERM) .paymentDateOffset(DaysAdjustment.ofCalendarDays(0, BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO))) .compoundingMethod(CompoundingMethod.FLAT) .build()) .notionalSchedule(notional)
.paymentFrequency(Frequency.P6M) .paymentDateOffset(DaysAdjustment.ofBusinessDays(5, GBLO_USNY)) .compoundingMethod(CompoundingMethod.FLAT) .build()) .notionalSchedule(notional)
.paymentFrequency(TERM) .paymentDateOffset(DaysAdjustment.NONE) .compoundingMethod(CompoundingMethod.STRAIGHT) .build()) .notionalSchedule(NOTIONAL) .paymentFrequency(TERM) .paymentDateOffset(DaysAdjustment.NONE) .compoundingMethod(CompoundingMethod.STRAIGHT) .build()) .notionalSchedule(NOTIONAL)
.paymentFrequency(Frequency.P3M) .paymentDateOffset(DaysAdjustment.NONE) .compoundingMethod(CompoundingMethod.FLAT) .build()) .notionalSchedule(NOTIONAL)
.paymentFrequency(getPaymentFrequency()) .paymentDateOffset(getPaymentDateOffset()) .compoundingMethod(getCompoundingMethod()) .build()) .notionalSchedule(NotionalSchedule.of(currency, notional))
.paymentFrequency(getPaymentFrequency()) .paymentDateOffset(getPaymentDateOffset()) .compoundingMethod(getCompoundingMethod()) .build()) .notionalSchedule(NotionalSchedule.of(getCurrency(), notional))
.paymentFrequency(Frequency.ofYears(5)) .paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)) .compoundingMethod(CompoundingMethod.STRAIGHT) .build()) .notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL))
public void coverage() { PaymentSchedule test = PaymentSchedule.builder() .paymentFrequency(P1M) .paymentDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)) .build(); coverImmutableBean(test); PaymentSchedule test2 = PaymentSchedule.builder() .paymentFrequency(P3M) .businessDayAdjustment(BDA) .paymentDateOffset(DaysAdjustment.ofBusinessDays(3, GBLO)) .paymentRelativeTo(PERIOD_START) .compoundingMethod(STRAIGHT) .firstRegularStartDate(DATE_01_06) .lastRegularEndDate(DATE_02_05) .build(); coverBeanEquals(test, test2); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.paymentRelativeTo(PaymentRelativeTo.PERIOD_END); builder.compoundingMethod(CompoundingMethod.NONE); }