private void FireTrade(int InstrumentId,DateTime _dateTime, DateTime _exchangeDateTime, DepthMarketDataNClass pDepthMarketData,DepthMarketDataNClass DepthMarket)
        {
            //行情过来时是今天累计成交量,得转换成每个tick中成交量之差
            double volume = pDepthMarketData.Volume - DepthMarket.Volume;
            // 以前第一条会导致集合竞价后的第一条没有成交量,这种方法就明确了上一笔是空数据
            if (0 == DepthMarket.TradingDay && 0 == DepthMarket.ActionDay)
            {
                //没有接收到最开始的一条,所以这计算每个Bar的数据时肯定超大,强行设置为0
                volume = 0;
            }
            else if (volume < 0)
            {
                //如果隔夜运行,会出现今早成交量0-昨收盘成交量,出现负数,所以当发现为负时要修改
                volume = pDepthMarketData.Volume;
            }

            // 使用新的类,保存更多信息
            var trade = new TradeEx(
                _dateTime,
                _exchangeDateTime,
                this.id,
                InstrumentId,
                pDepthMarketData.LastPrice,
                (int) volume) {DepthMarketData = pDepthMarketData};

            // 启用底层数据上传

            EmitData(trade);
        }
        public void OutputSeries(out IDataSeries trades, out IDataSeries bids, out IDataSeries asks)
        {
            trades = new TickSeries();
            bids = new TickSeries();
            asks = new TickSeries();

            PbTickCodec codec = new PbTickCodec();
            int TradingDay = -1;
            int _lastTradeSize = 0;
            foreach (var s in Series)
            {
                if(TradingDay != s.TradingDay)
                {
                    _lastTradeSize = 0;
                    TradingDay = s.TradingDay;
                }
                var dateTime = codec.GetDateTime(s.ActionDay == 0 ? s.TradingDay : s.ActionDay).Add(codec.GetUpdateTime(s));
                var tick = PbTick2DepthMarketDataNClass(codec, s);

                if(SubscribeExternData)
                {
                    var trade = new TradeEx(dateTime, 0, _InstrumentId, tick.LastPrice, (int)tick.Volume);
                    trade.Size -= _lastTradeSize;
                    trade.DepthMarketData = tick;
                    trades.Add(trade);
                }
                else
                {
                    var trade = new Trade(dateTime, 0, _InstrumentId, tick.LastPrice, (int)tick.Volume);
                    trade.Size -= _lastTradeSize;
                    trades.Add(trade);
                }


                if (tick.Bids != null && tick.Bids.Length > 0)
                {
                    var bid = new Bid(dateTime, 0, _InstrumentId, tick.Bids[0].Price, tick.Bids[0].Size);
                    bids.Add(bid);
                }
                if (tick.Asks != null && tick.Asks.Length > 0)
                {
                    var ask = new Ask(dateTime, 0, _InstrumentId, tick.Asks[0].Price, tick.Asks[0].Size);
                    asks.Add(ask);
                }

                _lastTradeSize = (int)tick.Volume;
            }
        }