コード例 #1
0
        public virtual void test_initialGuess()
        {
            FixedIborSwapCurveNode node = FixedIborSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            double     rate             = 0.035;
            MarketData marketData       = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, rate).build();

            assertEquals(node.initialGuess(marketData, ValueType.ZERO_RATE), rate);
            assertEquals(node.initialGuess(marketData, ValueType.FORWARD_RATE), rate);
            double df = Math.Exp(-TENOR_10Y.get(ChronoUnit.YEARS) * rate);

            assertEquals(node.initialGuess(marketData, ValueType.DISCOUNT_FACTOR), df, TOLERANCE_DF);
            assertEquals(node.initialGuess(marketData, ValueType.PRICE_INDEX), 0d);
        }
コード例 #2
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);
        }