예제 #1
0
 public ServerObserver(ILogger logger, IDealChecker dealChecker, ConcurrentBag <Deal> deals)
 {
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     _dealChecker    = dealChecker ?? throw new ArgumentNullException(nameof(dealChecker));
     _deals          = deals ?? throw new ArgumentNullException(nameof(deals));
     _mT5ApiRequests = new MT5Api();
     _mT5ApiDeals    = new MT5Api();
 }
예제 #2
0
        public Watchdog(ILogger logger, IDealChecker dealChecker, uint clearTreshold)
        {
            _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
            _dealChecker = dealChecker ?? throw new ArgumentNullException(nameof(dealChecker));

            if (clearTreshold == 0)
            {
                throw new ArgumentException($"{nameof(clearTreshold)} must be greater than zero.");
            }

            _clearTreshold = clearTreshold;

            _cancellationTokenSource = new CancellationTokenSource();
            _clearTimer = new Timer();

            _dealSources = new List <IServerObserver>();
            _deals       = new ConcurrentBag <Deal>();
        }