コード例 #1
0
        /// <summary>
        /// Retrieves the global market cap for crypto currencies.
        /// </summary>
        /// <param name="convert">Convert the crypto volumes to the given Fiat currency.</param>
        /// <returns>A GlobalDataEntity with the requested information in the given currency.</returns>
        public async Task <Entities.GlobalDataEntity> GetGlobalDataAsync(Enums.ConvertEnum convert)
        {
            StringBuilder uri = new StringBuilder($"/v1/global/?");

            uri.Append(Enums.ConvertEnum.USD != convert ? $"convert={convert.ToString()}" : "");
            var response = await _client.GetStringAsync(uri.ToString());

            var obj = JsonConvert.DeserializeObject <Entities.GlobalDataEntity>(response);

            return(obj);
        }
コード例 #2
0
        /// <summary>
        /// Retrieves a list of Tickers.
        /// </summary>
        /// <param name="limit">Limit the amount of Tickers.</param>
        /// <param name="convert">Convert the crypto volumes to the given Fiat currency.</param>
        /// <returns>Returns the ticker list with their volumes.</returns>
        public async Task <List <Entities.TickerEntity> > GetTickerListAsync(int limit, Enums.ConvertEnum convert)
        {
            var uri = new StringBuilder("/v1/ticker/?");

            uri.Append($"limit={limit}&");
            uri.Append($"convert={convert.ToString()}");
            var response = await _client.GetStringAsync(uri.ToString());

            var obj = JsonConvert.DeserializeObject <List <Entities.TickerEntity> >(response);

            return(obj);
        }
コード例 #3
0
        /// <summary>
        /// Retrieves the Ticker for given cryptoCurrency value.
        /// </summary>
        /// <param name="cryptoCurrency">The Ticker name of the desired cryptoCurrency.</param>
        /// <param name="convert">Convert the crypto volumes to the given Fiat currency.</param>
        /// <returns>Returns the ticker.</returns>
        public async Task <Entities.TickerEntity> GetTickerAsync(string cryptoCurrency, Enums.ConvertEnum convert)
        {
            StringBuilder uri = new StringBuilder();

            uri.Append($"/v1/ticker/{cryptoCurrency}/?");
            uri.Append(Enums.ConvertEnum.USD != convert ? $"convert={convert.ToString()}" : "");
            var response = await _client.GetStringAsync(uri.ToString());

            var obj = JsonConvert.DeserializeObject <List <Entities.TickerEntity> >(response);

            return(obj.First());
        }