//void Subscribe(Instrument instrument, DateTime dateTime1, DateTime dateTime2)
        //{
        //    Console.WriteLine("{0} {1}::Subscribe {2}", DateTime.Now, this.Name, instrument.Symbol);
        //    var info = new SubscribeInfo();
        //    info.DatePath = Path.Combine(DataPath, instrument.Symbol);
        //    info.DateTime1 = dateTime1;
        //    info.DateTime2 = dateTime2;
        //    info.InstrumentId = instrument.Id;
        //    info.SubscribeBidAsk = SubscribeBid && SubscribeAsk;
        //    info.SubscribeTrade = SubscribeTrade;

        //    var queue = new EventQueue(1, 0, 2, 0x61a8) {
        //        IsSynched = true
        //    };
        //    queue.Enqueue(new OnQueueOpened(queue));
        //    framework.EventBus.DataPipe.Add(queue);
        //    _dataSeries.Add(new DataSeriesObject(info, queue));
        //}

        void Subscribe(Instrument instrument, DateTime dateTime1, DateTime dateTime2)
        {
            Console.WriteLine("{0} {1}::Subscribe {2}", DateTime.Now, this.Name, instrument.Symbol);

            // 在这里一开始就加载完,需要一点时间,后期考虑将数据与回测结合起来使用
            ProtobufDataZeroReader reader = new ProtobufDataZeroReader();

            reader.DataPath_Instrument = DataPath_Instrument;
            reader.DataPath_Realtime   = DataPath_Realtime;

            reader.SubscribeExternData = SubscribeExternData;
            reader.SubscribeAsk        = SubscribeAsk;
            reader.SubscribeBid        = SubscribeBid;

            reader.GetDataSeries(instrument, dateTime1, dateTime2);
            IDataSeries Trades = null;
            IDataSeries Bids   = null;
            IDataSeries Asks   = null;

            if (SubscribeTrade || SubscribeBid || SubscribeAsk)
            {
                reader.OutputSeries(out Trades, out Bids, out Asks);
            }

            if (SubscribeTrade && Trades != null && Trades.Count > 0)
            {
                var queue = new EventQueue(1, 0, 2, 0x61a8)
                {
                    IsSynched = true
                };
                queue.Enqueue(new OnQueueOpened(queue));
                framework.EventBus.DataPipe.Add(queue);
                _dataSeries.Add(new DataSeriesObject(Trades, dateTime1, dateTime2, queue, this.Processor));
            }
            if (SubscribeBid && Bids != null && Bids.Count > 0)
            {
                var queue = new EventQueue(1, 0, 2, 0x61a8)
                {
                    IsSynched = true
                };
                queue.Enqueue(new OnQueueOpened(queue));
                framework.EventBus.DataPipe.Add(queue);
                _dataSeries.Add(new DataSeriesObject(Bids, dateTime1, dateTime2, queue, this.Processor));
            }
            if (SubscribeAsk && Asks != null && Asks.Count > 0)
            {
                var queue = new EventQueue(1, 0, 2, 0x61a8)
                {
                    IsSynched = true
                };
                queue.Enqueue(new OnQueueOpened(queue));
                framework.EventBus.DataPipe.Add(queue);
                _dataSeries.Add(new DataSeriesObject(Asks, dateTime1, dateTime2, queue, this.Processor));
            }
        }
        //void Subscribe(Instrument instrument, DateTime dateTime1, DateTime dateTime2)
        //{
        //    Console.WriteLine("{0} {1}::Subscribe {2}", DateTime.Now, this.Name, instrument.Symbol);
        //    var info = new SubscribeInfo();
        //    info.DatePath = Path.Combine(DataPath, instrument.Symbol);
        //    info.DateTime1 = dateTime1;
        //    info.DateTime2 = dateTime2;
        //    info.InstrumentId = instrument.Id;
        //    info.SubscribeBidAsk = SubscribeBid && SubscribeAsk;
        //    info.SubscribeTrade = SubscribeTrade;

        //    var queue = new EventQueue(1, 0, 2, 0x61a8) {
        //        IsSynched = true
        //    };
        //    queue.Enqueue(new OnQueueOpened(queue));
        //    framework.EventBus.DataPipe.Add(queue);
        //    _dataSeries.Add(new DataSeriesObject(info, queue));
        //}

        void Subscribe(Instrument instrument, DateTime dateTime1, DateTime dateTime2)
        {
            Console.WriteLine("{0} {1}::Subscribe {2}", DateTime.Now, this.Name, instrument.Symbol);

            // 在这里一开始就加载完,需要一点时间,后期考虑将数据与回测结合起来使用
            ProtobufDataZeroReader reader = new ProtobufDataZeroReader();

            reader.DataPath_Instrument = DataPath_Instrument;
            reader.DataPath_Realtime = DataPath_Realtime;

            reader.SubscribeExternData = SubscribeExternData;
            reader.SubscribeAsk = SubscribeAsk;
            reader.SubscribeBid = SubscribeBid;

            reader.GetDataSeries(instrument, dateTime1, dateTime2);
            IDataSeries Trades = null;
            IDataSeries Bids = null;
            IDataSeries Asks = null;

            if(SubscribeTrade || SubscribeBid || SubscribeAsk)
            {
                reader.OutputSeries(out Trades, out Bids, out Asks);
            }

            if (SubscribeTrade && Trades != null && Trades.Count > 0)
            {
                var queue = new EventQueue(1, 0, 2, 0x61a8)
                {
                    IsSynched = true
                };
                queue.Enqueue(new OnQueueOpened(queue));
                framework.EventBus.DataPipe.Add(queue);
                _dataSeries.Add(new DataSeriesObject(Trades, dateTime1, dateTime2, queue, this.Processor));
            }
            if (SubscribeBid && Bids != null && Bids.Count > 0)
            {
                var queue = new EventQueue(1, 0, 2, 0x61a8)
                {
                    IsSynched = true
                };
                queue.Enqueue(new OnQueueOpened(queue));
                framework.EventBus.DataPipe.Add(queue);
                _dataSeries.Add(new DataSeriesObject(Bids, dateTime1, dateTime2, queue, this.Processor));
            }
            if (SubscribeAsk && Asks != null && Asks.Count > 0)
            {
                var queue = new EventQueue(1, 0, 2, 0x61a8)
                {
                    IsSynched = true
                };
                queue.Enqueue(new OnQueueOpened(queue));
                framework.EventBus.DataPipe.Add(queue);
                _dataSeries.Add(new DataSeriesObject(Asks, dateTime1, dateTime2, queue, this.Processor));
            }
        }