Beispiel #1
0
        public virtual 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.FixingCalendar.resolve(REF_DATA)).startDate(date(2016, 2, 24)).endDate(date(2016, 3, 24)).rateCutOffDays(2).build();

            assertEquals(test, expected);
        }
Beispiel #2
0
        public virtual 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.FixingCalendar.resolve(REF_DATA)).startDate(date(2016, 2, 23)).endDate(date(2016, 3, 23)).rateCutOffDays(0).build();

            assertEquals(test, expected);
        }
Beispiel #3
0
        //-------------------------------------------------------------------------
        public virtual void test_collectIndices()
        {
            OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), REF_DATA);

            ImmutableSet.Builder <Index> builder = ImmutableSet.builder();
            test.collectIndices(builder);
            assertEquals(builder.build(), ImmutableSet.of(USD_FED_FUND));
        }
Beispiel #4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), REF_DATA);

            coverImmutableBean(test);
            OvernightAveragedRateComputation test2 = OvernightAveragedRateComputation.of(GBP_SONIA, date(2014, 6, 3), date(2014, 7, 3), 3, REF_DATA);

            coverBeanEquals(test, test2);
        }
Beispiel #5
0
        //-------------------------------------------------------------------------
        public virtual void test_calculate()
        {
            OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), REF_DATA);

            assertEquals(test.calculateEffectiveFromFixing(date(2016, 2, 24)), USD_FED_FUND.calculateEffectiveFromFixing(date(2016, 2, 24), REF_DATA));
            assertEquals(test.calculateFixingFromEffective(date(2016, 2, 24)), USD_FED_FUND.calculateFixingFromEffective(date(2016, 2, 24), REF_DATA));
            assertEquals(test.calculatePublicationFromFixing(date(2016, 2, 24)), USD_FED_FUND.calculatePublicationFromFixing(date(2016, 2, 24), REF_DATA));
            assertEquals(test.calculateMaturityFromFixing(date(2016, 2, 24)), USD_FED_FUND.calculateMaturityFromFixing(date(2016, 2, 24), REF_DATA));
            assertEquals(test.calculateMaturityFromEffective(date(2016, 2, 24)), USD_FED_FUND.calculateMaturityFromEffective(date(2016, 2, 24), REF_DATA));
        }
Beispiel #6
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         OvernightAveragedRateComputation other = (OvernightAveragedRateComputation)obj;
         return(JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(fixingCalendar, other.fixingCalendar) && JodaBeanUtils.equal(startDate, other.startDate) && JodaBeanUtils.equal(endDate, other.endDate) && (rateCutOffDays == other.rateCutOffDays));
     }
     return(false);
 }
Beispiel #7
0
 /// <summary>
 /// Creates an instance from an index, accrual 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 or zero </param>
 /// <param name="refData">  the reference data to use when resolving holiday calendars </param>
 /// <returns> the rate computation </returns>
 public static OvernightAveragedRateComputation of(OvernightIndex index, LocalDate startDate, LocalDate endDate, int rateCutOffDays, ReferenceData refData)
 {
     return(OvernightAveragedRateComputation.builder().index(index).fixingCalendar(index.FixingCalendar.resolve(refData)).startDate(index.calculateFixingFromEffective(startDate, refData)).endDate(index.calculateFixingFromEffective(endDate, refData)).rateCutOffDays(rateCutOffDays).build());
 }
Beispiel #8
0
        public virtual void test_observeOn()
        {
            OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), REF_DATA);

            assertEquals(test.observeOn(date(2016, 2, 24)), OvernightIndexObservation.of(USD_FED_FUND, date(2016, 2, 24), REF_DATA));
        }
Beispiel #9
0
 public virtual void test_of_rateCutoff_negative()
 {
     assertThrowsIllegalArg(() => OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), -1, REF_DATA));
 }
Beispiel #10
0
 public virtual void test_of_badDateOrder()
 {
     assertThrowsIllegalArg(() => OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 2, 24), REF_DATA));
     assertThrowsIllegalArg(() => OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 25), date(2016, 2, 24), REF_DATA));
 }
Beispiel #11
0
        public virtual void test_serialization()
        {
            OvernightAveragedRateComputation test = OvernightAveragedRateComputation.of(USD_FED_FUND, date(2016, 2, 24), date(2016, 3, 24), REF_DATA);

            assertSerialization(test);
        }