//-------------------------------------------------------------------------
        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);
        }
Exemplo 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));
        }
Exemplo n.º 5
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());
 }