static ForwardOvernightAveragedDailyRateComputationFnTest()
        {
            LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder();

            for (int i = 0; i < FIXING_DATES.Length; ++i)
            {
                builder.put(FIXING_DATES[i], FIXING_RATES[i]);
            }
            TIME_SERIES = builder.build();
        }
Beispiel #2
0
        static SimplePriceIndexValuesTest()
        {
            LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder();

            for (int i = 0; i < USCPI_VALUES.Length; i++)
            {
                builder.put(USCPI_START_DATE.plusMonths(i), USCPI_VALUES[i]);
            }
            USCPI_TS = builder.build();
            for (int i = 0; i < TEST_MONTHS.Length; i++)
            {
                TEST_OBS[i] = PriceIndexObservation.of(US_CPI_U, TEST_MONTHS[i]);
            }
        }
        /// <summary>
        /// Obtains time series of price index up to valuation date.
        /// </summary>
        /// <param name="valuationDate">  the valuation date </param>
        /// <returns> the time series </returns>
        public static LocalDateDoubleTimeSeries getTimeSeries(LocalDate valuationDate)
        {
            LocalDate[] dates  = new LocalDate[] { LocalDate.of(2005, 1, 31), LocalDate.of(2005, 2, 28), LocalDate.of(2005, 3, 31), LocalDate.of(2005, 4, 30), LocalDate.of(2005, 5, 31), LocalDate.of(2005, 6, 30), LocalDate.of(2005, 7, 31), LocalDate.of(2005, 8, 31), LocalDate.of(2005, 9, 30), LocalDate.of(2005, 10, 31), LocalDate.of(2005, 11, 30), LocalDate.of(2005, 12, 31), LocalDate.of(2006, 1, 31), LocalDate.of(2006, 2, 28), LocalDate.of(2006, 3, 31), LocalDate.of(2006, 4, 30), LocalDate.of(2006, 5, 31), LocalDate.of(2006, 6, 30), LocalDate.of(2006, 7, 31), LocalDate.of(2006, 8, 31), LocalDate.of(2006, 9, 30), LocalDate.of(2006, 10, 31), LocalDate.of(2006, 11, 30), LocalDate.of(2006, 12, 31), LocalDate.of(2007, 1, 31), LocalDate.of(2007, 2, 28), LocalDate.of(2007, 3, 31), LocalDate.of(2007, 4, 30), LocalDate.of(2007, 5, 31), LocalDate.of(2007, 6, 30), LocalDate.of(2007, 7, 31), LocalDate.of(2007, 8, 31), LocalDate.of(2007, 9, 30), LocalDate.of(2007, 10, 31), LocalDate.of(2007, 11, 30), LocalDate.of(2007, 12, 31), LocalDate.of(2008, 1, 31), LocalDate.of(2008, 2, 29), LocalDate.of(2008, 3, 31), LocalDate.of(2008, 4, 30), LocalDate.of(2008, 5, 31), LocalDate.of(2008, 6, 30), LocalDate.of(2008, 7, 31), LocalDate.of(2008, 8, 31), LocalDate.of(2008, 9, 30), LocalDate.of(2008, 10, 31), LocalDate.of(2008, 11, 30), LocalDate.of(2008, 12, 31), LocalDate.of(2009, 1, 31), LocalDate.of(2009, 2, 28), LocalDate.of(2009, 3, 31), LocalDate.of(2009, 4, 30), LocalDate.of(2009, 5, 31), LocalDate.of(2009, 6, 30), LocalDate.of(2009, 7, 31), LocalDate.of(2009, 8, 31), LocalDate.of(2009, 9, 30), LocalDate.of(2009, 10, 31), LocalDate.of(2009, 11, 30), LocalDate.of(2009, 12, 31), LocalDate.of(2010, 1, 31), LocalDate.of(2010, 2, 28), LocalDate.of(2010, 3, 31), LocalDate.of(2010, 4, 30), LocalDate.of(2010, 5, 31), LocalDate.of(2010, 6, 30), LocalDate.of(2010, 7, 31), LocalDate.of(2010, 8, 31), LocalDate.of(2010, 9, 30), LocalDate.of(2010, 10, 31), LocalDate.of(2010, 11, 30), LocalDate.of(2010, 12, 31), LocalDate.of(2011, 1, 31), LocalDate.of(2011, 2, 28), LocalDate.of(2011, 3, 31), LocalDate.of(2011, 4, 30), LocalDate.of(2011, 5, 31), LocalDate.of(2011, 6, 30), LocalDate.of(2011, 7, 31), LocalDate.of(2011, 8, 31), LocalDate.of(2011, 9, 30), LocalDate.of(2011, 10, 31), LocalDate.of(2011, 11, 30), LocalDate.of(2011, 12, 31), LocalDate.of(2012, 1, 31), LocalDate.of(2012, 2, 29), LocalDate.of(2012, 3, 31), LocalDate.of(2012, 4, 30), LocalDate.of(2012, 5, 31), LocalDate.of(2012, 6, 30), LocalDate.of(2012, 7, 31), LocalDate.of(2012, 8, 31), LocalDate.of(2012, 9, 30), LocalDate.of(2012, 10, 31), LocalDate.of(2012, 11, 30), LocalDate.of(2012, 12, 31), LocalDate.of(2013, 1, 31), LocalDate.of(2013, 2, 28), LocalDate.of(2013, 3, 31), LocalDate.of(2013, 4, 30), LocalDate.of(2013, 5, 31), LocalDate.of(2013, 6, 30), LocalDate.of(2013, 7, 31), LocalDate.of(2013, 8, 31), LocalDate.of(2013, 9, 30), LocalDate.of(2013, 10, 31), LocalDate.of(2013, 11, 30), LocalDate.of(2013, 12, 31), LocalDate.of(2014, 1, 31), LocalDate.of(2014, 2, 28), LocalDate.of(2014, 3, 31), LocalDate.of(2014, 4, 30), LocalDate.of(2014, 5, 31), LocalDate.of(2014, 6, 30), LocalDate.of(2014, 7, 31), LocalDate.of(2014, 8, 31), LocalDate.of(2014, 9, 30), LocalDate.of(2014, 10, 31), LocalDate.of(2014, 11, 30), LocalDate.of(2014, 12, 31), LocalDate.of(2015, 1, 31), LocalDate.of(2015, 2, 28), LocalDate.of(2015, 3, 31), LocalDate.of(2015, 4, 30), LocalDate.of(2015, 5, 31), LocalDate.of(2015, 6, 30), LocalDate.of(2015, 7, 31), LocalDate.of(2015, 8, 31), LocalDate.of(2015, 9, 30), LocalDate.of(2015, 10, 31), LocalDate.of(2015, 11, 30), LocalDate.of(2015, 12, 31), LocalDate.of(2016, 1, 31) };
            double[]    values = new double[] { 211.143, 212.193, 212.709, 213.24, 213.856, 215.693, 215.351, 215.834, 215.969, 216.177, 216.33, 215.949, 211.143, 212.193, 212.709, 213.24, 213.856, 215.693, 215.351, 215.834, 215.969, 216.177, 216.33, 215.949, 211.143, 212.193, 212.709, 213.24, 213.856, 215.693, 215.351, 215.834, 215.969, 216.177, 216.33, 215.949, 211.143, 212.193, 212.709, 213.24, 213.856, 215.693, 215.351, 215.834, 215.969, 216.177, 216.33, 215.949, 211.143, 212.193, 212.709, 213.24, 213.856, 215.693, 215.351, 215.834, 215.969, 216.177, 216.33, 215.949, 216.687, 216.741, 217.631, 218.009, 218.178, 217.965, 218.011, 218.312, 218.439, 218.711, 218.803, 219.179, 220.223, 221.309, 223.467, 224.906, 225.964, 225.722, 225.922, 226.545, 226.889, 226.421, 226.23, 225.672, 226.655, 227.663, 229.392, 230.085, 229.815, 229.478, 229.104, 230.379, 231.407, 231.317, 230.221, 229.601, 230.28, 232.166, 232.773, 232.531, 232.945, 233.504, 233.596, 233.877, 234.149, 233.546, 233.069, 233.049, 233.916, 234.781, 236.293, 237.072, 237.9, 238.343, 238.25, 237.852, 238.031, 237.433, 236.151, 234.812, 233.707, 234.722, 236.119, 236.599, 237.805, 238.638, 238.654, 238.316, 237.945, 237.838, 237.336, 236.525, 236.916 };
            LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder();

            for (int i = 0; i < values.Length; ++i)
            {
                if (dates[i].isBefore(valuationDate))
                {
                    builder.put(dates[i], values[i]);
                }
            }
            return(builder.build());
        }
        /// <summary>
        /// Obtains time series of price index up to valuation date.
        /// </summary>
        /// <param name="valuationDate">  the valuation date </param>
        /// <returns> the time series </returns>
        public static LocalDateDoubleTimeSeries getTimeSeriesJp(LocalDate valuationDate)
        {
            LocalDate[] dates  = new LocalDate[] { LocalDate.of(2013, 1, 31), LocalDate.of(2013, 2, 28), LocalDate.of(2013, 3, 31), LocalDate.of(2013, 4, 30), LocalDate.of(2013, 5, 31), LocalDate.of(2013, 6, 30), LocalDate.of(2013, 7, 31), LocalDate.of(2013, 8, 31), LocalDate.of(2013, 9, 30), LocalDate.of(2013, 10, 31), LocalDate.of(2013, 11, 30), LocalDate.of(2013, 12, 31), LocalDate.of(2014, 1, 31), LocalDate.of(2014, 2, 28), LocalDate.of(2014, 3, 31), LocalDate.of(2014, 4, 30), LocalDate.of(2014, 5, 31), LocalDate.of(2014, 6, 30), LocalDate.of(2014, 7, 31), LocalDate.of(2014, 8, 31), LocalDate.of(2014, 9, 30), LocalDate.of(2014, 10, 31), LocalDate.of(2014, 11, 30), LocalDate.of(2014, 12, 31), LocalDate.of(2015, 1, 31), LocalDate.of(2015, 2, 28), LocalDate.of(2015, 3, 31), LocalDate.of(2015, 4, 30), LocalDate.of(2015, 5, 31), LocalDate.of(2015, 6, 30), LocalDate.of(2015, 7, 31), LocalDate.of(2015, 8, 31), LocalDate.of(2015, 9, 30), LocalDate.of(2015, 10, 31), LocalDate.of(2015, 11, 30), LocalDate.of(2015, 12, 31), LocalDate.of(2016, 1, 31) };
            double[]    values = new double[] { 99.1, 99.2, 99.5, 99.8, 100, 100, 100.1, 100.4, 100.5, 100.7, 100.7, 100.6, 100.4, 100.5, 100.8, 103, 103.4, 103.4, 103.5, 103.5, 103.5, 103.6, 103.4, 103.2, 102.6, 102.5, 103, 103.3, 103.4, 103.4, 103.4, 103.4, 103.4, 103.5, 103.4, 103.3 };

            LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder();

            for (int i = 0; i < values.Length; ++i)
            {
                if (dates[i].isBefore(valuationDate))
                {
                    builder.put(dates[i], values[i]);
                }
            }
            return(builder.build());
        }
        /// <summary>
        /// Obtains time series of price index up to valuation date.
        /// </summary>
        /// <param name="valuationDate">  the valuation date </param>
        /// <returns> the time series </returns>
        public static LocalDateDoubleTimeSeries getTimeSeriesGb(LocalDate valuationDate)
        {
            LocalDate[] dates  = new LocalDate[] { LocalDate.of(2015, 1, 31), LocalDate.of(2015, 2, 28), LocalDate.of(2015, 3, 31), LocalDate.of(2015, 4, 30), LocalDate.of(2015, 5, 31), LocalDate.of(2015, 6, 30), LocalDate.of(2015, 7, 31), LocalDate.of(2015, 8, 31), LocalDate.of(2015, 9, 30), LocalDate.of(2015, 10, 31), LocalDate.of(2015, 11, 30), LocalDate.of(2015, 12, 31), LocalDate.of(2016, 1, 31) };
            double[]    values = new double[] { 255.4, 256.7, 257.1, 258.0, 258.5, 258.9, 258.6, 259.8, 259.6, 259.5, 259.8, 260.6, 258.8 };

            LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder();

            for (int i = 0; i < values.Length; ++i)
            {
                if (dates[i].isBefore(valuationDate))
                {
                    builder.put(dates[i], values[i]);
                }
            }
            return(builder.build());
        }