コード例 #1
0
        public async Task GetAggregateTradeInThrows()
        {
            await Assert.ThrowsAsync <ArgumentException>("startTime", () => _api.GetAggregateTradesInAsync(Symbol.BTC_USDT, -1, 1));

            await Assert.ThrowsAsync <ArgumentException>("startTime", () => _api.GetAggregateTradesInAsync(Symbol.BTC_USDT, 0, 1));

            await Assert.ThrowsAsync <ArgumentException>("endTime", () => _api.GetAggregateTradesInAsync(Symbol.BTC_USDT, 1, -1));

            await Assert.ThrowsAsync <ArgumentException>("endTime", () => _api.GetAggregateTradesInAsync(Symbol.BTC_USDT, 1, 0));

            await Assert.ThrowsAsync <ArgumentException>("endTime", () => _api.GetAggregateTradesInAsync(Symbol.BTC_USDT, 2, 1));
        }
コード例 #2
0
ファイル: BinanceApiTest.cs プロジェクト: thehoanght/Binance
        public async Task GetAggregateTradesIn()
        {
            const int limit = 5;

            var limitTrades = await _api.GetAggregateTradesAsync(Symbol.BTC_USDT, limit);

            var startTime = limitTrades.First().Timestamp;
            var endTime   = limitTrades.Last().Timestamp;

            var trades = await _api.GetAggregateTradesInAsync(Symbol.BTC_USDT, startTime, endTime);

            Assert.NotNull(trades);
            Assert.NotEmpty(trades);
            Assert.True(trades.Count() >= limit);
            Assert.All(limitTrades, t1 => trades.Single(t2 => t2.Id == t1.Id));
        }