From 02431165b558c69d2ae1879aad8fed3c921207a6 Mon Sep 17 00:00:00 2001 From: Jkorf Date: Mon, 11 Nov 2024 10:11:04 +0100 Subject: [PATCH] cleanup --- .../Clients/CoinGeckoRestClientApi.cs | 34 +- CoinGecko.Net/CoinGecko.Net.xml | 292 +++++++----------- CoinGecko.Net/CoinGeckoApi.cs | 2 - .../ServiceCollectionExtensions.cs | 1 - .../Interfaces/ICoinGeckoRestClientApi.cs | 16 + .../Objects/CoinGeckoApiCredentials.cs | 4 - .../Objects/Models/CoinGeckoApiUsage.cs | 41 +++ .../Objects/Models/CoinGeckoCodeAddDel.cs | 4 + .../Objects/Models/CoinGeckoCompanyHolding.cs | 78 +++++ .../Models/CoinGeckoExchangeDerivative.cs | 5 +- .../Objects/Models/CoinGeckoIcoData.cs | 157 ---------- .../Objects/Models/CoinGeckoIndex.cs | 33 -- .../CoinGecko.Examples.Api.csproj | 7 +- Examples/CoinGecko.Examples.Api/Program.cs | 6 +- .../CoinGecko.Examples.Console.csproj | 4 +- Examples/Examples.sln | 10 +- README.md | 14 +- docs/index.html | 38 +-- 18 files changed, 327 insertions(+), 419 deletions(-) create mode 100644 CoinGecko.Net/Objects/Models/CoinGeckoApiUsage.cs create mode 100644 CoinGecko.Net/Objects/Models/CoinGeckoCompanyHolding.cs delete mode 100644 CoinGecko.Net/Objects/Models/CoinGeckoIcoData.cs delete mode 100644 CoinGecko.Net/Objects/Models/CoinGeckoIndex.cs diff --git a/CoinGecko.Net/Clients/CoinGeckoRestClientApi.cs b/CoinGecko.Net/Clients/CoinGeckoRestClientApi.cs index 24d5eff..c4969b5 100644 --- a/CoinGecko.Net/Clients/CoinGeckoRestClientApi.cs +++ b/CoinGecko.Net/Clients/CoinGeckoRestClientApi.cs @@ -5,9 +5,7 @@ using CryptoExchange.Net; using CryptoExchange.Net.Authentication; using CryptoExchange.Net.Clients; -using CryptoExchange.Net.Converters; using CryptoExchange.Net.Converters.MessageParsing; -using CryptoExchange.Net.Converters.SystemTextJson; using CryptoExchange.Net.Interfaces; using CryptoExchange.Net.Objects; using CryptoExchange.Net.SharedApis; @@ -620,6 +618,28 @@ public async Task> GetTrendingSearchesAsy #endregion + #region Get Company Holdings + + /// + public async Task> GetCompanyHoldingsAsync(string asset, CancellationToken ct = default) + { + var request = _definitions.GetOrCreate(HttpMethod.Get, $"/api/v3/companies/public_treasury/{asset}", CoinGeckoApi.RateLimiter.CoinGecko, 1, false); + var result = await SendAsync(GetBaseAddress(), request, null, ct).ConfigureAwait(false); + return result; + } + + #endregion + + #region Get Api Usage + /// + public async Task> GetApiUsageAsync(CancellationToken ct = default) + { + var request = _definitions.GetOrCreate(HttpMethod.Get, $"api/v3/key", CoinGeckoApi.RateLimiter.CoinGecko, 1, true); + return await SendAsync(GetBaseAddress(), request, null, ct).ConfigureAwait(false); + } + + #endregion + protected override Error ParseErrorResponse(int httpStatusCode, IEnumerable>> responseHeaders, IMessageAccessor accessor) { if (!accessor.IsJson) @@ -628,10 +648,14 @@ protected override Error ParseErrorResponse(int httpStatusCode, IEnumerable(MessagePath.Get().Property("error_code")); var msg = accessor.GetValue(MessagePath.Get().Property("status").Property("error_message")); - if (code == null || msg == null) - return new ServerError(httpStatusCode, accessor.GetOriginalString()); + if (code != null && msg != null) + return new ServerError(code.Value, msg); + + code = accessor.GetValue(MessagePath.Get().Property("status").Property("error_code")); + if (code != null && msg != null) + return new ServerError(code.Value, msg); - return new ServerError(code.Value, msg); + return new ServerError(httpStatusCode, accessor.GetOriginalString()); } private string GetBaseAddress() diff --git a/CoinGecko.Net/CoinGecko.Net.xml b/CoinGecko.Net/CoinGecko.Net.xml index 6e97cea..af23cde 100644 --- a/CoinGecko.Net/CoinGecko.Net.xml +++ b/CoinGecko.Net/CoinGecko.Net.xml @@ -147,6 +147,12 @@ + + + + + + @@ -604,6 +610,22 @@ Cancellation token + + + Get public company holdings for an asset + + + Asset name + Cancellation token + + + + Get current API usage stats + + + Cancellation token + + Api addresses usable for the CoinGecko client @@ -647,6 +669,36 @@ + + + API usage info + + + + + Plan + + + + + Rate limit request per minute + + + + + Monthly call credit + + + + + Current total monthly calls + + + + + Current remaining monthly calls + + Asset info @@ -1017,6 +1069,71 @@ Telegram channel user count + + + Company holdings + + + + + Total holdings + + + + + Total value in USD + + + + + Market cap dominance + + + + + Companies + + + + + Company holding + + + + + Name + + + + + Symbol + + + + + Country + + + + + Total holdings + + + + + Total entry value USD + + + + + Total current value USD + + + + + Percentage of total supply + + Derivative info @@ -1612,151 +1729,6 @@ Top defi asset dominance - - - Ico information - - - - - Ico start date - - - - - Ico end date - - - - - Short description - - - - - Description - - - - - Soft cap currency - - - - - Hard cap currency - - - - - Total raised currency - - - - - Softcap - - - - - Hardcap amount - - - - - Total raised - - - - - Quote pre-sale currency - - - - - Base pre sale amount - - - - - Quote pre sale amount - - - - - Quote public sale currency - - - - - Base public sale amount - - - - - Quote public sale amount - - - - - Accepting currencies - - - - - Country origin - - - - - Pre sale start date - - - - - Pre sale end date - - - - - Whitelist url - - - - - Whitelist start date - - - - - Whitelist end date - - - - - Bounty detail url - - - - - Amount for sale - - - - - KYC required - - - - - Whitelist available - - - - - Pre sale ended - - Image links @@ -1777,36 +1749,6 @@ Large image - - - Index info - - - - - Id - - - - - Name - - - - - Market - - - - - Last - - - - - Is multi asset composite index - - Links diff --git a/CoinGecko.Net/CoinGeckoApi.cs b/CoinGecko.Net/CoinGeckoApi.cs index 9d5f75d..5ac30ca 100644 --- a/CoinGecko.Net/CoinGeckoApi.cs +++ b/CoinGecko.Net/CoinGeckoApi.cs @@ -56,8 +56,6 @@ private void Initialize() CoinGecko.RateLimitTriggered += (x) => RateLimitTriggered?.Invoke(x); } - internal IRateLimitGate CoinGecko { get; private set; } - } } diff --git a/CoinGecko.Net/ExtensionMethods/ServiceCollectionExtensions.cs b/CoinGecko.Net/ExtensionMethods/ServiceCollectionExtensions.cs index eceaa59..2bfffe8 100644 --- a/CoinGecko.Net/ExtensionMethods/ServiceCollectionExtensions.cs +++ b/CoinGecko.Net/ExtensionMethods/ServiceCollectionExtensions.cs @@ -3,7 +3,6 @@ using CoinGecko.Net.Objects.Options; using CryptoExchange.Net.Clients; using CryptoExchange.Net.Interfaces; -using Microsoft.Extensions.DependencyInjection; using System; using System.Net; using System.Net.Http; diff --git a/CoinGecko.Net/Interfaces/ICoinGeckoRestClientApi.cs b/CoinGecko.Net/Interfaces/ICoinGeckoRestClientApi.cs index 975ec8c..3b0a124 100644 --- a/CoinGecko.Net/Interfaces/ICoinGeckoRestClientApi.cs +++ b/CoinGecko.Net/Interfaces/ICoinGeckoRestClientApi.cs @@ -370,5 +370,21 @@ Task>> GetMarketsAsync( /// Cancellation token /// Task> GetTrendingSearchesAsync(CancellationToken ct = default); + + /// + /// Get public company holdings for an asset + /// + /// + /// Asset name + /// Cancellation token + Task> GetCompanyHoldingsAsync(string asset, CancellationToken ct = default); + + /// + /// Get current API usage stats + /// + /// + /// Cancellation token + /// + Task> GetApiUsageAsync(CancellationToken ct = default); } } diff --git a/CoinGecko.Net/Objects/CoinGeckoApiCredentials.cs b/CoinGecko.Net/Objects/CoinGeckoApiCredentials.cs index d9cc2f1..44f929d 100644 --- a/CoinGecko.Net/Objects/CoinGeckoApiCredentials.cs +++ b/CoinGecko.Net/Objects/CoinGeckoApiCredentials.cs @@ -1,8 +1,4 @@ using CryptoExchange.Net.Authentication; -using System; -using System.Collections.Generic; -using System.Net.Sockets; -using System.Text; namespace CoinGecko.Net.Objects { diff --git a/CoinGecko.Net/Objects/Models/CoinGeckoApiUsage.cs b/CoinGecko.Net/Objects/Models/CoinGeckoApiUsage.cs new file mode 100644 index 0000000..a3f55af --- /dev/null +++ b/CoinGecko.Net/Objects/Models/CoinGeckoApiUsage.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.Json.Serialization; + +namespace CoinGecko.Net.Objects.Models +{ + /// + /// API usage info + /// + public record CoinGeckoApiUsage + { + /// + /// Plan + /// + [JsonPropertyName("plan")] + public string Plan { get; set; } = string.Empty; + /// + /// Rate limit request per minute + /// + [JsonPropertyName("rate_limit_request_per_minute")] + public long RateLimitRequestPerMinute { get; set; } + /// + /// Monthly call credit + /// + [JsonPropertyName("monthly_call_credit")] + public long MonthlyCallCredit { get; set; } + /// + /// Current total monthly calls + /// + [JsonPropertyName("current_total_monthly_calls")] + public long CurrentTotalMonthlyCalls { get; set; } + /// + /// Current remaining monthly calls + /// + [JsonPropertyName("current_remaining_monthly_calls")] + public long CurrentRemainingMonthlyCalls { get; set; } + } + + +} diff --git a/CoinGecko.Net/Objects/Models/CoinGeckoCodeAddDel.cs b/CoinGecko.Net/Objects/Models/CoinGeckoCodeAddDel.cs index f5ee54e..baa788d 100644 --- a/CoinGecko.Net/Objects/Models/CoinGeckoCodeAddDel.cs +++ b/CoinGecko.Net/Objects/Models/CoinGeckoCodeAddDel.cs @@ -1,5 +1,7 @@  +using System.Text.Json.Serialization; + namespace CoinGecko.Net.Objects.Models { /// @@ -10,10 +12,12 @@ public record CoinGeckoCodeAddDel /// /// Lines added /// + [JsonPropertyName("additions")] public int? Additions { get; set; } /// /// Lines deleted /// + [JsonPropertyName("deletions")] public int? Deletions { get; set; } } } diff --git a/CoinGecko.Net/Objects/Models/CoinGeckoCompanyHolding.cs b/CoinGecko.Net/Objects/Models/CoinGeckoCompanyHolding.cs new file mode 100644 index 0000000..8c7dc8d --- /dev/null +++ b/CoinGecko.Net/Objects/Models/CoinGeckoCompanyHolding.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.Json.Serialization; + +namespace CoinGecko.Net.Objects.Models +{ + /// + /// Company holdings + /// + public record CoinGeckoCompanyHolding + { + /// + /// Total holdings + /// + [JsonPropertyName("total_holdings")] + public decimal TotalHoldings { get; set; } + /// + /// Total value in USD + /// + [JsonPropertyName("total_value_usd")] + public decimal TotalValueUsd { get; set; } + /// + /// Market cap dominance + /// + [JsonPropertyName("market_cap_dominance")] + public decimal MarketCapDominance { get; set; } + /// + /// Companies + /// + [JsonPropertyName("companies")] + public IEnumerable Companies { get; set; } = Array.Empty(); + } + + /// + /// Company holding + /// + public record CoinGeckoCompanyAsset + { + /// + /// Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + /// + /// Symbol + /// + [JsonPropertyName("symbol")] + public string Symbol { get; set; } = string.Empty; + /// + /// Country + /// + [JsonPropertyName("country")] + public string Country { get; set; } = string.Empty; + /// + /// Total holdings + /// + [JsonPropertyName("total_holdings")] + public decimal TotalHoldings { get; set; } + /// + /// Total entry value USD + /// + [JsonPropertyName("total_entry_value_usd")] + public decimal TotalEntryValueUsd { get; set; } + /// + /// Total current value USD + /// + [JsonPropertyName("total_current_value_usd")] + public decimal TotalCurrentValueUsd { get; set; } + /// + /// Percentage of total supply + /// + [JsonPropertyName("percentage_of_total_supply")] + public decimal PercentageOfTotalSupply { get; set; } + } + + +} diff --git a/CoinGecko.Net/Objects/Models/CoinGeckoExchangeDerivative.cs b/CoinGecko.Net/Objects/Models/CoinGeckoExchangeDerivative.cs index 499508d..59ad6d3 100644 --- a/CoinGecko.Net/Objects/Models/CoinGeckoExchangeDerivative.cs +++ b/CoinGecko.Net/Objects/Models/CoinGeckoExchangeDerivative.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices.ComTypes; +using System.Collections.Generic; using System.Text.Json.Serialization; namespace CoinGecko.Net.Objects.Models diff --git a/CoinGecko.Net/Objects/Models/CoinGeckoIcoData.cs b/CoinGecko.Net/Objects/Models/CoinGeckoIcoData.cs deleted file mode 100644 index 104317b..0000000 --- a/CoinGecko.Net/Objects/Models/CoinGeckoIcoData.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace CoinGecko.Net.Objects.Models -{ - /// - /// Ico information - /// - public record CoinGeckoIcoData - { - /// - /// Ico start date - /// - [JsonPropertyName("ico_start_date")] - [JsonConverter(typeof(DateTimeConverter))] - public DateTime? IcoStartDate { get; set; } - /// - /// Ico end date - /// - [JsonPropertyName("ico_end_date")] - [JsonConverter(typeof(DateTimeConverter))] - public DateTime? IcoEndDate { get; set; } - /// - /// Short description - /// - [JsonPropertyName("short_desc")] - public string ShortDescription { get; set; } = string.Empty; - /// - /// Description - /// - public string? Description { get; set; } - /// - /// Soft cap currency - /// - [JsonPropertyName("softcap_currency")] - public string? SoftcapCurrency { get; set; } - /// - /// Hard cap currency - /// - [JsonPropertyName("hardcap_currency")] - public string? HardcapCurrency { get; set; } - /// - /// Total raised currency - /// - [JsonPropertyName("total_raised_currency")] - public string? TotalRaisedCurrency { get; set; } - /// - /// Softcap - /// - [JsonPropertyName("softcap_amount")] - public decimal? SoftcapAmount { get; set; } - /// - /// Hardcap amount - /// - [JsonPropertyName("hardcap_amount")] - public decimal? HardcapAmount { get; set; } - /// - /// Total raised - /// - [JsonPropertyName("total_raised")] - public decimal? TotalRaised { get; set; } - /// - /// Quote pre-sale currency - /// - [JsonPropertyName("quote_pre_sale_currency")] - public string QuotePreSaleCurrency { get; set; } = string.Empty; - /// - /// Base pre sale amount - /// - [JsonPropertyName("base_pre_sale_amount")] - public string BasePreSaleAmount { get; set; } = string.Empty; - /// - /// Quote pre sale amount - /// - [JsonPropertyName("quote_pre_sale_amount")] - public decimal? QuotePreSaleAmount { get; set; } - /// - /// Quote public sale currency - /// - [JsonPropertyName("quote_public_sale_currency")] - public string QuotePublicSaleCurrency { get; set; } = string.Empty; - /// - /// Base public sale amount - /// - [JsonPropertyName("base_public_sale_amount")] - public decimal? BasePublicSaleAmount { get; set; } - /// - /// Quote public sale amount - /// - [JsonPropertyName("quote_public_sale_amount")] - public decimal? QuotePublicSaleAmount { get; set; } - /// - /// Accepting currencies - /// - [JsonPropertyName("accepting_currencies")] - public string AcceptingCurrencies { get; set; } = string.Empty; - /// - /// Country origin - /// - [JsonPropertyName("country_origin")] - public string CountryOrigin { get; set; } = string.Empty; - /// - /// Pre sale start date - /// - [JsonPropertyName("pre_sale_start_date")] - [JsonConverter(typeof(DateTimeConverter))] - public DateTime? PreSaleStartDate { get; set; } - /// - /// Pre sale end date - /// - [JsonPropertyName("pre_sale_end_date")] - [JsonConverter(typeof(DateTimeConverter))] - public DateTime? PreSaleEndDate { get; set; } - /// - /// Whitelist url - /// - [JsonPropertyName("whitelist_url")] - public string WhitelistUrl { get; set; } = string.Empty; - /// - /// Whitelist start date - /// - [JsonPropertyName("whitelist_start_date")] - [JsonConverter(typeof(DateTimeConverter))] - public DateTime? WhitelistStartDate { get; set; } - /// - /// Whitelist end date - /// - [JsonPropertyName("whitelist_end_date")] - [JsonConverter(typeof(DateTimeConverter))] - public DateTime? WhitelistEndDate { get; set; } - /// - /// Bounty detail url - /// - [JsonPropertyName("bounty_detail_url")] - public string BountyDetailUrl { get; set; } = string.Empty; - /// - /// Amount for sale - /// - [JsonPropertyName("amount_for_sale")] - public decimal? AmountForSale { get; set; } - /// - /// KYC required - /// - [JsonPropertyName("kyc_required")] - public bool KycRequired { get; set; } - /// - /// Whitelist available - /// - [JsonPropertyName("whitelist_available")] - public bool? WhitelistAvailable { get; set; } - /// - /// Pre sale ended - /// - [JsonPropertyName("pre_sale_ended")] - public bool PreSaleEnded { get; set; } - } -} diff --git a/CoinGecko.Net/Objects/Models/CoinGeckoIndex.cs b/CoinGecko.Net/Objects/Models/CoinGeckoIndex.cs deleted file mode 100644 index 6c66e63..0000000 --- a/CoinGecko.Net/Objects/Models/CoinGeckoIndex.cs +++ /dev/null @@ -1,33 +0,0 @@ - -using System.Text.Json.Serialization; - -namespace CoinGecko.Net.Objects.Models -{ - /// - /// Index info - /// - public record CoinGeckoIndex - { - /// - /// Id - /// - public string Id { get; set; } = string.Empty; - /// - /// Name - /// - public string Name { get; set; } = string.Empty; - /// - /// Market - /// - public string Market { get; set; } = string.Empty; - /// - /// Last - /// - public decimal? Last { get; set; } - /// - /// Is multi asset composite index - /// - [JsonPropertyName("is_multi_asset_composite")] - public bool? IsMultiAssetComposite { get; set; } - } -} diff --git a/Examples/CoinGecko.Examples.Api/CoinGecko.Examples.Api.csproj b/Examples/CoinGecko.Examples.Api/CoinGecko.Examples.Api.csproj index f7d60e3..636f218 100644 --- a/Examples/CoinGecko.Examples.Api/CoinGecko.Examples.Api.csproj +++ b/Examples/CoinGecko.Examples.Api/CoinGecko.Examples.Api.csproj @@ -1,16 +1,19 @@ - net7.0 + net8.0 enable enable true - + + + + diff --git a/Examples/CoinGecko.Examples.Api/Program.cs b/Examples/CoinGecko.Examples.Api/Program.cs index 0beea8d..bf3845a 100644 --- a/Examples/CoinGecko.Examples.Api/Program.cs +++ b/Examples/CoinGecko.Examples.Api/Program.cs @@ -1,5 +1,4 @@ using CoinGecko.Net.Interfaces; -using CryptoExchange.Net.Authentication; using Microsoft.AspNetCore.Mvc; var builder = WebApplication.CreateBuilder(args); @@ -14,10 +13,7 @@ /* builder.Services.AddCoinGecko(restOptions => { - restOptions.RequestTimeout = TimeSpan.FromSeconds(5); -}, socketOptions => -{ - socketOptions.ApiCredentials = new ApiCredentials("", ""); + restOptions.ApiCredentials = new CoinGeckoApiCredentials(""); }); */ diff --git a/Examples/CoinGecko.Examples.Console/CoinGecko.Examples.Console.csproj b/Examples/CoinGecko.Examples.Console/CoinGecko.Examples.Console.csproj index dd2f30c..bb7c063 100644 --- a/Examples/CoinGecko.Examples.Console/CoinGecko.Examples.Console.csproj +++ b/Examples/CoinGecko.Examples.Console/CoinGecko.Examples.Console.csproj @@ -2,13 +2,13 @@ Exe - net7.0 + net8.0 enable enable - + diff --git a/Examples/Examples.sln b/Examples/Examples.sln index ad35521..0cf8886 100644 --- a/Examples/Examples.sln +++ b/Examples/Examples.sln @@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoinGecko.Examples.Console", "CoinGecko.Examples.Console\CoinGecko.Examples.Console.csproj", "{72F29164-3C3E-4EB1-9C2B-BC9BA5FCD5AA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoinGecko.Examples.Console", "CoinGecko.Examples.Console\CoinGecko.Examples.Console.csproj", "{72F29164-3C3E-4EB1-9C2B-BC9BA5FCD5AA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoinGecko.Examples.Api", "CoinGecko.Examples.Api\CoinGecko.Examples.Api.csproj", "{2E6BB5F7-6F04-4122-8CB6-6B89E822040A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoinGecko.Examples.Api", "CoinGecko.Examples.Api\CoinGecko.Examples.Api.csproj", "{2E6BB5F7-6F04-4122-8CB6-6B89E822040A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CryptoClients.Net", "..\..\CryptoClients.Net\CryptoClients.Net\CryptoClients.Net.csproj", "{C0206645-0CBD-4D74-9242-B213C691BD01}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,10 @@ Global {2E6BB5F7-6F04-4122-8CB6-6B89E822040A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E6BB5F7-6F04-4122-8CB6-6B89E822040A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E6BB5F7-6F04-4122-8CB6-6B89E822040A}.Release|Any CPU.Build.0 = Release|Any CPU + {C0206645-0CBD-4D74-9242-B213C691BD01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C0206645-0CBD-4D74-9242-B213C691BD01}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C0206645-0CBD-4D74-9242-B213C691BD01}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C0206645-0CBD-4D74-9242-B213C691BD01}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 075fcf5..464cf43 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,10 @@ The NuGet package files are added along side the source with the latest GitHub r *REST Endpoints* ```csharp -// Get the ETH/USDT ticker via rest request -var restClient = new CoinGeckoRestClient(); +// Get the ETH price via rest request var tickerResult = await restClient.Api.GetMarketsAsync("USD"); -var lastPrice = tickerResult.Data.First().CurrentPrice; +var lastPrice = tickerResult.Data.Single(x => x.Name == "Ethereum").CurrentPrice; +Console.ReadLine(); ``` For information on the clients, dependency injection, response processing and more see the [CoinGecko.Net documentation](https://jkorf.github.io/CoinGecko.Net), [CryptoExchange.Net documentation](https://jkorf.github.io/CryptoExchange.Net), or have a look at the examples [here](https://github.com/JKorf/CoinGecko.Net/tree/master/Examples) or [here](https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples). @@ -73,24 +73,26 @@ CryptoExchange.Net also allows for [easy access to different exchange API's](htt A Discord server is available [here](https://discord.gg/MSpeEtSY8t). Feel free to join for discussion and/or questions around the CryptoExchange.Net and implementation libraries. ## Supported functionality +Note that only the public endpoints are supported, but setting API key is supported and the correct API urls will be selected. ### V3 API |API|Supported|Location| |--|--:|--| |Ping|✓|`restClient.Api`| +|Key|✓|`restClient.Api`| |Simple|✓|`restClient.Api`| |Coins|✓|`restClient.Api`| -|Contract|X|| +|Contract|✓|`restClient.Api`| |Asset Platforms|✓|`restClient.Api`| |Categories|✓|`restClient.Api`| |Exchanges|✓|`restClient.Api`| |Derivatives|✓|`restClient.Api`| -|Nfts|X|| +|Nfts|✓|`restClient.Api`| |Exchange Rates|✓|`restClient.Api`| |Search|✓|`restClient.Api`| |Trending|✓|`restClient.Api`| |Global|✓|`restClient.Api`| -|Companies|X|| +|Companies|✓|`restClient.Api`| ## Support the project Any support is greatly appreciated. diff --git a/docs/index.html b/docs/index.html index c828ffe..efd1e99 100644 --- a/docs/index.html +++ b/docs/index.html @@ -191,27 +191,23 @@

API Access


- - +
+

Examples

+ + Get Asset info
+

Get details on an asset

+
var coinGeckoClient = new CoinGeckoRestClient();
+
+var result = await restClient.Api.GetAssetDetailsAsync("ethereum");
+
+ Get tickers
+

Get tickers for an asset

+
var coinGeckoClient = new CoinGeckoRestClient();
+
+var result = await restClient.Api.GetTickersAsync("ethereum");
+
+
+