//-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            IborFutureOptionPosition tes      = sut();
            PortfolioItemSummary     expected = PortfolioItemSummary.builder().id(POSITION_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.POSITION).productType(ProductType.IBOR_FUTURE_OPTION).currencies(Currency.USD).description("IborFutureOption x 10").build();

            assertEquals(tes.summarize(), expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_withQuantity()
        {
            IborFutureOptionPosition @base = sut();
            double quantity = 75343d;
            IborFutureOptionPosition computed = @base.withQuantity(quantity);
            IborFutureOptionPosition expected = IborFutureOptionPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(quantity).build();

            assertEquals(computed, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_builder_resolved()
        {
            IborFutureOptionPosition test = sut();

            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Info, POSITION_INFO);
            assertEquals(test.LongQuantity, QUANTITY, 0d);
            assertEquals(test.ShortQuantity, 0d, 0d);
            assertEquals(test.Quantity, QUANTITY, 0d);
            assertEquals(test.withInfo(POSITION_INFO).Info, POSITION_INFO);
            assertEquals(test.withQuantity(129).Quantity, 129d, 0d);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         IborFutureOptionPosition other = (IborFutureOptionPosition)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(longQuantity, other.longQuantity) && JodaBeanUtils.equal(shortQuantity, other.shortQuantity));
     }
     return(false);
 }
Beispiel #5
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);
        }
 public IborFutureOptionPosition createPosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)
 {
     return(IborFutureOptionPosition.ofLongShort(positionInfo, createProduct(refData), longQuantity, shortQuantity));
 }
 public IborFutureOptionPosition createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData)
 {
     return(IborFutureOptionPosition.ofNet(positionInfo, createProduct(refData), quantity));
 }
 public IborFutureOptionPosition withQuantity(double quantity)
 {
     return(IborFutureOptionPosition.ofNet(info, product, quantity));
 }
 internal static IborFutureOptionPosition sut2()
 {
     return(IborFutureOptionPosition.builder().info(POSITION_INFO2).product(PRODUCT2).longQuantity(100).shortQuantity(50).build());
 }
 //-------------------------------------------------------------------------
 internal static IborFutureOptionPosition sut()
 {
     return(IborFutureOptionPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(QUANTITY).build());
 }