public void PopulateRealtimeOptionsQuotes() { lock (RealTimeOptionsQuotesLocker) { try { Logger.Debug("option quots info start"); List <OptionQuoteInfo> optionQuotesInfo = MarketDataProvider.GetOptionQuotesInfo(); Logger.Debug("the item count of List Generic is:" + optionQuotesInfo.Count); _optionsQuoteInfo = _uow.OptionQuotesInfo.GetAll().ToList(); _uow.OptionQuotesInfo.Update(optionQuotesInfo, _optionsQuoteInfo); Logger.Debug("option quots info end"); } catch (System.IO.FileNotFoundException exFileNotFound) { Logger.Debug(exFileNotFound.StackTrace.ToString()); } catch (System.IO.IOException exIO) { Logger.Debug(exIO.StackTrace.ToString()); } catch (Exception ex) { Logger.Debug(ex.StackTrace.ToString()); } } }
public void PopulateRealTimeQuotes() { lock (Locker) { try { Task populateOptionQuotesInfo = new Task(() => { Logger.Debug("Getting OptionQuotesInfo"); List <OptionQuoteInfo> optionQuotesInfo = MarketDataProvider.GetOptionQuotesInfo(); Logger.Debug("Saving OptionQuotesInfo"); _optionsQuoteInfo = _uow.OptionQuotesInfo.GetAll().ToList(); _uow.OptionQuotesInfo.Update(optionQuotesInfo, _optionsQuoteInfo); }); populateOptionQuotesInfo.Start(); Task populateStockQuotesInfo = new Task(() => { Logger.Debug("Getting StockQuotesInfo"); List <StockQuoteInfo> stockQuotesInfo = MarketDataProvider.GetStockQuotesInfo(); Logger.Debug("Saving StockQuotesInfo"); _stocksQuoteInfo = _uow.StockQuotesInfo.GetAll().ToList(); _uow.StockQuotesInfo.Update(stockQuotesInfo, _stocksQuoteInfo); }); populateStockQuotesInfo.Start(); //Task.WaitAll(populateStockQuotesInfo); Task.WaitAll(populateOptionQuotesInfo, populateStockQuotesInfo); } catch (System.IO.FileNotFoundException exFileNotFound) { Logger.Debug(exFileNotFound.StackTrace.ToString()); } catch (System.IO.IOException exIO) { Logger.Debug(exIO.StackTrace.ToString()); } } }