public void test_of_rateCutoff_2() { OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), 2, REF_DATA); OvernightAveragedRateComputation expected = OvernightAveragedRateComputation.builder() .index(USD_FED_FUND) .fixingCalendar(USD_FED_FUND.getFixingCalendar().resolve(REF_DATA)) .startDate(date(2016, 2, 24)) .endDate(date(2016, 3, 24)) .rateCutOffDays(2) .build(); assertEquals(test, expected); }
/** * Creates an instance from an index, accrual period dates and rate cut-off. * <p> * Rate cut-off applies if the cut-off is 2 or greater. * A value of 0 or 1 should be used if no cut-off applies. * * @param index the index * @param startDate the first date of the accrual period * @param endDate the last date of the accrual period * @param rateCutOffDays the rate cut-off days offset, not negative or zero * @param refData the reference data to use when resolving holiday calendars * @return the rate computation */ public static OvernightAveragedRateComputation of( OvernightIndex index, LocalDate startDate, LocalDate endDate, int rateCutOffDays, ReferenceData refData) { return OvernightAveragedRateComputation.builder() .index(index) .fixingCalendar(index.getFixingCalendar().resolve(refData)) .startDate(index.calculateFixingFromEffective(startDate, refData)) .endDate(index.calculateFixingFromEffective(endDate, refData)) .rateCutOffDays(rateCutOffDays) .build(); }
@Override public OvernightAveragedRateComputation.Builder builder() { return new OvernightAveragedRateComputation.Builder(); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static OvernightAveragedRateComputation.Builder builder() { return new OvernightAveragedRateComputation.Builder(); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }
public void test_of_noRateCutoff_tomNext() { OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(CHF_TOIS, date(2016, 2, 24), date(2016, 3, 24), REF_DATA); OvernightAveragedRateComputation expected = OvernightAveragedRateComputation.builder() .index(CHF_TOIS) .fixingCalendar(CHF_TOIS.getFixingCalendar().resolve(REF_DATA)) .startDate(date(2016, 2, 23)) .endDate(date(2016, 3, 23)) .rateCutOffDays(0) .build(); assertEquals(test, expected); }
public void test_of_noRateCutoff() { OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), REF_DATA); OvernightAveragedRateComputation expected = OvernightAveragedRateComputation.builder() .index(USD_FED_FUND) .fixingCalendar(USD_FED_FUND.getFixingCalendar().resolve(REF_DATA)) .startDate(date(2016, 2, 24)) .endDate(date(2016, 3, 24)) .rateCutOffDays(0) .build(); assertEquals(test, expected); }
public void test_of_rateCutoff_0() { OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), 0, REF_DATA); OvernightAveragedRateComputation expected = OvernightAveragedRateComputation.builder() .index(USD_FED_FUND) .fixingCalendar(USD_FED_FUND.getFixingCalendar().resolve(REF_DATA)) .startDate(date(2016, 2, 24)) .endDate(date(2016, 3, 24)) .rateCutOffDays(0) .build(); assertEquals(test, expected); }