Example #1
0
        public async Task Invoke(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Invoked timercoinmarket");
            try
            {
                _logger.LogInformation(NoticeStore.NoticesCoinMarket.Count.ToString());
                _logger.LogInformation(CurrencyInfoStore.CoinMarkets.Count.ToString());

                NoticeStore.ClearCoinMarket();

                //_alertRepository.DeleteMany(x=> x.NotifyCost == null && string.IsNullOrEmpty(x.PercentNotify));

                var users = _userRepository.GetItems(z => z.NotifyCoinMarket).ToList(); //+

                var currencyPairs = await _client.GetCoinMarket();

                CurrencyInfoStore.AddCoinMarket(currencyPairs);

                var notifications = _currencyService
                                    .CreateNotifications(users, CurrencyInfoStore.CoinMarkets, 2, _alertRepository);

                await _notifyer.Notify(notifications);
            }
            catch (Exception e)
            {
                _logger.LogError("Timer coinmarket", e.Message);
            }
        }
Example #2
0
        public async Task Invoke(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Invoked timerbittrex");
            try
            {
                _logger.LogInformation(NoticeStore.NoticesBittrix.Count.ToString());
                _logger.LogInformation(CurrencyInfoStore.Bittrixes.Count.ToString());

                NoticeStore.ClearBittrix();

                var users         = _userRepository.GetItems(x => x.NotifyBittrix).ToList();
                var currencyPairs = await _client.GetBittrix();

                CurrencyInfoStore.AddBittrix(currencyPairs);

                var notifications =
                    _currencyService.CreateNotifications(users, CurrencyInfoStore.Bittrixes, 0, _alertRepository);

                await _notifyer.Notify(notifications);
            }
            catch (Exception e)
            {
                _logger.LogError("Timer bittriex", e.Message);
            }
        }