Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 3
0
        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);
        }