public async Task ShouldCalculateAggregatedAmountForTheLastPeriod()
        {
            // Arrange

            await Arrange();

            // Act

            var stopwatch = Stopwatch.StartNew();
            var amount    = await _statistics.GetAggregatedAmountForTheLastPeriodAsync(_blockchain, _asset, _type, DateTime.UtcNow - _startedAt);

            stopwatch.Stop();
            _output.WriteLine($"{nameof(IStatisticsRepository.GetAggregatedAmountForTheLastPeriodAsync)}\t{stopwatch.Elapsed}");

            // Assert

            Assert.Equal(_operations.Sum(op => op.Amount), amount, 2);
        }
        public async Task <RiskConstraintResolution> ApplyAsync(
            string blockchainType,
            string blockchainAssetId,
            OperationType?operationType,
            Operation operation)
        {
            var aggregatedAmount = await _statisticsRepository.GetAggregatedAmountForTheLastPeriodAsync(
                blockchainType,
                blockchainAssetId,
                operationType,
                _period);

            return(aggregatedAmount + operation.Amount > _maxAmount
                ? RiskConstraintResolution.Violated($"Aggregated operations amount {aggregatedAmount} + {operation.Amount} > {_maxAmount} for the last {_period}")
                : RiskConstraintResolution.Passed);
        }