Exemple #1
0
        //-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            IborFutureTrade      trade    = sut();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().id(TRADE_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.TRADE).productType(ProductType.IBOR_FUTURE).currencies(Currency.USD).description("IborFuture x 35").build();

            assertEquals(trade.summarize(), expected);
        }
Exemple #2
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);
        }
Exemple #3
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);
        }
Exemple #4
0
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            IborFutureTrade         test     = sut();
            ResolvedIborFutureTrade resolved = test.resolve(REF_DATA);

            assertEquals(resolved.Info, TRADE_INFO);
            assertEquals(resolved.Product, PRODUCT.resolve(REF_DATA));
            assertEquals(resolved.Quantity, QUANTITY);
            assertEquals(resolved.TradedPrice, TradedPrice.of(TRADE_DATE, PRICE));
        }
Exemple #5
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            IborFutureTrade test = sut();

            assertEquals(test.Info, TRADE_INFO);
            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Price, PRICE);
            assertEquals(test.Quantity, QUANTITY);
            assertEquals(test.withInfo(TRADE_INFO).Info, TRADE_INFO);
            assertEquals(test.withQuantity(0.9129).Quantity, 0.9129d, 1e-10);
            assertEquals(test.withPrice(0.9129).Price, 0.9129d, 1e-10);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         IborFutureTrade other = (IborFutureTrade)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(quantity, other.quantity) && JodaBeanUtils.equal(price, other.price));
     }
     return(false);
 }
Exemple #7
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);
        }
Exemple #8
0
 internal static IborFutureTrade sut2()
 {
     return(IborFutureTrade.builder().product(PRODUCT2).quantity(QUANTITY2).price(PRICE2).build());
 }
Exemple #9
0
 //-------------------------------------------------------------------------
 internal static IborFutureTrade sut()
 {
     return(IborFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build());
 }