public virtual void test_of_noRateCutoff_tomNext() { OvernightCompoundedRateComputation test = OvernightCompoundedRateComputation.of(CHF_TOIS, date(2016, 2, 24), date(2016, 3, 24), 0, REF_DATA); OvernightCompoundedRateComputation expected = OvernightCompoundedRateComputation.builder().index(CHF_TOIS).fixingCalendar(CHF_TOIS.FixingCalendar.resolve(REF_DATA)).startDate(date(2016, 2, 23)).endDate(date(2016, 3, 23)).rateCutOffDays(0).build(); assertEquals(test, expected); }
public virtual void test_of_rateCutoff_2() { OvernightCompoundedRateComputation test = OvernightCompoundedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), 2, REF_DATA); OvernightCompoundedRateComputation expected = OvernightCompoundedRateComputation.builder().index(USD_FED_FUND).fixingCalendar(USD_FED_FUND.FixingCalendar.resolve(REF_DATA)).startDate(date(2016, 2, 24)).endDate(date(2016, 3, 24)).rateCutOffDays(2).build(); assertEquals(test, expected); }
/// <summary> /// Creates an instance from an index, period dates and rate cut-off. /// <para> /// 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. /// /// </para> /// </summary> /// <param name="index"> the index </param> /// <param name="startDate"> the first date of the accrual period </param> /// <param name="endDate"> the last date of the accrual period </param> /// <param name="rateCutOffDays"> the rate cut-off days offset, not negative </param> /// <param name="refData"> the reference data to use when resolving holiday calendars </param> /// <returns> the rate computation </returns> public static OvernightCompoundedRateComputation of(OvernightIndex index, LocalDate startDate, LocalDate endDate, int rateCutOffDays, ReferenceData refData) { return(OvernightCompoundedRateComputation.builder().index(index).fixingCalendar(index.FixingCalendar.resolve(refData)).startDate(index.calculateFixingFromEffective(startDate, refData)).endDate(index.calculateFixingFromEffective(endDate, refData)).rateCutOffDays(rateCutOffDays).build()); }