Esempio n. 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);
        }
Esempio n. 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());
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         SimplePriceIndexValues other = (SimplePriceIndexValues)obj;
         return(JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(valuationDate, other.valuationDate) && JodaBeanUtils.equal(curve, other.curve) && JodaBeanUtils.equal(fixings, other.fixings));
     }
     return(false);
 }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }