示例#1
0
文件: XApiCom.cs 项目: mlken/XAPI2
        private void OnRspQryOrder_callback(object sender, [In] ref OrderField order, int size1, bool bIsLast)
        {
            if (null == OnRspQryOrder)
            {
                return;
            }

            OrderClass cls = new OrderClass();

            if (size1 > 0)
            {
                OrderField field = order;

                cls.InstrumentName = field.InstrumentName();
                cls.Symbol         = field.Symbol;
                cls.InstrumentID   = field.InstrumentID;
                cls.ExchangeID     = field.ExchangeID;
                cls.ClientID       = field.ClientID;
                cls.AccountID      = field.AccountID;
                cls.Side           = (int)field.Side;
                cls.Side_String    = Enum <XAPI.OrderSide> .ToString(field.Side);

                cls.Qty              = field.Qty;
                cls.Price            = field.Price;
                cls.OpenClose        = (int)field.OpenClose;
                cls.OpenClose_String = Enum <XAPI.OpenCloseType> .ToString(field.OpenClose);

                cls.HedgeFlag        = (int)field.HedgeFlag;
                cls.HedgeFlag_String = Enum <XAPI.HedgeFlagType> .ToString(field.HedgeFlag);

                cls.Date        = field.Date;
                cls.Time        = field.Time;
                cls.ID          = field.ID;
                cls.OrderID     = field.OrderID;
                cls.LocalID     = field.LocalID;
                cls.Type        = (int)field.Type;
                cls.Type_String = Enum <XAPI.OrderType> .ToString(field.Type);

                cls.StopPx             = field.StopPx;
                cls.TimeInForce        = (int)field.TimeInForce;
                cls.TimeInForce_String = Enum <XAPI.TimeInForce> .ToString(field.TimeInForce);

                cls.Status        = (int)field.Status;
                cls.Status_String = Enum <XAPI.OrderStatus> .ToString(field.Status);

                cls.ExecType        = (int)field.ExecType;
                cls.ExecType_String = Enum <XAPI.ExecType> .ToString(field.ExecType);

                cls.LeavesQty     = field.LeavesQty;
                cls.CumQty        = field.CumQty;
                cls.AvgPx         = field.AvgPx;
                cls.XErrorID      = field.XErrorID;
                cls.RawErrorID    = field.RawErrorID;
                cls.Text          = field.Text();
                cls.ReserveInt32  = field.ReserveInt32;
                cls.ReserveChar64 = field.ReserveChar64;

                cls.PortfolioID1    = field.PortfolioID1;
                cls.PortfolioID2    = field.PortfolioID2;
                cls.PortfolioID3    = field.PortfolioID3;
                cls.Business        = (int)field.Business;
                cls.Business_String = Enum <XAPI.BusinessType> .ToString(field.Business);
            }

            if (null == OnRspQryOrder)
            {
                QueueData qd = new QueueData();
                qd.Type        = (int)ResponseType.OnRspQryOrder;
                qd.Type_String = Enum <XAPI.ResponseType> .ToString(ResponseType.OnRspQryOrder);

                qd.Sender = this;
                qd.Data1  = cls;
                qd.Data2  = size1;
                qd.Data3  = bIsLast;

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryOrder(this, cls, size1, bIsLast);
            }
        }
示例#2
0
文件: XApiCom.cs 项目: QuantBox/XAPI2
        private void OnRtnOrder_callback(object sender, [In] ref OrderField order)
        {
            OrderField field = order;

            OrderClass cls = new OrderClass();

            cls.InstrumentName = field.InstrumentName();
            cls.Symbol = field.Symbol;
            cls.InstrumentID = field.InstrumentID;
            cls.ExchangeID = field.ExchangeID;
            cls.ClientID = field.ClientID;
            cls.AccountID = field.AccountID;
            cls.Side = (int)field.Side;
            cls.Side_String = Enum<XAPI.OrderSide>.ToString(field.Side);
            cls.Qty = field.Qty;
            cls.Price = field.Price;
            cls.OpenClose = (int)field.OpenClose;
            cls.OpenClose_String = Enum<XAPI.OpenCloseType>.ToString(field.OpenClose);
            cls.HedgeFlag = (int)field.HedgeFlag;
            cls.HedgeFlag_String = Enum<XAPI.HedgeFlagType>.ToString(field.HedgeFlag);
            cls.Date = field.Date;
            cls.Time = field.Time;
            cls.ID = field.ID;
            cls.OrderID = field.OrderID;
            cls.LocalID = field.LocalID;
            cls.Type = (int)field.Type;
            cls.Type_String = Enum<XAPI.OrderType>.ToString(field.Type);
            cls.StopPx = field.StopPx;
            cls.TimeInForce = (int)field.TimeInForce;
            cls.TimeInForce_String = Enum<XAPI.TimeInForce>.ToString(field.TimeInForce);
            cls.Status = (int)field.Status;
            cls.Status_String = Enum<XAPI.OrderStatus>.ToString(field.Status);
            cls.ExecType = (int)field.ExecType;
            cls.ExecType_String = Enum<XAPI.ExecType>.ToString(field.ExecType);
            cls.LeavesQty = field.LeavesQty;
            cls.CumQty = field.CumQty;
            cls.AvgPx = field.AvgPx;
            cls.XErrorID = field.XErrorID;
            cls.RawErrorID = field.RawErrorID;
            cls.Text = field.Text();
            cls.ReserveInt32 = field.ReserveInt32;
            cls.ReserveChar64 = field.ReserveChar64;

            cls.PortfolioID1 = field.PortfolioID1;
            cls.PortfolioID2 = field.PortfolioID2;
            cls.PortfolioID3 = field.PortfolioID3;
            cls.Business = (int)field.Business;
            cls.Business_String = Enum<XAPI.BusinessType>.ToString(field.Business);

            if (null == OnRtnOrder)
            {
                QueueData qd = new QueueData();
                qd.Type = (int)ResponseType.OnRtnOrder;
                qd.Type_String = Enum<XAPI.ResponseType>.ToString(ResponseType.OnRtnOrder);
                qd.Sender = this;
                qd.Data1 = cls;

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRtnOrder(this, cls);
            }
        }
示例#3
0
文件: XApiCom.cs 项目: Strongc/XAPI2
        private void OnRspQryOrder_callback(object sender, ref OrderField order, int size1, bool bIsLast)
        {
            if (null == OnRspQryOrder)
                return;

            OrderClass cls = null;

            if (size1 > 0)
            {
                OrderField field = order;

                cls = new OrderClass();

                cls.InstrumentName = field.InstrumentName();
                cls.Symbol = field.Symbol;
                cls.InstrumentID = field.InstrumentID;
                cls.ExchangeID = field.ExchangeID;
                cls.ClientID = field.ClientID;
                cls.AccountID = field.AccountID;
                cls.Side = (int) field.Side;
                cls.Side_String = Enum<XAPI.OrderSide>.ToString(field.Side);
                cls.Qty = field.Qty;
                cls.Price = field.Price;
                cls.OpenClose = (int) field.OpenClose;
                cls.OpenClose_String = Enum<XAPI.OpenCloseType>.ToString(field.OpenClose);
                cls.HedgeFlag = (int) field.HedgeFlag;
                cls.HedgeFlag_String = Enum<XAPI.HedgeFlagType>.ToString(field.HedgeFlag);
                cls.Date = field.Date;
                cls.Time = field.Time;
                cls.ID = field.ID;
                cls.OrderID = field.OrderID;
                cls.LocalID = field.LocalID;
                cls.Type = (int) field.Type;
                cls.Type_String = Enum<XAPI.OrderType>.ToString(field.Type);
                cls.StopPx = field.StopPx;
                cls.TimeInForce = (int) field.TimeInForce;
                cls.TimeInForce_String = Enum<XAPI.TimeInForce>.ToString(field.TimeInForce);
                cls.Status = (int) field.Status;
                cls.Status_String = Enum<XAPI.OrderStatus>.ToString(field.Status);
                cls.ExecType = (int) field.ExecType;
                cls.ExecType_String = Enum<XAPI.ExecType>.ToString(field.ExecType);
                cls.LeavesQty = field.LeavesQty;
                cls.CumQty = field.CumQty;
                cls.AvgPx = field.AvgPx;
                cls.XErrorID = field.XErrorID;
                cls.RawErrorID = field.RawErrorID;
                cls.Text = field.Text();
                cls.ReserveInt32 = field.ReserveInt32;
                cls.ReserveChar64 = field.ReserveChar64;
            }

            if (null == OnRspQryOrder)
            {
                QueueData qd = new QueueData();
                qd.Type = (int)ResponeType.OnRspQryOrder;
                qd.Type_String = Enum<XAPI.ResponeType>.ToString(ResponeType.OnRspQryOrder);
                qd.Sender = this;
                qd.Data1 = cls;
                qd.Data2 = size1;
                qd.Data3 = bIsLast;

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryOrder(this, ref cls, size1, bIsLast);
            }
        }
示例#4
0
        private void OnRtnOrder_callback(object sender, ref OrderField order)
        {
            OrderField field = order;

            OrderClass cls = new OrderClass();

            cls.InstrumentName = field.InstrumentName();
            cls.Symbol         = field.Symbol;
            cls.InstrumentID   = field.InstrumentID;
            cls.ExchangeID     = field.ExchangeID;
            cls.ClientID       = field.ClientID;
            cls.AccountID      = field.AccountID;
            cls.Side           = (int)field.Side;
            cls.Side_String    = Enum <XAPI.OrderSide> .ToString(field.Side);

            cls.Qty              = field.Qty;
            cls.Price            = field.Price;
            cls.OpenClose        = (int)field.OpenClose;
            cls.OpenClose_String = Enum <XAPI.OpenCloseType> .ToString(field.OpenClose);

            cls.HedgeFlag        = (int)field.HedgeFlag;
            cls.HedgeFlag_String = Enum <XAPI.HedgeFlagType> .ToString(field.HedgeFlag);

            cls.Date        = field.Date;
            cls.Time        = field.Time;
            cls.ID          = field.ID;
            cls.OrderID     = field.OrderID;
            cls.LocalID     = field.LocalID;
            cls.Type        = (int)field.Type;
            cls.Type_String = Enum <XAPI.OrderType> .ToString(field.Type);

            cls.StopPx             = field.StopPx;
            cls.TimeInForce        = (int)field.TimeInForce;
            cls.TimeInForce_String = Enum <XAPI.TimeInForce> .ToString(field.TimeInForce);

            cls.Status        = (int)field.Status;
            cls.Status_String = Enum <XAPI.OrderStatus> .ToString(field.Status);

            cls.ExecType        = (int)field.ExecType;
            cls.ExecType_String = Enum <XAPI.ExecType> .ToString(field.ExecType);

            cls.LeavesQty     = field.LeavesQty;
            cls.CumQty        = field.CumQty;
            cls.AvgPx         = field.AvgPx;
            cls.XErrorID      = field.XErrorID;
            cls.RawErrorID    = field.RawErrorID;
            cls.Text          = field.Text();
            cls.ReserveInt32  = field.ReserveInt32;
            cls.ReserveChar64 = field.ReserveChar64;

            if (null == OnRtnOrder)
            {
                QueueData qd = new QueueData();
                qd.Type        = (int)ResponeType.OnRtnOrder;
                qd.Type_String = Enum <XAPI.ResponeType> .ToString(ResponeType.OnRtnOrder);

                qd.Sender = this;
                qd.Data1  = cls;

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRtnOrder(this, ref cls);
            }
        }