public virtual void test_withPrice()
        {
            IborFutureOptionTrade @base = sut();
            double price = 0.95;
            IborFutureOptionTrade computed = @base.withPrice(price);
            IborFutureOptionTrade expected = IborFutureOptionTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(price).build();

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

            assertEquals(computed, expected);
        }
Ejemplo n.º 3
0
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            IborFutureOptionSecurity test    = sut();
            ReferenceData            refData = ImmutableReferenceData.of(FUTURE_ID, FUTURE_SECURITY);

            assertEquals(test.createProduct(refData), OPTION);
            TradeInfo             tradeInfo     = TradeInfo.of(date(2016, 6, 30));
            IborFutureOptionTrade expectedTrade = IborFutureOptionTrade.builder().info(tradeInfo).product(OPTION).quantity(100).price(123.50).build();

            assertEquals(test.createTrade(tradeInfo, 100, 123.50, refData), expectedTrade);

            PositionInfo             positionInfo      = PositionInfo.empty();
            IborFutureOptionPosition expectedPosition1 = IborFutureOptionPosition.builder().info(positionInfo).product(OPTION).longQuantity(100).build();

            TestHelper.assertEqualsBean(test.createPosition(positionInfo, 100, refData), expectedPosition1);
            IborFutureOptionPosition expectedPosition2 = IborFutureOptionPosition.builder().info(positionInfo).product(OPTION).longQuantity(100).shortQuantity(50).build();

            assertEquals(test.createPosition(positionInfo, 100, 50, refData), expectedPosition2);
        }
 internal virtual IborFutureOptionTrade sut2()
 {
     return(IborFutureOptionTrade.builder().product(PRODUCT2).quantity(QUANTITY2).price(PRICE2).build());
 }
 //-------------------------------------------------------------------------
 internal static IborFutureOptionTrade sut()
 {
     return(IborFutureOptionTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build());
 }