예제 #1
0
        //-------------------------------------------------------------------------
        // proper end-to-end tests are elsewhere
        public virtual void test_parameterSensitivity()
        {
            SimplePriceIndexValues   test  = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);
            InflationRateSensitivity point = InflationRateSensitivity.of(PriceIndexObservation.of(US_CPI_U, VAL_MONTH.plusMonths(3)), 1d);

            assertEquals(test.parameterSensitivity(point).size(), 1);
        }
예제 #2
0
        //-------------------------------------------------------------------------
        public virtual void test_valuePointSensitivity_fixing()
        {
            SimplePriceIndexValues test = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);
            PriceIndexObservation  obs  = PriceIndexObservation.of(US_CPI_U, VAL_MONTH.minusMonths(3));

            assertEquals(test.valuePointSensitivity(obs), PointSensitivityBuilder.none());
        }
예제 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_createParameterSensitivity()
        {
            SimplePriceIndexValues         test          = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);
            DoubleArray                    sensitivities = DoubleArray.of(0.12, 0.15, 0.16, 0.17);
            CurrencyParameterSensitivities sens          = test.createParameterSensitivity(USD, sensitivities);

            assertEquals(sens.Sensitivities.get(0), CURVE_NOFIX.createParameterSensitivity(USD, sensitivities));
        }
예제 #4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            SimplePriceIndexValues instance1 = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);

            coverImmutableBean(instance1);
            SimplePriceIndexValues test2 = SimplePriceIndexValues.of(GB_HICP, VAL_DATE.plusMonths(1), CURVE_NOFIX, LocalDateDoubleTimeSeries.of(VAL_MONTH.minusMonths(2).atEndOfMonth(), 100d));

            coverBeanEquals(instance1, test2);
        }
예제 #5
0
        public virtual void test_valuePointSensitivity_forward()
        {
            YearMonth month = VAL_MONTH.plusMonths(3);
            SimplePriceIndexValues   test     = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);
            PriceIndexObservation    obs      = PriceIndexObservation.of(US_CPI_U, month);
            InflationRateSensitivity expected = InflationRateSensitivity.of(obs, 1d);

            assertEquals(test.valuePointSensitivity(obs), expected);
        }
예제 #6
0
        //-------------------------------------------------------------------------
        public virtual void test_of_noSeasonality()
        {
            SimplePriceIndexValues test = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);

            assertEquals(test.Index, US_CPI_U);
            assertEquals(test.ValuationDate, VAL_DATE);
            assertEquals(test.Curve, CURVE_NOFIX);
            assertEquals(test.ParameterCount, CURVE_NOFIX.ParameterCount);
            assertEquals(test.getParameter(0), CURVE_NOFIX.getParameter(0));
            assertEquals(test.getParameterMetadata(0), CURVE_NOFIX.getParameterMetadata(0));
            assertEquals(test.withParameter(0, 1d).Curve, CURVE_NOFIX.withParameter(0, 1d));
            assertEquals(test.withPerturbation((i, v, m) => v + 1d).Curve, CURVE_NOFIX.withPerturbation((i, v, m) => v + 1d));
            assertEquals(test.findData(CURVE_NOFIX.Name), CURVE_NOFIX);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);
            // check PriceIndexValues
            PriceIndexValues test2 = PriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS);

            assertEquals(test, test2);
        }
예제 #7
0
        //-------------------------------------------------------------------------
        public virtual void test_withCurve()
        {
            SimplePriceIndexValues test = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS).withCurve(CURVE2_NOFIX);

            assertEquals(test.Curve, CURVE2_NOFIX);
        }