Beispiel #1
0
        public async Task <MarketPrices> GetPriceAsync(PublicPricesContext context)
        {
            var pairsCsv = string.Join(" ", context.Pairs.Select(x => x.ToTicker(this)));
            var r        = await ApiProvider.GetTickerAsync(pairsCsv).ConfigureAwait(false);

            if (r == null || r.Length == 0)
            {
                throw new ApiResponseException("No ticker returned", this);
            }

            return(new MarketPrices(new MarketPrice(Network, context.Pair, r[0].LastBuyPrice)
            {
                PriceStatistics = new PriceStatistics(Network, context.Pair.Asset2, r[0].BestAsk, r[0].BestBid),
                Volume = new NetworkPairVolume(Network, context.Pair, r[0].DailyTradedTotalVolume)
            }));
        }