Example #1
0
        private void OnRtnDepthMarketData_callback(object sender, [In] ref XAPI.DepthMarketDataNClass marketData)
        {
            DepthMarketDataNClass cls = new DepthMarketDataNClass();

            XAPI.DepthMarketDataNClass field = marketData;

            cls.TradingDay          = field.TradingDay;
            cls.ActionDay           = field.ActionDay;
            cls.UpdateTime          = field.UpdateTime;
            cls.UpdateMillisec      = field.UpdateMillisec;
            cls.Exchange            = (int)field.Exchange;
            cls.Symbol              = field.Symbol;
            cls.InstrumentID        = field.InstrumentID;
            cls.ExchangeID          = field.ExchangeID;
            cls.LastPrice           = field.LastPrice;
            cls.Volume              = field.Volume;
            cls.Turnover            = field.Turnover;
            cls.OpenInterest        = field.OpenInterest;
            cls.AveragePrice        = field.AveragePrice;
            cls.OpenPrice           = field.OpenPrice;
            cls.HighestPrice        = field.HighestPrice;
            cls.LowestPrice         = field.LowestPrice;
            cls.ClosePrice          = field.ClosePrice;
            cls.SettlementPrice     = field.SettlementPrice;
            cls.UpperLimitPrice     = field.UpperLimitPrice;
            cls.LowerLimitPrice     = field.LowerLimitPrice;
            cls.PreClosePrice       = field.PreClosePrice;
            cls.PreSettlementPrice  = field.PreSettlementPrice;
            cls.PreOpenInterest     = field.PreOpenInterest;
            cls.TradingPhase        = (int)field.TradingPhase;
            cls.TradingPhase_String = Enum <XAPI.TradingPhaseType> .ToString(field.TradingPhase);

            if (field.Bids != null && field.Bids.Length > 0)
            {
                cls.BidPrice1 = field.Bids[0].Price;
                cls.BidSize   = field.Bids[0].Size;
            }

            if (field.Asks != null && field.Asks.Length > 0)
            {
                cls.AskPrice1 = field.Asks[0].Price;
                cls.AskSize   = field.Asks[0].Size;
            }

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

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

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRtnDepthMarketData(this, cls);
            }
        }
Example #2
0
        private void OnRtnDepthMarketData_callback(object sender, ref XAPI.DepthMarketDataNClass marketData)
        {
            DepthMarketDataNClass cls = new DepthMarketDataNClass();
            XAPI.DepthMarketDataNClass field = marketData;

            cls.TradingDay = field.TradingDay;
            cls.ActionDay = field.ActionDay;
            cls.UpdateTime = field.UpdateTime;
            cls.UpdateMillisec = field.UpdateMillisec;
            cls.Exchange = (int)field.Exchange;
            cls.Symbol = field.Symbol;
            cls.InstrumentID = field.InstrumentID;
            cls.ExchangeID = field.ExchangeID;
            cls.LastPrice = field.LastPrice;
            cls.Volume = field.Volume;
            cls.Turnover = field.Turnover;
            cls.OpenInterest = field.OpenInterest;
            cls.AveragePrice = field.AveragePrice;
            cls.OpenPrice = field.OpenPrice;
            cls.HighestPrice = field.HighestPrice;
            cls.LowestPrice = field.LowestPrice;
            cls.ClosePrice = field.ClosePrice;
            cls.SettlementPrice = field.SettlementPrice;
            cls.UpperLimitPrice = field.UpperLimitPrice;
            cls.LowerLimitPrice = field.LowerLimitPrice;
            cls.PreClosePrice = field.PreClosePrice;
            cls.PreSettlementPrice = field.PreSettlementPrice;
            cls.PreOpenInterest = field.PreOpenInterest;
            cls.TradingPhase = (int)field.TradingPhase;
            cls.TradingPhase_String = Enum<XAPI.TradingPhaseType>.ToString(field.TradingPhase);
            //cls.Bids = marketData.TradingDay;
            //cls.TradingDay = marketData.TradingDay;

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

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