Exemplo n.º 1
0
        //-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            IborFuturePosition   tes      = sut();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().id(POSITION_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.POSITION).productType(ProductType.IBOR_FUTURE).currencies(Currency.USD).description("IborFuture x 10").build();

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

            assertEquals(computed, expected);
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------
        public virtual void test_builder_resolved()
        {
            IborFuturePosition 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())
     {
         IborFuturePosition other = (IborFuturePosition)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(longQuantity, other.longQuantity) && JodaBeanUtils.equal(shortQuantity, other.shortQuantity));
     }
     return(false);
 }
Exemplo n.º 5
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);
        }
 public IborFuturePosition withQuantity(double quantity)
 {
     return(IborFuturePosition.ofNet(info, product, quantity));
 }
 public IborFuturePosition createPosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)
 {
     return(IborFuturePosition.ofLongShort(positionInfo, createProduct(refData), longQuantity, shortQuantity));
 }
 public IborFuturePosition createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData)
 {
     return(IborFuturePosition.ofNet(positionInfo, createProduct(refData), quantity));
 }
Exemplo n.º 9
0
 internal static IborFuturePosition sut2()
 {
     return(IborFuturePosition.builder().info(POSITION_INFO2).product(PRODUCT2).longQuantity(100).shortQuantity(50).build());
 }
Exemplo n.º 10
0
 //-------------------------------------------------------------------------
 internal static IborFuturePosition sut()
 {
     return(IborFuturePosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(QUANTITY).build());
 }