コード例 #1
0
ファイル: BinanceApiTest.cs プロジェクト: thehoanght/Binance
        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);
        }
コード例 #2
0
        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));
        }
コード例 #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);
        }