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

            stopwatch.Start();

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

            var indicators = await _indicatorService.UpdateIndicatorDependencies();

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

            var defaultWatchers = await _watcherService.UpdateDefaultWatchers(lines);

            var watchers = await _watcherService.UpdateWatchers(defaultWatchers, lines);

            await _orderService.UpdateOrders(watchers);

            //await _notificationService.CreateNotifications();
            await _notificationService.SendTelegramNotifications();

            // Stop watch
            stopwatch.Stop();

            // Log into Splunk
            _logger.LogSplunkInformation("Main", new
            {
                ExecutionTime = stopwatch.Elapsed.TotalSeconds
            });
        }
예제 #2
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);
            }
        }