public BarSeries GetHistoricalBars(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2, BarType barType, long barSize) { if (provider.IsDisconnected) { provider.Connect(); } DataManager.DataNotifier @class = new DataManager.DataNotifier(); string text = Guid.NewGuid().ToString(); lock (this.dictionary_0) { this.dictionary_0.Add(text, @class); } provider.Send(new HistoricalDataRequest(instrument, dateTime1, dateTime2, 6) { RequestId = text, BarType = new BarType?(barType), BarSize = new long?(barSize) }); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) { this.dictionary_0.Remove(text); } var bs = new BarSeries("", "", -1, -1); foreach (var data in @class.Data) { var objs = data.Objects; for (int i = 0; i < objs.Length; i++) { bs.Add((Bar)objs[i]); } } return(bs); }
public BarSeries GetHistoricalBars(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2, BarType barType, long barSize) { if (provider.IsDisconnected) provider.Connect(); DataManager.DataNotifier @class = new DataManager.DataNotifier(); string text = Guid.NewGuid().ToString(); lock (this.dictionary_0) { this.dictionary_0.Add(text, @class); } provider.Send(new HistoricalDataRequest(instrument, dateTime1, dateTime2, 6) { RequestId = text, BarType = new BarType?(barType), BarSize = new long?(barSize) }); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) { this.dictionary_0.Remove(text); } var bs = new BarSeries("", "", -1, -1); foreach (var data in @class.Data) { var objs = data.Objects; for (int i = 0; i < objs.Length; i++) bs.Add((Bar)objs[i]); } return bs; }