Пример #1
0
        private async Task saveEODdata(string data) // convert to json
        {
            try
            {
                EndOfDayData eodData  = EndOfDayData.Deserialize(data);
                bool         idExists = _stockScreenerService.EODIdExists(eodData.Id);

                if (idExists)
                {
                    await _stockScreenerService.UpdateEODdata(eodData.Id, eodData);
                }

                _stockScreenerService.Create(eodData);
            }
            catch (Exception ex)
            {
                if (ex is System.ArgumentNullException || ex is System.TimeoutException)
                {
                    Console.WriteLine("Exception " + ex);
                }

                Console.WriteLine("Exception " + ex);
            }

            await Task.Delay(100);

            // Indicate lock stream
            await _stockHandler.Clients.All.lockStream(serviceWorker.API_REQUESTS, true);
        }