Exemplo n.º 1
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));
        }
Exemplo n.º 2
0
        public virtual void test_trade_noMarketData()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            LocalDate  valuationDate         = LocalDate.of(2015, 1, 22);
            MarketData marketData            = MarketData.empty(valuationDate);

            assertThrows(() => node.trade(1d, marketData, REF_DATA), typeof(MarketDataNotFoundException));
        }
Exemplo n.º 3
0
        public virtual void test_of_withSpread()
        {
            FixedInflationSwapCurveNode test = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            assertEquals(test.Label, LABEL_AUTO);
            assertEquals(test.RateId, QUOTE_ID);
            assertEquals(test.AdditionalSpread, SPREAD);
            assertEquals(test.Template, TEMPLATE);
        }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FixedInflationSwapCurveNode test = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            coverImmutableBean(test);
            FixedInflationSwapCurveNode test2 = FixedInflationSwapCurveNode.of(FixedInflationSwapTemplate.of(TENOR_10Y, FixedInflationSwapConventions.USD_FIXED_ZC_US_CPI), QuoteId.of(StandardId.of("OG-Ticker", "Deposit2")));

            coverBeanEquals(test, test2);
        }
Exemplo n.º 5
0
        public virtual void test_metadata_fixed()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.of(VAL_DATE));
            LocalDate valuationDate          = LocalDate.of(2015, 1, 22);
            DatedParameterMetadata metadata  = node.metadata(valuationDate, REF_DATA);

            assertEquals(metadata.Date, VAL_DATE);
            assertEquals(metadata.Label, node.Label);
        }
Exemplo n.º 6
0
        public virtual void test_builder()
        {
            FixedInflationSwapCurveNode test = FixedInflationSwapCurveNode.builder().label(LABEL).template(TEMPLATE).rateId(QUOTE_ID).additionalSpread(SPREAD).build();

            assertEquals(test.Label, LABEL);
            assertEquals(test.RateId, QUOTE_ID);
            assertEquals(test.AdditionalSpread, SPREAD);
            assertEquals(test.Template, TEMPLATE);
            assertEquals(test.Date, CurveNodeDate.END);
        }
Exemplo n.º 7
0
        public virtual void test_metadata_last_fixing()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.LAST_FIXING);
            LocalDate valuationDate          = LocalDate.of(2015, 1, 22);
            LocalDate fixingExpected         = LocalDate.of(2024, 10, 31); // Last day of the month
            DatedParameterMetadata metadata  = node.metadata(valuationDate, REF_DATA);

            assertEquals(metadata.Date, fixingExpected);
            assertEquals(metadata.Label, node.Label);
        }
Exemplo n.º 8
0
        public virtual void test_metadata_end()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            LocalDate         valuationDate  = LocalDate.of(2015, 1, 22);
            ParameterMetadata metadata       = node.metadata(valuationDate, REF_DATA);

            // 2015-01-22 is Thursday, start is 2015-01-26, but 2025-01-26 is Sunday, so end is 2025-01-27
            assertEquals(((TenorDateParameterMetadata)metadata).Date, LocalDate.of(2025, 1, 27));
            assertEquals(((TenorDateParameterMetadata)metadata).Tenor, Tenor.TENOR_10Y);
        }
Exemplo n.º 9
0
        public virtual void test_requirements()
        {
            FixedInflationSwapCurveNode test = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            ISet <ObservableId>         set  = test.requirements();
            IEnumerator <ObservableId>  itr  = set.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertEquals(itr.next(), QUOTE_ID);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(itr.hasNext());
        }
Exemplo n.º 10
0
        public virtual void test_trade()
        {
            FixedInflationSwapCurveNode node = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            LocalDate  tradeDate             = LocalDate.of(2015, 1, 22);
            double     rate       = 0.125;
            double     quantity   = -1234.56;
            MarketData marketData = ImmutableMarketData.builder(tradeDate).addValue(QUOTE_ID, rate).build();
            SwapTrade  trade      = node.trade(quantity, marketData, REF_DATA);
            SwapTrade  expected   = TEMPLATE.createTrade(tradeDate, BUY, -quantity, rate + SPREAD, REF_DATA);

            assertEquals(trade, expected);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FixedInflationSwapCurveNode other = (FixedInflationSwapCurveNode)obj;
         return(JodaBeanUtils.equal(template, other.template) && JodaBeanUtils.equal(rateId, other.rateId) && JodaBeanUtils.equal(additionalSpread, other.additionalSpread) && JodaBeanUtils.equal(label, other.label) && JodaBeanUtils.equal(date_Renamed, other.date_Renamed) && JodaBeanUtils.equal(dateOrder, other.dateOrder));
     }
     return(false);
 }
Exemplo n.º 12
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.º 13
0
        public virtual void test_serialization()
        {
            FixedInflationSwapCurveNode test = FixedInflationSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            assertSerialization(test);
        }