Esempio n. 1
0
        public void Check()
        {
            var currencies = _currencyRepository.GetCurrencies().ToDictionary(e => e.Name);

            foreach (var trigger in _triggerRepository.GetAll <PriceCryptoTrigger>())
            {
                var currency = currencies[trigger.Currency];

                var condition = trigger.Operator == CurrencyOperator.MoreThan
                    ? trigger.Price <currency.PriceUsd
                                     : trigger.Price> currency.PriceUsd;

                if (condition)
                {
                    _telegramApiService.SendAboutPriceTrigger(trigger, currency);
                    _triggerRepository.Delete <PriceCryptoTrigger>(trigger.Id);
                }
            }
        }