async Task <WebCallResult <Ticker> > IBaseRestClient.GetTickerAsync(string symbol, CancellationToken ct) { if (string.IsNullOrWhiteSpace(symbol)) { throw new ArgumentException(nameof(symbol) + " required for Bitfinex " + nameof(ISpotClient.GetTickerAsync), nameof(symbol)); } var tickersResult = await ExchangeData.GetTickerAsync(symbol, ct : ct).ConfigureAwait(false); if (!tickersResult) { return(tickersResult.As <Ticker>(null)); } return(tickersResult.As(new Ticker { SourceObject = tickersResult.Data, HighPrice = tickersResult.Data.HighPrice, LowPrice = tickersResult.Data.LowPrice, LastPrice = tickersResult.Data.LastPrice, Price24H = tickersResult.Data.LastPrice - tickersResult.Data.DailyChange, Symbol = tickersResult.Data.Symbol, Volume = tickersResult.Data.Volume })); }
async Task <WebCallResult <Ticker> > IBaseRestClient.GetTickerAsync(string symbol, CancellationToken ct) { if (string.IsNullOrEmpty(symbol)) { throw new ArgumentException(nameof(symbol) + " required for CoinEx " + nameof(ISpotClient.GetTickerAsync), nameof(symbol)); } var tickers = await ExchangeData.GetTickerAsync(symbol, ct : ct).ConfigureAwait(false); if (!tickers) { return(tickers.As <Ticker>(null)); } return(tickers.As(new Ticker { SourceObject = tickers.Data, Symbol = symbol, HighPrice = tickers.Data.Ticker.HighPrice, LowPrice = tickers.Data.Ticker.LowPrice, LastPrice = tickers.Data.Ticker.LastPrice, Price24H = tickers.Data.Ticker.OpenPrice, Volume = tickers.Data.Ticker.Volume })); }