//-------------------------------------------------------------------------
        public virtual void test_ofDaysInResetPeriod()
        {
            IborAveragedFixing test     = IborAveragedFixing.ofDaysInResetPeriod(GBP_LIBOR_3M_OBS, date(2014, 7, 2), date(2014, 8, 2));
            IborAveragedFixing expected = IborAveragedFixing.builder().observation(GBP_LIBOR_3M_OBS).fixedRate(null).weight(31).build();

            assertEquals(test, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_of_date()
        {
            IborAveragedFixing test     = IborAveragedFixing.of(GBP_LIBOR_3M_OBS);
            IborAveragedFixing expected = IborAveragedFixing.builder().observation(GBP_LIBOR_3M_OBS).fixedRate(null).weight(1).build();

            assertEquals(test, expected);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a {@code IborAveragedFixing} from the fixing date, calculating the weight
 /// from the number of days in the reset period.
 /// <para>
 /// This implements the standard approach to average weights, which is to set each
 /// weight to the actual number of days between the start and end of the reset period.
 ///
 /// </para>
 /// </summary>
 /// <param name="observation">  the Ibor observation </param>
 /// <param name="startDate">  the start date of the reset period </param>
 /// <param name="endDate">  the end date of the reset period </param>
 /// <param name="fixedRate">  the fixed rate for the fixing date, optional, may be null </param>
 /// <returns> the weighted fixing information </returns>
 public static IborAveragedFixing ofDaysInResetPeriod(IborIndexObservation observation, LocalDate startDate, LocalDate endDate, double?fixedRate)
 {
     ArgChecker.notNull(observation, "observation");
     ArgChecker.notNull(startDate, "startDate");
     ArgChecker.notNull(endDate, "endDate");
     return(IborAveragedFixing.builder().observation(observation).fixedRate(fixedRate).weight(endDate.toEpochDay() - startDate.toEpochDay()).build());
 }
        public virtual void test_ofDaysInResetPeriod_fixedRate()
        {
            IborAveragedFixing test     = IborAveragedFixing.ofDaysInResetPeriod(GBP_LIBOR_3M_OBS, date(2014, 7, 2), date(2014, 9, 2), 0.06);
            IborAveragedFixing expected = IborAveragedFixing.builder().observation(GBP_LIBOR_3M_OBS).fixedRate(0.06).weight(62).build();

            assertEquals(test, expected);
            assertEquals(test.FixedRate, double?.of(0.06));
        }
 public virtual void test_ofDaysInResetPeriod_null()
 {
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(null, date(2014, 7, 2), date(2014, 8, 2)));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(GBP_LIBOR_3M_OBS, null, date(2014, 8, 2)));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(GBP_LIBOR_3M_OBS, date(2014, 7, 2), null));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(null, null, null));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(null, date(2014, 7, 2), date(2014, 8, 2), 0.05));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(GBP_LIBOR_3M_OBS, null, date(2014, 8, 2), 0.05));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(GBP_LIBOR_3M_OBS, date(2014, 7, 2), null, 0.05));
     assertThrowsIllegalArg(() => IborAveragedFixing.ofDaysInResetPeriod(null, null, null, null));
 }
Ejemplo n.º 6
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         IborAveragedFixing other = (IborAveragedFixing)obj;
         return(JodaBeanUtils.equal(observation, other.observation) && JodaBeanUtils.equal(fixedRate, other.fixedRate) && JodaBeanUtils.equal(weight, other.weight));
     }
     return(false);
 }
 public virtual void test_of_date_null()
 {
     assertThrowsIllegalArg(() => IborAveragedFixing.of(null));
     assertThrowsIllegalArg(() => IborAveragedFixing.of(null, 0.05));
     assertThrowsIllegalArg(() => IborAveragedFixing.of(null, null));
 }
        public virtual void test_serialization()
        {
            IborAveragedFixing test = IborAveragedFixing.of(GBP_LIBOR_3M_OBS);

            assertSerialization(test);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            IborAveragedFixing test = IborAveragedFixing.of(GBP_LIBOR_3M_OBS);

            coverImmutableBean(test);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a {@code IborAveragedFixing} from the fixing date with a weight of 1.
 /// </summary>
 /// <param name="observation">  the Ibor observation </param>
 /// <param name="fixedRate">  the fixed rate for the fixing date, optional, may be null </param>
 /// <returns> the unweighted fixing information </returns>
 public static IborAveragedFixing of(IborIndexObservation observation, double?fixedRate)
 {
     return(IborAveragedFixing.builder().observation(observation).fixedRate(fixedRate).build());
 }