HistoryManagerAdapter GetOrCreateHistoryManagerAdapter(string symbol) { HistoryManagerAdapter result; lock (this.synchronizer) { if (!this.symbol2cache.TryGetValue(symbol, out result)) { var symbols = new HashSet <ISymbolProperties> { new SymbolProperties(symbol) }; var storageVersion = this.storageVersion; if (this.historyFeed != null) { storageVersion = this.historyFeed.Server.GetQuotesHistoryVersion(); } var provider = HistoryManager.Create( storageVersion, this.store, symbols, DataFeedStorage.GetSupportedPeriodicityToStoreLevel(this.storageVersion), this.saveTickLevel2History, Cache.ClientInstance(Guid.NewGuid().ToString()), true, this.flushOnDispose, NullMonitoringService, NullMonitoringItem); result = new HistoryManagerAdapter(provider); this.symbol2cache[symbol] = result; } } return(result); }
/// <summary> /// /// </summary> /// <param name="symbol"></param> /// <param name="from"></param> /// <param name="to"></param> public void RebuildBarsFromBars(string symbol, string from, string to) { var start = DateTime.MinValue.AddYears(1); var finish = DateTime.MaxValue.AddYears(-1); try { var periodicities = new[] { Periodicity.Parse(from), Periodicity.Parse(to), }; var writer = BulkHistoryWriter.Create(this.store, DataFeedStorage.GetSupportedPeriodicityToStoreLevel(this.storageVersion), NullMonitoringService); writer.RebuildBarsFromBars(symbol, FxPriceType.Bid, start, finish, periodicities); writer.RebuildBarsFromBars(symbol, FxPriceType.Ask, start, finish, periodicities); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public Dictionary <Periodicity, TimeInterval> GetSupportedBarPeriodicities(string symbol) { return(DataFeedStorage.GetSupportedPeriodicityToStoreLevel(this.dataFeed.Server.GetQuotesHistoryVersion())); }