//-------------------------------------------------------------------------
        public virtual void test_toTrade_tenor()
        {
            FixedOvernightSwapConvention @base = ImmutableFixedOvernightSwapConvention.of(NAME, FIXED, FFUND_LEG, PLUS_TWO_DAYS);
            LocalDate tradeDate = LocalDate.of(2015, 5, 5);
            LocalDate startDate = date(2015, 5, 7);
            LocalDate endDate   = date(2025, 5, 7);
            SwapTrade test      = @base.createTrade(tradeDate, TENOR_10Y, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected  = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), FFUND_LEG.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
コード例 #2
0
        //-------------------------------------------------------------------------
        public virtual void test_toTrade_tenor()
        {
            ThreeLegBasisSwapConvention @base = ImmutableThreeLegBasisSwapConvention.of(NAME, FIXED, IBOR6M, IBOR12M);
            LocalDate tradeDate = LocalDate.of(2015, 5, 5);
            LocalDate startDate = date(2015, 5, 7);
            LocalDate endDate   = date(2025, 5, 7);
            SwapTrade test      = @base.createTrade(tradeDate, TENOR_10Y, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected  = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR6M.toLeg(startDate, endDate, PAY, NOTIONAL_2M), IBOR12M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
コード例 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_toLeg()
        {
            FixedRateSwapLegConvention @base = FixedRateSwapLegConvention.of(GBP, ACT_365F, P3M, BDA_MOD_FOLLOW);
            LocalDate startDate             = LocalDate.of(2015, 5, 5);
            LocalDate endDate               = LocalDate.of(2020, 5, 5);
            RateCalculationSwapLeg test     = @base.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d);
            RateCalculationSwapLeg expected = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().frequency(P3M).startDate(startDate).endDate(endDate).businessDayAdjustment(BDA_MOD_FOLLOW).stubConvention(StubConvention.SMART_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL_2M)).calculation(FixedRateCalculation.of(0.25d, ACT_365F)).build();

            assertEquals(test, expected);
        }
コード例 #4
0
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            ThreeLegBasisSwapTemplate @base = ThreeLegBasisSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV);
            LocalDate tradeDate             = LocalDate.of(2015, 5, 5);
            LocalDate startDate             = date(2015, 8, 7);
            LocalDate endDate  = date(2025, 8, 7);
            SwapTrade test     = @base.createTrade(tradeDate, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR3M.toLeg(startDate, endDate, PAY, NOTIONAL_2M), IBOR6M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_toTrade_dates()
        {
            ImmutableFixedInflationSwapConvention @base = ImmutableFixedInflationSwapConvention.of(NAME, FIXED, INFL, PLUS_ONE_DAY);
            LocalDate tradeDate = LocalDate.of(2015, 5, 5);
            LocalDate startDate = date(2015, 8, 5);
            LocalDate endDate   = date(2017, 8, 5);
            SwapTrade test      = @base.toTrade(tradeDate, startDate, endDate, BUY, NOTIONAL_2M, 0.25d);
            Swap      expected  = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), INFL.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            FixedInflationSwapTemplate @base = FixedInflationSwapTemplate.of(TENOR_10Y, CONV);
            LocalDate tradeDate = LocalDate.of(2015, 5, 5);
            LocalDate startDate = date(2015, 5, 6);     // T+1
            LocalDate endDate   = date(2025, 5, 6);
            SwapTrade test      = @base.createTrade(tradeDate, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected  = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), INFL.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product.Legs.get(0), expected.Legs.get(0));
            assertEquals(test.Product.Legs.get(1), expected.Legs.get(1));
            assertEquals(test.Product, expected);
        }