예제 #1
0
        public async Task Run()
        {
            try
            {
                // Start watch
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                // Run
                var currencies = await _currencyService.ImportCurrencies();

                var indicators = await _indicatorService.UpdateDependencyLevels();

                var lines = await _lineService.AddNewLines(currencies, indicators);

                var defaultWatchers = await _watcherService.UpdateDefaultWatchers(lines);

                var watchers = await _watcherService.UpdateWatchers(defaultWatchers);

                var orders = await _orderService.AddOrders(watchers);

                orders = await _orderService.ProcessOrders(orders, watchers);

                var notifications = await _notificationService.AddNotifications(orders);

                await _notificationService.SendTelegramNotifications(notifications);

                await _lineService.RemoveObsoleteLines();

                // Stop watch
                stopwatch.Stop();

                // Log
                _logger.LogInformation("{@Event}, {@ExecutionTime}", "MainJobFinished", stopwatch.Elapsed.TotalSeconds);
            }
            catch (Exception ex)
            {
                // Log
                _logger.LogError(ex, ex.Message);
            }
        }