public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj is CTPStockTrader)
            {
                CTPStockTrader trader = obj as CTPStockTrader;

                if (trader == this)
                {
                    return(true);
                }
                else
                {
                    return(trader.UserKey == this.UserKey);
                }
            }
            else
            {
                return(false);
            }
        }
        public static string GetOrderUniqueKey(CTPStockTrader trader, object field)
        {
            //委托单
            if (field is CZQThostFtdcInputOrderField)
            {
                CZQThostFtdcInputOrderField ctpOrder = (CZQThostFtdcInputOrderField)field;
                return(string.Format("{0:X}_{1:X}_{2}", trader.FrontID, trader.SessionID, ctpOrder.OrderRef.Trim()));
            }
            //撤单
            if (field is CZQThostFtdcOrderActionField)
            {
                CZQThostFtdcOrderActionField ctpOrder = (CZQThostFtdcOrderActionField)field;
                return(string.Format("{0:X}_{1:X}_{2}", ctpOrder.FrontID, ctpOrder.SessionID, ctpOrder.OrderRef.Trim()));
            }

            throw new Exception("Unknow type : " + field.GetType().ToString());
        }