Beispiel #1
0
        private async void ActionAsync(object sender, ElapsedEventArgs e)
        {
            _logger.Info("Timer_Elapsed: " + DateTime.Now);

            var stocks = await _stockWebReader.GetCurrentStocksAsync();

            if (stocks == null)
            {
                _logger.Error("MarketState=Closed");
                _stockTicker.MarketState = MarketState.Closed;
            }
            else
            {
                _logger.Info("MarketState=Opened");
                _stockTicker.MarketState = MarketState.Opened;

                bool updated = _stockService.AddStockValuesForExistingStocksIfNewer(stocks);
                if (updated)
                {
                    _stockTicker.BroadcastStocks();
                }
            }
        }