public QuoteSeries GetHistoricalQuotes(IHistoricalDataProvider provider, Instrument instrument, DateTime datetime1, DateTime datetime2) { if (provider.IsDisconnected) { provider.Connect(); } DataNotifier @class = new DataNotifier(); string text = Guid.NewGuid().ToString(); lock (this.dictionary_0) this.dictionary_0.Add(text, @class); provider.Send(new HistoricalDataRequest(instrument, datetime1, datetime2, DataObjectType.Quote) { RequestId = text }); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) this.dictionary_0.Remove(text); var qs = new QuoteSeries(""); foreach (var data in @class.Data) { var objs = data.Objects; for (int i = 0; i < objs.Length; i++) { qs.Add((Quote)objs[i]); } } return(qs); }
public TickSeries GetHistoricalTicks(IHistoricalDataProvider provider, TickType type, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { if (provider.IsDisconnected) { provider.Connect(); } DataNotifier @class = new DataNotifier(); string text = Guid.NewGuid().ToString(); lock (this.dictionary_0) { this.dictionary_0.Add(text, @class); } HistoricalDataRequest request = null; switch (type) { case TickType.Bid: request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Bid); break; case TickType.Ask: request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Ask); break; case TickType.Trade: request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Trade); break; } request.RequestId = text; provider.Send(request); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) { this.dictionary_0.Remove(text); } var ts = new TickSeries("", ""); foreach (var data in @class.Data) { var objs = data.Objects; foreach (var tick in objs) { ts.Add((Tick)tick); } } return(ts); }
public TickSeries GetHistoricalTrades(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { HistoricalDataRequest request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, 4); provider.Send(request); this.handle = new ManualResetEventSlim(false); this.handle.Wait(); TickSeries tickSeries = new TickSeries(""); if (this.historicalData != null) { foreach (HistoricalData current in this.historicalData) { DataObject[] objects = current.Objects; for (int i = 0; i < objects.Length; i++) { DataObject dataObject = objects[i]; tickSeries.Add((Trade)dataObject); } } } this.historicalData = null; return tickSeries; }
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 List <Fundamental> GetHistoricalFundamentals(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { if (provider.IsDisconnected) { provider.Connect(); } var @class = new DataNotifier(); var guid = Guid.NewGuid().ToString(); lock (this.dictionary_0) { this.dictionary_0.Add(guid, @class); } provider.Send(new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Fundamental) { RequestId = guid }); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) { this.dictionary_0.Remove(guid); } return(@class.Data.SelectMany(current => current.Objects).Cast <Fundamental>().ToList()); }
public TickSeries GetHistoricalTrades(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { HistoricalDataRequest request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, 4); provider.Send(request); this.handle = new ManualResetEventSlim(false); this.handle.Wait(); TickSeries tickSeries = new TickSeries(""); if (this.historicalData != null) { foreach (HistoricalData current in this.historicalData) { DataObject[] objects = current.Objects; for (int i = 0; i < objects.Length; i++) { DataObject dataObject = objects[i]; tickSeries.Add((Trade)dataObject); } } } this.historicalData = null; return(tickSeries); }
public QuoteSeries GetHistoricalQuotes(IHistoricalDataProvider provider, Instrument instrument, DateTime datetime1, DateTime datetime2) { if (provider.IsDisconnected) provider.Connect(); DataNotifier @class = new DataNotifier(); string text = Guid.NewGuid().ToString(); lock (this.dictionary_0) this.dictionary_0.Add(text, @class); provider.Send(new HistoricalDataRequest(instrument, datetime1, datetime2, DataObjectType.Quote) { RequestId = text }); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) this.dictionary_0.Remove(text); var qs = new QuoteSeries(""); foreach (var data in @class.Data) { var objs = data.Objects; for (int i = 0; i < objs.Length; i++) qs.Add((Quote)objs[i]); } return qs; }
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 List<Fundamental> GetHistoricalFundamentals(IHistoricalDataProvider provider, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { if (provider.IsDisconnected) { provider.Connect(); } var @class = new DataNotifier(); var guid = Guid.NewGuid().ToString(); lock (this.dictionary_0) { this.dictionary_0.Add(guid, @class); } provider.Send(new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Fundamental) { RequestId = guid }); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) { this.dictionary_0.Remove(guid); } return @class.Data.SelectMany(current => current.Objects).Cast<Fundamental>().ToList(); }
public TickSeries GetHistoricalTicks(IHistoricalDataProvider provider, TickType type, Instrument instrument, DateTime dateTime1, DateTime dateTime2) { if (provider.IsDisconnected) provider.Connect(); DataNotifier @class = new DataNotifier(); string text = Guid.NewGuid().ToString(); lock (this.dictionary_0) { this.dictionary_0.Add(text, @class); } HistoricalDataRequest request = null; switch (type) { case TickType.Bid: request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Bid); break; case TickType.Ask: request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Ask); break; case TickType.Trade: request = new HistoricalDataRequest(instrument, dateTime1, dateTime2, DataObjectType.Trade); break; } request.RequestId = text; provider.Send(request); @class.ReadyEvent.WaitOne(); lock (this.dictionary_0) { this.dictionary_0.Remove(text); } var ts = new TickSeries("", ""); foreach (var data in @class.Data) { var objs = data.Objects; foreach (var tick in objs) ts.Add((Tick)tick); } return ts; }