Exemplo n.º 1
0
        public virtual void test_initialGuess()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            LocalDate valuationDate          = LocalDate.of(2015, 1, 22);
            double    rate               = 0.035;
            double    lastPriceIndex     = 123.4;
            LocalDateDoubleTimeSeries ts = LocalDateDoubleTimeSeries.builder().put(LocalDate.of(2024, 10, 31), lastPriceIndex).build();
            MarketData marketData        = ImmutableMarketData.builder(valuationDate).addValue(QUOTE_ID, rate).addTimeSeries(IndexQuoteId.of(PriceIndices.EU_EXT_CPI), ts).build();

            assertEquals(node.initialGuess(marketData, ValueType.ZERO_RATE), rate);
            double priceIndexGuess = lastPriceIndex * Math.Pow(1.0d + rate, TENOR_10Y.get(ChronoUnit.YEARS));

            assertEquals(node.initialGuess(marketData, ValueType.PRICE_INDEX), priceIndexGuess, TOLERANCE_GUESS);
        }
Exemplo n.º 2
0
        public virtual void test_initialGuess_wrongType()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            MarketData marketData            = ImmutableMarketData.builder(VAL_DATE).build();

            assertThrowsIllegalArg(() => node.initialGuess(marketData, ValueType.BLACK_VOLATILITY));
        }