예제 #1
0
 public void PopulateRealtimeStocksQuotes()
 {
     lock (RealTimeStocksQuotesLocker)
     {
         try
         {
             List <StockQuoteInfo> stockQuotesInfo = MarketDataProvider.GetStockQuotesInfo();
             _stocksQuoteInfo = _uow.StockQuotesInfo.GetAll().ToList();
             _uow.StockQuotesInfo.Update(stockQuotesInfo, _stocksQuoteInfo);
         }
         catch (System.IO.FileNotFoundException exFileNotFound)
         {
             Logger.Debug(exFileNotFound.StackTrace.ToString());
         }
         catch (System.IO.IOException exIO)
         {
             Logger.Debug(exIO.StackTrace.ToString());
         }
     }
 }
예제 #2
0
        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());
                }
            }
        }
예제 #3
0
        public void PopulateStocksPerMinutesQuotes(string StockNameList)
        {
            lock (RealTimeStocksPerMinuteQuotesLocker)
            {
                List <string> StockNamedListResult = new List <string>();
                if (StockNameList.Contains(","))
                {
                    StockNamedListResult = StockNameList.Split(new char[] { ',' }).ToList();
                }
                else
                {
                    StockNamedListResult.Add(StockNameList);
                }

                // List<string> StockNamedListResult=StockNameList.Split(new char[]{','}).ToList();

                try
                {
                    Logger.Debug("Getting StockQuotesInfoPerMinute:StockNameListtest=" + StockNamedListResult.Count());

                    List <StockQuoteInfo> list = MarketDataProvider.GetStockQuotesInfo().Where(p => StockNamedListResult.Contains(p.SecurityCode)).ToList();


                    Logger.Debug("Saving StockQuotesInfoPerMinute");
                    _uow.StockQuotePerMinuteRepository.Add(list);
                }
                catch (System.IO.FileNotFoundException exFileNotFound)
                {
                    Logger.Debug(exFileNotFound.StackTrace.ToString());
                }
                catch (System.IO.IOException exIO)
                {
                    Logger.Debug(exIO.StackTrace.ToString());
                }
            }
        }