public async Task GetAggregateTrades() { const int limit = 5; var trades = await _api.GetAggregateTradesAsync(Symbol.BTC_USDT, limit); Assert.NotNull(trades); Assert.NotEmpty(trades); Assert.True(trades.Count() == limit); }
public async Task GetAggregateTradesThrows() { var startTime = DateTime.UtcNow.AddHours(-1); var endTime = DateTime.UtcNow; var localTime = DateTime.Now; await Assert.ThrowsAsync <ArgumentException>("startTime", () => _api.GetAggregateTradesAsync(Symbol.BTC_USDT, localTime, endTime)); await Assert.ThrowsAsync <ArgumentException>("endTime", () => _api.GetAggregateTradesAsync(Symbol.BTC_USDT, startTime, localTime)); await Assert.ThrowsAsync <ArgumentException>("endTime", () => _api.GetAggregateTradesAsync(Symbol.BTC_USDT, endTime, startTime)); }
public async Task <IEnumerable <Interface.Model.AggregateTrade> > GetAggregateTradesAsync(string symbol, int limit, CancellationToken cancellationToken) { var trades = await binanceApi.GetAggregateTradesAsync(symbol, limit, cancellationToken).ConfigureAwait(false); var aggregateTrades = trades.Select(at => NewAggregateTrade(at)).ToList(); return(aggregateTrades); }