Esempio n. 1
0
        public virtual void test_trade_noMarketData()
        {
            TermDepositCurveNode node          = TermDepositCurveNode.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));
        }
Esempio n. 2
0
        public virtual void test_trade()
        {
            TermDepositCurveNode node          = TermDepositCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            double           rate              = 0.035;
            MarketData       marketData        = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, rate).build();
            TermDepositTrade trade             = node.trade(1d, marketData, REF_DATA);
            LocalDate        startDateExpected = PLUS_TWO_DAYS.adjust(VAL_DATE, REF_DATA);
            LocalDate        endDateExpected   = startDateExpected.plus(DEPOSIT_PERIOD);
            TermDeposit      depositExpected   = TermDeposit.builder().buySell(BuySell.BUY).currency(EUR).dayCount(ACT_360).startDate(startDateExpected).endDate(endDateExpected).notional(1.0d).businessDayAdjustment(BDA_MOD_FOLLOW).rate(rate + SPREAD).build();
            TradeInfo        tradeInfoExpected = TradeInfo.builder().tradeDate(VAL_DATE).build();

            assertEquals(trade.Product, depositExpected);
            assertEquals(trade.Info, tradeInfoExpected);
        }