CoinMarketCapApi 1.0.1
dotnet add package CoinMarketCapApi --version 1.0.1
NuGet\Install-Package CoinMarketCapApi -Version 1.0.1
<PackageReference Include="CoinMarketCapApi" Version="1.0.1" />
paket add CoinMarketCapApi --version 1.0.1
#r "nuget: CoinMarketCapApi, 1.0.1"
// Install CoinMarketCapApi as a Cake Addin
#addin nuget:?package=CoinMarketCapApi&version=1.0.1
// Install CoinMarketCapApi as a Cake Tool
#tool nuget:?package=CoinMarketCapApi&version=1.0.1
CoinMarketCap API Wrapper for .Net
A .Net wrapper for the CoinMarketCap API as described on CoinMarketCap Public API and Professional API, including all features the API provides using clear and readable objects.
If you think something is broken, something is missing or have any questions, please open an Issue
Donations
Donations are greatly appreciated and a motivation to keep improving.
BTC: 1CCiBxQPbng46X7yiRjMPpiMwBn6jeT8v1 ETH: 0x068cbd8cdeb6712185f17d88d2cba06f40da2e4d NANO: xrb_1xh45zbu1gkr7syu6nxdbds4ce3jbqkuh6frp46nq8icmti3r49yr4jbgqgp
Installation
Available on Nuget.
pm> Install-Package CoinMarketCapApi
Getting started
After installing it's time to actually use it. To get started we have to add the CoinMarketCap namespace: using CoinMarketCap;
.
CoinMarketCap provides two clients to interact with the API. The PublicClient
provides all rest Public API calls. The ProClient
provides functions to interact with the Professional API calls. Both clients are disposable and as such can be used in a using
statement.
Most API methods are available in two flavors, sync and async:
public void NonAsyncMethod()
{
using(var client = new PublicClient())
{
var result = client.Global();
}
}
public async Task AsyncMethod()
{
using(var client = new PublicClient())
{
var result2 = await client.GlobalAsync();
}
}
Examples
Examples can be found in the Examples folder.
Response handling
All API requests will respond with an Metadata(for public) or Status(for pro) object. This object contains whether the call was successful, the data returned from the call and an error if the call wasn't successful. As such, one should always check the Success flag when processing a response. For example:
using(var client = new PublicClient())
{
var result = client.Tickers();
if (result.Success)
Console.WriteLine($"Server time: {result.Data}");
else
Console.WriteLine($"Error: {result.Metadata.Error}");
}
Release notes
Version 1.0.1 - 26 sep 2018
- Fixed some variables types according to returned value is null or not
Version 1.0.0 - 24 sep 2018
- First release of Library
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Newtonsoft.Json (>= 11.0.2)
- System.Net.Http (>= 4.3.3)
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 |
---|
This is the first release of CoinMarketCap Public and Pro API for .Net