示例#1
0
        private void OnRspQryTrade_callback(object sender, ref TradeField trade, int size1, bool bIsLast)
        {
            if (null == OnRspQryTrade)
            {
                return;
            }

            TradeClass cls = null;

            if (size1 > 0)
            {
                TradeField field = trade;

                cls = new TradeClass();

                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.TradeID       = field.TradeID;
                cls.ReserveInt32  = field.ReserveInt32;
                cls.ReserveChar64 = field.ReserveChar64;
            }

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

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

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryTrade(this, ref cls, size1, bIsLast);
            }
        }
示例#2
0
文件: XApiCom.cs 项目: mlken/XAPI2
        private void OnRtnTrade_callback(object sender, [In] ref TradeField trade)
        {
            if (null == OnRtnTrade)
            {
                return;
            }

            TradeField field = trade;

            TradeClass cls = new TradeClass();

            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.TradeID       = field.TradeID;
            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 == OnRtnTrade)
            {
                QueueData qd = new QueueData();
                qd.Type        = (int)ResponseType.OnRtnTrade;
                qd.Type_String = Enum <XAPI.ResponseType> .ToString(ResponseType.OnRtnTrade);

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

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

            TradeClass cls = null;

            if (size1 > 0)
            {
                TradeField field = trade;

                cls = new TradeClass();

                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.TradeID = field.TradeID;
                cls.ReserveInt32 = field.ReserveInt32;
                cls.ReserveChar64 = field.ReserveChar64;
            }

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

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryTrade(this, ref cls, size1, bIsLast);
            }
        }
示例#4
0
文件: XApiCom.cs 项目: QuantBox/XAPI2
        private void OnRtnTrade_callback(object sender, [In] ref TradeField trade)
        {
            if (null == OnRtnTrade)
                return;

            TradeField field = trade;

            TradeClass cls = new TradeClass();

            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.TradeID = field.TradeID;
            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 == OnRtnTrade)
            {
                QueueData qd = new QueueData();
                qd.Type = (int)ResponseType.OnRtnTrade;
                qd.Type_String = Enum<XAPI.ResponseType>.ToString(ResponseType.OnRtnTrade);
                qd.Sender = this;
                qd.Data1 = cls;

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