Ejemplo n.º 1
0
        private void Check(bool isHistory, BarsFolder barsFolder)
        {
            TicksFileData ticksFileData = isHistory ? _history : _cache;

            BarsFileData[]      barsFiles  = barsFolder.Pop(_symbolName);
            List <BarsFileData> listDelete = new List <BarsFileData>();

            foreach (BarsFileData barsFile in barsFiles)
            {
                if (ticksFileData.Count == barsFile.CountTicks)
                {
                    BarManager bm = (BarManager)this._barsManager[barsFile.TimeFrameSecond];
                    if (bm == null)
                    {
                        listDelete.Add(barsFile);
                    }
                    else
                    {
                        if (isHistory)
                        {
                            bm.History = barsFile;
                        }
                        else
                        {
                            bm.Cache = barsFile;
                        }
                    }
                }
                else
                {
                    listDelete.Add(barsFile);
                }
            }
            foreach (BarsFileData barsFile in listDelete)
            {
                barsFile.CloseStream();
                barsFile.File.Delete();
            }
        }
Ejemplo n.º 2
0
        public BarsFileDataCacher(TicksManager ticksManager, BarManager bm,
                                  bool isHistory,
                                  BarsFileData currentBFD,
                                  TimeFrame timeFrame)
        {
            _bm                  = bm;
            _ticksManager        = ticksManager;
            _currentBarsFileData = currentBFD;
            _timeFrame           = timeFrame;
            _symbolName          = ticksManager.Name;
            _digits              = ticksManager.Digits;
            _tfsec               = timeFrame.Second;
            _isHistory           = isHistory;
            _directory           = isHistory ? ticksManager.DirectoryBarsHistory : ticksManager.DirectoryBarsCache;

            string   fn   = string.Format(@"{0}\{1}{2}.gtf.tmp", _directory, _symbolName, _timeFrame.Second);
            FileInfo file = new FileInfo(fn);

            if (file.Exists)
            {
                file.Delete();
            }
            _newBarsFileData = new BarsFileData(file);
        }