CoinMarketCapDotNet 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package CoinMarketCapDotNet --version 1.0.9                
NuGet\Install-Package CoinMarketCapDotNet -Version 1.0.9                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoinMarketCapDotNet" Version="1.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CoinMarketCapDotNet --version 1.0.9                
#r "nuget: CoinMarketCapDotNet, 1.0.9"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CoinMarketCapDotNet as a Cake Addin
#addin nuget:?package=CoinMarketCapDotNet&version=1.0.9

// Install CoinMarketCapDotNet as a Cake Tool
#tool nuget:?package=CoinMarketCapDotNet&version=1.0.9                

CoinMarketCap C# Wrapper

CoinMarketCapDotNet

CoinMarketCapDotNet is a C# wrapper for the CoinMarketCap API, providing convenient access to cryptocurrency market data.

Installation

You can install CoinMarketCapDotNet via NuGet Package Manager or by using the .NET CLI:

NuGet Package Manager

Search for CoinMarketCapDotNet in the NuGet Package Manager UI or run the following command in the Package Manager Console:

Install-Package CoinMarketCapDotNet

.NET CLI

Run the following command in your project directory:

dotnet add package CoinMarketCapDotNet

Usage

To use CoinMarketCapDotNet, follow these steps:

  1. Instantiate the CoinMarketCapAPI class with your API key:
string apiKey = "YOUR_API_KEY";
CoinMarketCapAPI api = new CoinMarketCapAPI(apiKey);


Access the available endpoints through the instantiated API object. 
CryptocurrencyEndpoint -> await api.Cryptocurrency.
FiatEndpoint -> await api.Fiat.
ExchangeEndpoint -> await api.Exchange.
GlobalMetricsEndpoint -> await api.GlobalMetrics.
ToolsEndpoint -> await api.Tools.
BlockchainEndpoint -> await api.Blockchain.
KeyEndpoint -> await api.Key.
ContentEndpoint -> await api.Content.
CommunityEndpoint -> await api.Community.

For example, to get metadata:

var data = await api.Cryptocurrency.GetMapAsync();  // Retrieves a mapping of all supported fiat currencies to unique CoinMarketCap IDs.

Extensions to make life easier:

Enum Extensions: 
**## .GetEnumMemberValue():**
Example: 
CurrencyEnum currency = CurrencyEnum.EUR;
string enumMemberValue = currency.GetEnumMemberValue(); // Should return "USD" you can use this to fetch USD from endpoints.

**## .GetId():**
Example: 
CurrencyEnum currency = CurrencyEnum.USD;
int id = currency.GetId(); // You should get the cmc equilavent of EUR id.

**## .GetSymbol():**
Example: 
CurrencyEnum currency = CurrencyEnum.TRY; // You should get "TRY"
string symbol = currency.GetSymbol();

**## .GetCurrencyIds():**
Example: 
string symbols = "USD,EUR,TRY";
List<int> ids = symbols.GetCurrencyIds(); // Returns the symbol strings as a id list to be used in endpoints.

**## .GetAllIds():**
Example: 
List<int> allIds = EnumExtensions.GetAllIds<CategoryEnum>(); // Will return all the ids of a given enum

**## .GetAllSymbols():**
Example: 
  List<string> enumMemberValues = EnumExtensions.GetAllSymbols<CurrencyEnum>(); // Will return all the symbols of a given enum

Refer to the CoinMarketCap API documentation for more information on available endpoints and their usage.

Contributing Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License MIT License

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.10 381 8/21/2023
1.0.9 152 8/11/2023
1.0.8 140 7/10/2023
1.0.7 148 7/6/2023
1.0.6 144 7/5/2023
1.0.5 140 7/4/2023
1.0.4 143 7/4/2023
1.0.3 149 7/4/2023
1.0.2 152 7/4/2023
1.0.1 150 6/11/2023
1.0.0 148 6/11/2023

v.1.0.9

Added dictionary extensions.
GetValueOrDefault("USD") returns the object if any of the dictionary key = "USD" exists or returns default.
TryGetValue("USD") An enhanced version that returns a specified default value if the key is not found.
Merge(dict1, dict2) Merges two dictionaries. In case of key conflicts, the value from the second dictionary is taken.
FilterByKeys("") Returns a new dictionary containing only the entries with the specified keys.
FilterByValueCondition("") Returns a new dictionary containing only the entries where values satisfy a given predicate.