Ejemplo n.º 1
0
        public virtual void test_withPrice()
        {
            IborFutureTrade @base    = sut();
            double          price    = 0.95;
            IborFutureTrade computed = @base.withPrice(price);
            IborFutureTrade expected = IborFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(price).build();

            assertEquals(computed, expected);
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_withQuantity()
        {
            IborFutureTrade @base    = sut();
            double          quantity = 65243;
            IborFutureTrade computed = @base.withQuantity(quantity);
            IborFutureTrade expected = IborFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(quantity).price(PRICE).build();

            assertEquals(computed, expected);
        }
Ejemplo n.º 3
0
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            IborFutureSecurity test = sut();

            assertEquals(test.createProduct(ReferenceData.empty()), PRODUCT);
            TradeInfo       tradeInfo     = TradeInfo.of(date(2016, 6, 30));
            IborFutureTrade expectedTrade = IborFutureTrade.builder().info(tradeInfo).product(PRODUCT).quantity(100).price(0.995).build();

            assertEquals(test.createTrade(tradeInfo, 100, 0.995, ReferenceData.empty()), expectedTrade);

            PositionInfo       positionInfo      = PositionInfo.empty();
            IborFuturePosition expectedPosition1 = IborFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).build();

            TestHelper.assertEqualsBean(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1);
            IborFuturePosition expectedPosition2 = IborFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).shortQuantity(50).build();

            assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2);
        }
Ejemplo n.º 4
0
 internal static IborFutureTrade sut2()
 {
     return(IborFutureTrade.builder().product(PRODUCT2).quantity(QUANTITY2).price(PRICE2).build());
 }
Ejemplo n.º 5
0
 //-------------------------------------------------------------------------
 internal static IborFutureTrade sut()
 {
     return(IborFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build());
 }