Пример #1
0
        public async Task <IEnumerable <Interface.Model.SymbolStats> > Get24HourStatisticsAsync(CancellationToken cancellationToken)
        {
            var stats = await binanceApi.Get24HourStatisticsAsync(cancellationToken).ConfigureAwait(false);

            var symbolsStats = stats.Select(s => NewSymbolStats(s)).ToList();

            return(symbolsStats);
        }
Пример #2
0
        private async Task <ImmutableDictionary <string, SymbolStatistics> > InitializeSymbolStatistics()
        {
            var symbolStatistics = await _binanceApi.Get24HourStatisticsAsync();

            var immutableStatistics = symbolStatistics.ToImmutableDictionary(s => s.Symbol, s => s);

            _cache.SetSymbolStatistics(immutableStatistics);

            return(immutableStatistics);
        }
Пример #3
0
        // ReSharper disable once UnusedMember.Local
        private static async Task <SymbolStatistics[]> Get24HourStatisticsAsync(IBinanceApi api, params string[] symbols)
        {
            var statistics = new List <SymbolStatistics>();

            foreach (var symbol in symbols)
            {
                statistics.Add(await api.Get24HourStatisticsAsync(symbol));
            }

            return(statistics.ToArray());
        }
        private async Task <ImmutableDictionary <string, SymbolStatistics> > InitializeSymbolStatistics()
        {
            try
            {
                var symbolStatistics = await _binanceApi.Get24HourStatisticsAsync();

                var immutableStatistics = symbolStatistics.ToImmutableDictionary(s => s.Symbol, s => s);

                _cache.SetSymbolStatistics(immutableStatistics);

                return(immutableStatistics);
            }
            catch (Exception ex)
            {
                _log.LogError($"Symbol statistics initialization error {ex.Message}");

                return(new Dictionary <string, SymbolStatistics>().ToImmutableDictionary());
            }
        }
Пример #5
0
        public async Task Get24HourStatistics()
        {
            var stats = await _api.Get24HourStatisticsAsync(Symbol.BTC_USDT);

            Assert.NotNull(stats);
        }