public ApplicationDbContext( DbContextOptions options, DataNotifier dataNotifier, IOptions <OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions) { _dataNotifier = dataNotifier; }
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 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 DataUpdatesHub(DataNotifier dataNotifier) { _dataNotifier = dataNotifier; }
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 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; }