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); }
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); }
// 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()); } }
public async Task Get24HourStatistics() { var stats = await _api.Get24HourStatisticsAsync(Symbol.BTC_USDT); Assert.NotNull(stats); }