public Symbol(TicksManager ticksManager) { _ticksManager = ticksManager; _name = ticksManager.Name; _digits = ticksManager.Digits; _point = Convert.ToSingle(Math.Pow(0.1, _digits)); }
public ISymbol Create(string symbolName, int digits) { Symbol symbol = this[symbolName] as Symbol; if (symbol != null) { return(symbol); } TicksManager tm = new TicksManager(); tm.History = new TicksFileData(_dirHistory, symbolName, digits); tm.Cache = new TicksFileData(_dirCache, symbolName, digits); BarsFolder barsFolderHistory = new BarsFolder(_dirHistory); BarsFolder barsFolderCache = new BarsFolder(_dirCache); MapsFolder mapsFolderHistory = new MapsFolder(_dirHistory); MapsFolder mapsFolderCache = new MapsFolder(_dirCache); tm.InitializeBarsFiles(barsFolderHistory, barsFolderCache); tm.InitializeMapsFiles(mapsFolderHistory, mapsFolderCache); symbol = new Symbol(tm); return(symbol); }
public BarsManager(TicksManager owner) { _owner = owner; _session = owner.Session; foreach (TimeFrame timeFrame in TimeFrameManager.TimeFrames) { BarManager barManager = new BarManager(this, timeFrame); _bars.Add(timeFrame.Second, barManager); } }
public TicksFileMapDataCacher(TicksManager ticksManager, bool isHistory, TicksFileMapData currentBFD) { _ticksManager = ticksManager; _currentBFD = currentBFD; _symbolName = ticksManager.Name; _isHistory = isHistory; _directory = isHistory ? ticksManager.DirectoryMapsHistory : ticksManager.DirectoryMapsCache; string fn = string.Format(@"{0}\{1}.gmp.tmp", _directory, _symbolName); FileInfo file = new FileInfo(fn); if (file.Exists) { file.Delete(); } _newBFD = new TicksFileMapData(file); }
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); }
public TicksMapManager(TicksManager owner) { _owner = owner; }
public void Load() { List <FileInfo> filesHistory = new List <FileInfo>(); List <FileInfo> filesCache = new List <FileInfo>(); Dictionary <string, TicksManager> symbols = new Dictionary <string, TicksManager>(); FileInfo[] files = _dirHistory.GetFiles("*." + TICKS_FILE_EXT); foreach (FileInfo file in files) { try { TicksManager ticksManager = new TicksManager(); ticksManager.History = new TicksFileData(file); symbols.Add(ticksManager.Name, ticksManager); } catch (Exception e) { Trace.TraceError("Load {0} - {1}", file.FullName, e.Message); } } files = _dirCache.GetFiles("*." + TICKS_FILE_EXT); foreach (FileInfo file in files) { try { TicksManager ticksManager = null; TicksFileData fileData = new TicksFileData(file); symbols.TryGetValue(fileData.SymbolName, out ticksManager); if (ticksManager == null) { ticksManager = new TicksManager(); symbols.Add(fileData.SymbolName, ticksManager); } ticksManager.Cache = fileData; } catch (Exception e) { Trace.TraceError("Load {0} - {1}", file.FullName, e.Message); } } BarsFolder barsFolderHistory = new BarsFolder(_dirHistory); BarsFolder barsFolderCache = new BarsFolder(_dirCache); MapsFolder mapsFolderHistory = new MapsFolder(_dirHistory); MapsFolder mapsFolderCache = new MapsFolder(_dirCache); this.Clear(); foreach (TicksManager ticks in symbols.Values) { if (ticks.History == null) { ticks.History = new TicksFileData(_dirHistory, ticks.Name, ticks.Digits); } if (ticks.Cache == null) { ticks.Cache = new TicksFileData(_dirCache, ticks.Name, ticks.Digits); } ticks.InitializeBarsFiles(barsFolderHistory, barsFolderCache); ticks.InitializeMapsFiles(mapsFolderHistory, mapsFolderCache); Symbol symbol = new Symbol(ticks); this.Add(symbol); } barsFolderHistory.DeleteEmpty(); barsFolderCache.DeleteEmpty(); }