public BarProvider(DateTime tradingday, BarProviderInfo prdinfo, BarSeries barlist)
        {
            TradingDay = tradingday;
            _prdinfo   = prdinfo;

            _lstslice = CreateDateTimeSlice(tradingday, _prdinfo.Lstslice);

            if (barlist != null && barlist.Count > 0)
            {
                #region

                _bars.AddRange(barlist);

                int i = 0;
                for (; i < _lstslice.Count; ++i)
                {
                    if (barlist.Last.EndTime < _lstslice[i].BeginTime)
                    {
                        _posBar  = i - 1;
                        _posTime = i;
                        break;
                    }
                    else if (barlist.Last.EndTime == _lstslice[i].BeginTime)
                    {
                        if (barlist.Last.BeginTime < _lstslice[i].BeginTime)
                        {
                            _posBar  = i - 1;
                            _posTime = i;
                            break;
                        }
                        else if (barlist.Last.BeginTime == _lstslice[i].BeginTime)
                        {
                            _posBar  = i;
                            _posTime = i;
                            break;
                        }
                    }
                    else if (barlist.Last.EndTime < _lstslice[i].EndTime)
                    {
                        _posBar  = i;
                        _posTime = i;
                        break;
                    }
                }

                if (i == _lstslice.Count)
                {
                    _posTime = _lstslice.Count;
                    _posBar  = i;
                }

                #endregion
            }
        }
        public BarProvider(DateTime tradingday, BarProviderInfo prdinfo)
        {
            TradingDay = tradingday;

            if (prdinfo != null)
            {
                _prdinfo = prdinfo;

                _lstslice = CreateDateTimeSlice(tradingday, _prdinfo.Lstslice);
            }
            else
            {
                _logger.Error("BarProvider构造函数传入BarProviderInfo为NULL");
            }
        }
        public static BarProvider Create(DateTime tradeDay, InstrumentManager instmgr, string instid, int offset,
                                         int interval, EnumBarType bartype, BarSeries barlist)
        {
            List <TimeSlice> tradingtime = instmgr.GetTradingTime(tradeDay, instid);
            BarProviderInfo  prdinfo     = BaseBarHelper.Instance.GetBarProviderInfo(tradingtime, offset, interval, bartype);

            if (barlist != null)
            {
                return(new BarProvider(tradeDay, prdinfo, barlist));
            }
            else
            {
                return(new BarProvider(tradeDay, prdinfo));
            }
        }