Ejemplo n.º 1
0
        public virtual void test_of_near_far()
        {
            FxSwapTemplate test = FxSwapTemplate.of(NEAR_PERIOD, FAR_PERIOD, CONVENTION);

            assertEquals(test.PeriodToNear, NEAR_PERIOD);
            assertEquals(test.PeriodToFar, FAR_PERIOD);
            assertEquals(test.Convention, CONVENTION);
            assertEquals(test.CurrencyPair, EUR_USD);
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FxSwapTemplate test = FxSwapTemplate.of(NEAR_PERIOD, FAR_PERIOD, CONVENTION);

            coverImmutableBean(test);
            FxSwapTemplate test2 = FxSwapTemplate.of(Period.ofMonths(4), Period.ofMonths(7), CONVENTION2);

            coverBeanEquals(test, test2);
        }
Ejemplo n.º 3
0
        //-------------------------------------------------------------------------
        public virtual void test_createTrade()
        {
            FxSwapTemplate        @base     = FxSwapTemplate.of(NEAR_PERIOD, FAR_PERIOD, CONVENTION);
            LocalDate             tradeDate = LocalDate.of(2015, 10, 29);
            FxSwapTrade           test      = @base.createTrade(tradeDate, BUY, NOTIONAL_EUR, FX_RATE_NEAR, FX_RATE_PTS, REF_DATA);
            LocalDate             spotDate  = PLUS_TWO_DAYS.adjust(tradeDate, REF_DATA);
            LocalDate             nearDate  = spotDate.plus(NEAR_PERIOD);
            LocalDate             farDate   = spotDate.plus(FAR_PERIOD);
            BusinessDayAdjustment bda       = CONVENTION.BusinessDayAdjustment;
            FxSwap expected = FxSwap.ofForwardPoints(CurrencyAmount.of(EUR, NOTIONAL_EUR), FxRate.of(EUR, USD, FX_RATE_NEAR), FX_RATE_PTS, nearDate, farDate, bda);

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
Ejemplo n.º 4
0
        public virtual void test_serialization()
        {
            FxSwapTemplate test = FxSwapTemplate.of(NEAR_PERIOD, FAR_PERIOD, CONVENTION);

            assertSerialization(test);
        }