public async Task <ListingsData> ListingsAsync() { ListingsData data = new ListingsData(); try { HttpClient _httpClient = new HttpClient { BaseAddress = new Uri(Endpoints.CoinMarketCapApiUrl) }; var url = QueryStringService.AppendQueryString(Endpoints.Listings, new Dictionary <string, string>()); var response = await _httpClient.GetAsync(url); data = await JsonParserService.ParseResponse <ListingsData>(response); if (data == null) { data = new ListingsData { Data = null, Metadata = new ListingsMetadata { Error = int.MinValue }, Success = false }; } data.Success = data.Metadata.Error == null;; } catch { } return(data); }
public async Task <CoinMarketCap.Pro.Model.GlobalMetrics.QuotesData> GlobalMetricsQuotesLatestAsync(FiatCurrency convert = FiatCurrency.USD) { HttpClient _httpClient = new HttpClient { BaseAddress = new Uri(Pro.Config.GlobalMetrics.CoinMarketCapProApiUrl) }; _httpClient.DefaultRequestHeaders.Add("X-CMC_PRO_API_KEY", this.ProApiKey); var url = QueryStringService.AppendQueryString(Pro.Config.GlobalMetrics.GlobalMetricsLatest, new Dictionary <string, string> { { "convert", convert.ToString() }, }); var response = await _httpClient.GetAsync(url); CoinMarketCap.Pro.Model.GlobalMetrics.QuotesData data = await JsonParserService.ParseResponse <CoinMarketCap.Pro.Model.GlobalMetrics.QuotesData>(response); if (data == null) { data = new CoinMarketCap.Pro.Model.GlobalMetrics.QuotesData { Data = null, Status = new Status { ErrorCode = int.MinValue }, Success = false }; } data.Success = data.Status.ErrorCode == 0; // Add to Status List this.statusList.Add(data.Status); return(data); }
public async Task <GlobalData> GlobalAsync(FiatCurrency convert = FiatCurrency.USD) { GlobalData data = new GlobalData(); try { HttpClient _httpClient = new HttpClient { BaseAddress = new Uri(Endpoints.CoinMarketCapApiUrl) }; var url = QueryStringService.AppendQueryString(Endpoints.GlobalData, new Dictionary <string, string> { { "convert", convert.ToString() } }); var response = await _httpClient.GetAsync(url); data = await JsonParserService.ParseResponse <GlobalData>(response); if (data == null) { data = new GlobalData { Data = null, Metadata = new GlobalMetadata { Error = int.MinValue }, Success = false }; } data.Success = data.Metadata.Error == null; } catch { } return(data); }
public async Task <TickersData> GetTickers() { var url = QueryStringService.AppendQueryString(Endpoints.Ticker, new Dictionary <string, string>()); var response = await _restClient.GetAsync(url); return(await JsonParserService.ParseResponse <TickersData>(response)); }
public async Task <Pro.Model.Cryptocurrency.InfoData> CryptocurrencyInfoAsync(string id = null, string symbol = null) { HttpClient _httpClient = new HttpClient { BaseAddress = new Uri(Pro.Config.Cryptocurrency.CoinMarketCapProApiUrl) }; _httpClient.DefaultRequestHeaders.Add("X-CMC_PRO_API_KEY", this.ProApiKey); var url = QueryStringService.AppendQueryString(Pro.Config.Cryptocurrency.CryptocurrencyInfo, new Dictionary <string, string> { { "id", id }, { "symbol", symbol } }); var response = await _httpClient.GetAsync(url); Pro.Model.Cryptocurrency.InfoData data = await JsonParserService.ParseResponse <Pro.Model.Cryptocurrency.InfoData>(response); if (data == null) { data = new Pro.Model.Cryptocurrency.InfoData { Data = null, Status = new Status { ErrorCode = int.MinValue }, Success = false }; } data.Success = data.Status.ErrorCode == 0; // Add to Status List this.statusList.Add(data.Status); return(data); }
public static Uri SocialStats(long id) { return(QueryStringService.AppendQueryString("socialstats/", new Dictionary <string, string> { { "id", id.ToString() } }, false)); }
public async Task <TickerById> GetTickerByCoinId(string id, int?page) { return(await GetAsync <TickerById>(QueryStringService.AppendQueryString( CoinsApiEndPoints.TickerByCoinId(id), new Dictionary <string, object> { { "page", page } }))); }
public async Task <DerivativesExchanges> GetDerivativesExchangesById(string id, string includeTickers) { return(await GetAsync <DerivativesExchanges>(QueryStringService.AppendQueryString( DerivativesApiEndPoints.DerivativesExchangeById(id), new Dictionary <string, object> { { "include_tickers", includeTickers } })).ConfigureAwait(false)); }
public async Task <IReadOnlyList <Derivatives> > GetDerivatives(string includeTicker) { return(await GetAsync <IReadOnlyList <Derivatives> >(QueryStringService.AppendQueryString( DerivativesApiEndPoints.DerivativesUrl, new Dictionary <string, object> { { "include_ticker", includeTicker } })).ConfigureAwait(false)); }
public static Uri SubsWatchlist(string[] fsyms, string tsym) { return(QueryStringService.AppendQueryString("subsWatchlist", new Dictionary <string, string> { { "fsyms", string.Join(",", fsyms) }, { "tsym", tsym } })); }
public static Uri SubsByPair(string fsym, string[] tsyms) { return(QueryStringService.AppendQueryString("subs", new Dictionary <string, string> { { "fsym", fsym }, { "tsyms", string.Join(",", tsyms) } })); }
public async Task <TickerByExchangeId> GetTickerByExchangeId(string id, string page) { return(await GetAsync <TickerByExchangeId>(QueryStringService.AppendQueryString( ExchangesApiEndPoints.TickerById(id), new Dictionary <string, object> { { "page", page } })).ConfigureAwait(false)); }
public static Uri ToplistByPairVolume(string tsym, int?limit) { return(QueryStringService.AppendQueryString("top/volumes", new Dictionary <string, string> { { "tsym", tsym }, { "limit", limit.ToString() } })); }
public static Uri ToplistOfTradingPairs(string fsym, int?limit) { return(QueryStringService.AppendQueryString("top/pairs", new Dictionary <string, string> { { "fsym", fsym }, { "limit", limit.ToString() } })); }
public static Uri CoinGeneralInfo(string[] fsyms, string tsym) { return(QueryStringService.AppendQueryString("coin/generalinfo", new Dictionary <string, string> { { "fsyms", string.Join(",", fsyms) }, { "tsym", tsym } })); }
// public async Task<TickerByExchangeId> GetStatusUpdateByExchangeId(string id) // { // return await GetStatusUpdateByExchangeId(id).ConfigureAwait(false); // } // // public async Task<TickerByExchangeId> GetStatusUpdateByExchangeId(string id, int perPage, string page) // { // throw new System.NotImplementedException(); // } public async Task <IReadOnlyList <VolumeChart> > GetVolumeChartsByExchangeId(string id, int days) { return(await GetAsync <IReadOnlyList <VolumeChart> >(QueryStringService.AppendQueryString( ExchangesApiEndPoints.VolumeChartById(id), new Dictionary <string, object> { { "days", days } })).ConfigureAwait(false)); }
public async Task<CoinFullData> GetHistoryByCoinId(string id, string date, string localization) { return await GetAsync<CoinFullData>(QueryStringService.AppendQueryString( CoinsApiEndPoints.HistoryByCoinId(id), new Dictionary<string, object> { {"date",date}, {"localization",localization} })).ConfigureAwait(false); }
public static Uri TopExchangesVolumeDataByPair(string fsym, string tsym, int?limit) { return(QueryStringService.AppendQueryString("top/exchanges", new Dictionary <string, string> { { "fsym", fsym }, { "tsym", tsym }, { "limit", limit.ToString() } })); }
public static Uri ToplistByTotalVolume(string tsym, int?limit, int?page) { return(QueryStringService.AppendQueryString("top/totalvol", new Dictionary <string, string> { { "tsym", tsym }, { "page", page.ToString() }, { "limit", limit.ToString() } })); }
public async Task <IReadOnlyList <IndexData> > GetIndexes(int?perPage, string page) { return(await GetAsync <IReadOnlyList <IndexData> >(QueryStringService.AppendQueryString( IndexesApiEndPointUrl.IndexesUrl, new Dictionary <string, object> { { "per_page", perPage }, { "page", page } })).ConfigureAwait(false)); }
public async Task<MarketChartById> GetMarketChartsByCoinId(string id, string vsCurrency, string days) { return await GetAsync<MarketChartById>(QueryStringService.AppendQueryString( CoinsApiEndPoints.MarketChartByCoinId(id), new Dictionary<string, object> { {"vs_currency", string.Join(",",vsCurrency)}, {"days", days} })).ConfigureAwait(false); }
public async Task <TickerById> GetTickerByCoinId(string id, string[] exchangeIds, int?page) { return(await GetAsync <TickerById>(QueryStringService.AppendQueryString( CoinsApiEndPoints.TickerByCoinId(id), new Dictionary <string, object> { { "page", page }, { "exchange_ids", string.Join(",", exchangeIds) } })).ConfigureAwait(false)); }
public async Task <IReadOnlyList <CoinList> > GetCoinList(bool includePlatform) { return(await GetAsync <IReadOnlyList <CoinList> >(QueryStringService.AppendQueryString(CoinsApiEndPoints.CoinList, new Dictionary <string, object> { { "include_platform", includePlatform.ToString() } })).ConfigureAwait(false)); }
public async Task <IReadOnlyList <Exchanges> > GetExchanges(int perPage, string page) { return(await GetAsync <IReadOnlyList <Exchanges> >( QueryStringService.AppendQueryString(ExchangesApiEndPoints.Exchanges, new Dictionary <string, object> { { "per_page", perPage }, { "page", page } } )).ConfigureAwait(false)); }
public async Task <TickerData> GetById(int id, string convert) { var url = QueryStringService.AppendQueryString($"{Endpoints.Ticker}/{id}", new Dictionary <string, string> { { "convert", convert } }); var response = await _restClient.GetAsync(url); return(await JsonParserService.ParseResponse <TickerData>(response)); }
public async Task <IReadOnlyList <FinancePlatforms> > GetFinancePlatforms(int perPage, string page) { return(await GetAsync <IReadOnlyList <FinancePlatforms> >(QueryStringService.AppendQueryString( FinancePlatformsApiEndPoints.FinancePlatform, new Dictionary <string, object> { { "per_page", perPage }, { "page", page } } )).ConfigureAwait(false)); }
public static Uri HistoricalDayOhlcVts(string fsym, string[] tsyms, string ts, string e, string calculationType) { return(QueryStringService.AppendQueryString("pricehistorical", new Dictionary <string, string> { { "fsym", fsym }, { "tsyms", string.Join(",", tsyms) }, { "e", e }, { "calculationType", calculationType } })); }
public async Task <IReadOnlyList <DerivativesExchanges> > GetDerivativesExchanges(string order, int?perPage, int?page) { return(await GetAsync <IReadOnlyList <DerivativesExchanges> >(QueryStringService.AppendQueryString( DerivativesApiEndPoints.DerivativesExchanges, new Dictionary <string, object> { { "order", order }, { "per_page", perPage }, { "page", page } })).ConfigureAwait(false)); }
public async Task <MarketChartById> GetMarketChartRangeByCoinId(string id, string vsCurrency, string @from, string to) { return(await GetAsync <MarketChartById>(QueryStringService.AppendQueryString( CoinsApiEndPoints.MarketChartRangeByCoinId(id), new Dictionary <string, object> { { "vs_currency", string.Join(",", vsCurrency) }, { "from", from }, { "to", to } })).ConfigureAwait(false)); }
public async Task <GlobalData> Get(string convert) { var url = QueryStringService.AppendQueryString(Endpoints.GlobalData, new Dictionary <string, string> { { "convert", convert } }); var response = await _restClient.GetAsync(url); return(await JsonParserService.ParseResponse <GlobalData>(response)); }