예제 #1
0
        async Task <WebCallResult <IEnumerable <Trade> > > IBaseRestClient.GetRecentTradesAsync(string symbol, CancellationToken ct)
        {
            if (string.IsNullOrEmpty(symbol))
            {
                throw new ArgumentException(nameof(symbol) + " required for CoinEx " + nameof(ISpotClient.GetRecentTradesAsync), nameof(symbol));
            }

            var trades = await ExchangeData.GetTradeHistoryAsync(symbol, ct : ct).ConfigureAwait(false);

            if (!trades)
            {
                return(trades.As <IEnumerable <Trade> >(null));
            }

            return(trades.As(trades.Data.Select(t =>
                                                new Trade
            {
                SourceObject = t,
                Price = t.Price,
                Quantity = t.Quantity,
                Symbol = symbol,
                Timestamp = t.Timestamp
            })));
        }