Beispiel #1
0
        public virtual void test_ratePointSensitivity_afterValuation()
        {
            SimpleIborIndexRates test     = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);
            IborRateSensitivity  expected = IborRateSensitivity.of(GBP_LIBOR_3M_AFTER, 1d);

            assertEquals(test.ratePointSensitivity(GBP_LIBOR_3M_AFTER), expected);
        }
Beispiel #2
0
        //-------------------------------------------------------------------------
        // proper end-to-end tests are elsewhere
        public virtual void test_parameterSensitivity()
        {
            SimpleIborIndexRates test  = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);
            IborRateSensitivity  point = IborRateSensitivity.of(GBP_LIBOR_3M_AFTER, GBP, 1d);

            assertEquals(test.parameterSensitivity(point).size(), 1);
        }
Beispiel #3
0
        //-------------------------------------------------------------------------
        public virtual void test_ratePointSensitivity_fixing()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);

            assertEquals(test.ratePointSensitivity(GBP_LIBOR_3M_BEFORE), PointSensitivityBuilder.none());
            assertEquals(test.ratePointSensitivity(GBP_LIBOR_3M_VAL), PointSensitivityBuilder.none());
        }
Beispiel #4
0
        public virtual void test_rateIgnoringFixingsPointSensitivity_onValuation()
        {
            SimpleIborIndexRates test     = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);
            IborRateSensitivity  expected = IborRateSensitivity.of(GBP_LIBOR_3M_VAL, 1d);

            assertEquals(test.rateIgnoringFixingsPointSensitivity(GBP_LIBOR_3M_VAL), expected);
        }
Beispiel #5
0
        public virtual void test_of_badCurve()
        {
            CurveMetadata          noDayCountMetadata = DefaultCurveMetadata.builder().curveName(NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.FORWARD_RATE).build();
            InterpolatedNodalCurve notDayCount        = InterpolatedNodalCurve.of(noDayCountMetadata, DoubleArray.of(0, 10), DoubleArray.of(1, 2), INTERPOLATOR);

            assertThrowsIllegalArg(() => SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, notDayCount));
        }
Beispiel #6
0
        //-------------------------------------------------------------------------
        public virtual void test_createParameterSensitivity()
        {
            SimpleIborIndexRates           test          = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);
            DoubleArray                    sensitivities = DoubleArray.of(0.12, 0.15);
            CurrencyParameterSensitivities sens          = test.createParameterSensitivity(USD, sensitivities);

            assertEquals(sens.Sensitivities.get(0), CURVE.createParameterSensitivity(USD, sensitivities));
        }
Beispiel #7
0
        public virtual void test_rate_afterValuation()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);
            double time     = CURVE_DAY_COUNT.yearFraction(DATE_VAL, GBP_LIBOR_3M_AFTER.MaturityDate);
            double expected = CURVE.yValue(time);

            assertEquals(test.rate(GBP_LIBOR_3M_AFTER), expected, TOLERANCE_RATE);
        }
Beispiel #8
0
        public virtual void test_rateIgnoringFixings_onValuation_fixing()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);
            double time     = CURVE_DAY_COUNT.yearFraction(DATE_VAL, GBP_LIBOR_3M_VAL.MaturityDate);
            double expected = CURVE.yValue(time);

            assertEquals(test.rateIgnoringFixings(GBP_LIBOR_3M_VAL), expected, TOLERANCE_RATE);
        }
Beispiel #9
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);

            coverImmutableBean(test);
            SimpleIborIndexRates test2 = SimpleIborIndexRates.of(USD_LIBOR_3M, DATE_AFTER, CURVE2, SERIES_EMPTY);

            coverBeanEquals(test, test2);
        }
Beispiel #10
0
        public virtual void test_of_withFixings()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);

            assertEquals(test.Index, GBP_LIBOR_3M);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.Fixings, SERIES);
            assertEquals(test.Curve, CURVE);
        }
Beispiel #11
0
        //-------------------------------------------------------------------------
        public virtual void test_withDiscountFactors()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);

            test = test.withCurve(CURVE2);
            assertEquals(test.Index, GBP_LIBOR_3M);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.Fixings, SERIES);
            assertEquals(test.Curve, CURVE2);
        }
Beispiel #12
0
        //-------------------------------------------------------------------------
        public virtual void test_of_withoutFixings()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE);

            assertEquals(test.Index, GBP_LIBOR_3M);
            assertEquals(test.ValuationDate, DATE_VAL);
            assertEquals(test.Fixings, SERIES_EMPTY);
            assertEquals(test.Curve, CURVE);
            assertEquals(test.ParameterCount, CURVE.ParameterCount);
            assertEquals(test.getParameter(0), CURVE.getParameter(0));
            assertEquals(test.getParameterMetadata(0), CURVE.getParameterMetadata(0));
            assertEquals(test.withParameter(0, 1d).Curve, CURVE.withParameter(0, 1d));
            assertEquals(test.withPerturbation((i, v, m) => v + 1d).Curve, CURVE.withPerturbation((i, v, m) => v + 1d));
            assertEquals(test.findData(CURVE.Name), CURVE);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);
            // check IborIndexRates
            IborIndexRates test2 = IborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE);

            assertEquals(test, test2);
        }
Beispiel #13
0
        public virtual void test_rate_onValuation_fixing()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES);

            assertEquals(test.rate(GBP_LIBOR_3M_VAL), RATE_VAL);
        }
Beispiel #14
0
        public virtual void test_rate_beforeValuation_noFixing_notEmptySeries()
        {
            SimpleIborIndexRates test = SimpleIborIndexRates.of(GBP_LIBOR_3M, DATE_VAL, CURVE, SERIES_MINIMAL);

            assertThrowsIllegalArg(() => test.rate(GBP_LIBOR_3M_BEFORE));
        }