public override Bars RequestData(DataSource ds, string symbol, DateTime startDate, DateTime endDate, int maxBars, bool includePartialBar) { Bars bars = new Bars(symbol, ds.Scale, ds.BarInterval); List <SymbolDescription> symbolDescriptions = SymbolDescription.DeserializeList(ds.DSString); SymbolDescription description = symbolDescriptions.Find(x => x.FullCode == symbol); if (description != null && OnDemandUpdate) { _dataStore.LoadBarsObject(bars); DateTime currentDate = DateTime.Now; try { string suffix = GetSuffix(ds.BarDataScale); int correction = 0; bars.AppendWithCorrections(GetHistory(ds.BarDataScale, description.FullCode, suffix), out correction); } catch (Exception exception) { logger.Error(exception); MessageBox.Show(string.Format("[{0}] {1}", symbol, exception.Message), "Внимание! Произошла ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (bars.Count > 0 && bars.Date[bars.Count - 1] > currentDate && !includePartialBar) { bars.Delete(bars.Count - 1); } if (!base.IsStreamingRequest) { lock (_locker) _dataStore.SaveBarsObject(bars); } } else { _dataStore.LoadBarsObject(bars, startDate, endDate, maxBars); } return(bars); }