Beispiel #1
0
        public virtual void test_of_LocalDateAndTime()
        {
            HullWhiteOneFactorPiecewiseConstantParametersProvider test = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(PARAMETERS, ACT_360, VAL_DATE, TIME, ZONE);

            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.Parameters, PARAMETERS);
            assertEquals(test.ValuationDateTime, VAL_DATE.atTime(TIME).atZone(ZONE));
        }
Beispiel #2
0
        public virtual void test_of_ZonedDateTime()
        {
            HullWhiteOneFactorPiecewiseConstantParametersProvider test = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(PARAMETERS, ACT_360, DATE_TIME);

            assertEquals(test.DayCount, ACT_360);
            assertEquals(test.Parameters, PARAMETERS);
            assertEquals(test.ValuationDateTime, DATE_TIME);
        }
Beispiel #3
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            HullWhiteOneFactorPiecewiseConstantParametersProvider test1 = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(PARAMETERS, ACT_360, DATE_TIME);

            coverImmutableBean(test1);
            HullWhiteOneFactorPiecewiseConstantParameters         @params = HullWhiteOneFactorPiecewiseConstantParameters.of(0.02, DoubleArray.of(0.01, 0.011, 0.014), DoubleArray.of(0.5, 5.0));
            HullWhiteOneFactorPiecewiseConstantParametersProvider test2   = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(@params, ACT_ACT_ISDA, DATE_TIME.plusDays(1));

            coverBeanEquals(test1, test2);
        }
Beispiel #4
0
        public virtual void test_futuresConvexityFactorAdjoint()
        {
            HullWhiteOneFactorPiecewiseConstantParametersProvider provider = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(PARAMETERS, ACT_360, DATE_TIME);
            LocalDate        data1    = LocalDate.of(2015, 5, 14);
            LocalDate        data2    = LocalDate.of(2015, 5, 20);
            LocalDate        data3    = LocalDate.of(2015, 8, 20);
            ValueDerivatives computed = provider.futuresConvexityFactorAdjoint(data1, data2, data3);
            ValueDerivatives expected = HullWhiteOneFactorPiecewiseConstantInterestRateModel.DEFAULT.futuresConvexityFactorAdjoint(PARAMETERS, ACT_360.relativeYearFraction(VAL_DATE, data1), ACT_360.relativeYearFraction(VAL_DATE, data2), ACT_360.relativeYearFraction(VAL_DATE, data3));

            assertEquals(computed, expected);
        }
Beispiel #5
0
        public virtual void test_alpha()
        {
            HullWhiteOneFactorPiecewiseConstantParametersProvider provider = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(PARAMETERS, ACT_360, DATE_TIME);
            LocalDate data1    = LocalDate.of(2015, 5, 20);
            LocalDate data2    = LocalDate.of(2015, 8, 20);
            LocalDate data3    = LocalDate.of(2015, 8, 20);
            LocalDate data4    = LocalDate.of(2015, 8, 27);
            double    computed = provider.alpha(data1, data2, data3, data4);
            double    expected = HullWhiteOneFactorPiecewiseConstantInterestRateModel.DEFAULT.alpha(PARAMETERS, ACT_360.relativeYearFraction(VAL_DATE, data1), ACT_360.relativeYearFraction(VAL_DATE, data2), ACT_360.relativeYearFraction(VAL_DATE, data3), ACT_360.relativeYearFraction(VAL_DATE, data4));

            assertEquals(computed, expected);
        }
Beispiel #6
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
       return true;
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
       HullWhiteOneFactorPiecewiseConstantParametersProvider other = (HullWhiteOneFactorPiecewiseConstantParametersProvider) obj;
       return JodaBeanUtils.equal(parameters, other.parameters) && JodaBeanUtils.equal(dayCount, other.dayCount) && JodaBeanUtils.equal(valuationDateTime, other.valuationDateTime);
     }
     return false;
 }
Beispiel #7
0
        public virtual void test_serialization()
        {
            HullWhiteOneFactorPiecewiseConstantParametersProvider test = HullWhiteOneFactorPiecewiseConstantParametersProvider.of(PARAMETERS, ACT_360, DATE_TIME);

            assertSerialization(test);
        }