public void ReadConditions()
        {
            if (serverVersion >= MinServerVer.PeggedToBenchmark)
            {
                int nConditions = eDecoder.ReadInt();

                if (nConditions > 0)
                {
                    for (int i = 0; i < nConditions; i++)
                    {
                        OrderConditionType orderConditionType = (OrderConditionType)eDecoder.ReadInt();
                        OrderCondition     condition          = OrderCondition.Create(orderConditionType);

                        condition.Deserialize(eDecoder);
                        order.Conditions.Add(condition);
                    }

                    order.ConditionsIgnoreRth   = eDecoder.ReadBoolFromInt();
                    order.ConditionsCancelOrder = eDecoder.ReadBoolFromInt();
                }
            }
        }
        public static OrderCondition Create(OrderConditionType type)
        {
            OrderCondition rval = null;

            switch (type)
            {
            case OrderConditionType.Execution:
                rval = new ExecutionCondition();
                break;

            case OrderConditionType.Margin:
                rval = new MarginCondition();
                break;

            case OrderConditionType.PercentCange:
                rval = new PercentChangeCondition();
                break;

            case OrderConditionType.Price:
                rval = new PriceCondition();
                break;

            case OrderConditionType.Time:
                rval = new TimeCondition();
                break;

            case OrderConditionType.Volume:
                rval = new VolumeCondition();
                break;
            }

            if (rval != null)
            {
                rval.Type = type;
            }

            return(rval);
        }