Esempio n. 1
0
        public virtual void test_trade_noMarketData()
        {
            IborFutureCurveNode node       = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            MarketData          marketData = MarketData.empty(VAL_DATE);

            assertThrows(() => node.trade(1d, marketData, REF_DATA), typeof(MarketDataNotFoundException));
        }
Esempio n. 2
0
        public virtual void test_trade()
        {
            IborFutureCurveNode node   = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            double          price      = 0.99;
            MarketData      marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, price).build();
            IborFutureTrade trade      = node.trade(1d, marketData, REF_DATA);
            IborFutureTrade expected   = TEMPLATE.createTrade(VAL_DATE, SecurityId.of(STANDARD_ID), 1L, 1.0, price + SPREAD, REF_DATA);

            assertEquals(trade, expected);
        }
Esempio n. 3
0
        public virtual void test_metadata_last_fixing()
        {
            IborFutureCurveNode    node       = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.LAST_FIXING);
            ImmutableMarketData    marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, 0.0d).build();
            IborFutureTrade        trade      = node.trade(1d, marketData, REF_DATA);
            LocalDate              fixingDate = trade.Product.FixingDate;
            DatedParameterMetadata metadata   = node.metadata(VAL_DATE, REF_DATA);

            assertEquals(metadata.Date, fixingDate);
            LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(VAL_DATE, REF_DATA);

            assertEquals(((YearMonthDateParameterMetadata)metadata).YearMonth, YearMonth.from(referenceDate));
        }