コード例 #1
0
        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);
        }
コード例 #2
0
        //-------------------------------------------------------------------------
        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);
        }
コード例 #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);
        }
コード例 #4
0
 internal virtual IborFutureOptionTrade sut2()
 {
     return(IborFutureOptionTrade.builder().product(PRODUCT2).quantity(QUANTITY2).price(PRICE2).build());
 }
コード例 #5
0
 //-------------------------------------------------------------------------
 internal static IborFutureOptionTrade sut()
 {
     return(IborFutureOptionTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build());
 }