public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         OvernightFutureTrade other = (OvernightFutureTrade)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(quantity, other.quantity) && JodaBeanUtils.equal(price, other.price));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            OvernightFutureSecurity test = sut();

            assertEquals(test.createProduct(ReferenceData.empty()), PRODUCT);
            TradeInfo            tradeInfo     = TradeInfo.of(date(2016, 6, 30));
            OvernightFutureTrade expectedTrade = OvernightFutureTrade.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();
            OvernightFuturePosition expectedPosition1 = OvernightFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).build();

            TestHelper.assertEqualsBean(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1);
            OvernightFuturePosition expectedPosition2 = OvernightFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).shortQuantity(50).build();

            assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2);
        }
 public virtual void test_builder_badPrice()
 {
     assertThrowsIllegalArg(() => OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(2.1).build());
 }
        public virtual void test_serialization()
        {
            OvernightFutureTrade test = OvernightFutureTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();

            assertSerialization(test);
        }