https://github.com/discosultan/krakencore
💱 .NET client for Kraken Bitcoin & cryptocurrency exchange API
https://github.com/discosultan/krakencore
async csharp kraken-exchange-api netstandard
Last synced: 11 months ago
JSON representation
💱 .NET client for Kraken Bitcoin & cryptocurrency exchange API
- Host: GitHub
- URL: https://github.com/discosultan/krakencore
- Owner: discosultan
- License: mit
- Created: 2017-07-27T21:36:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-05-21T09:25:44.000Z (about 7 years ago)
- Last Synced: 2025-07-23T16:59:43.745Z (11 months ago)
- Topics: async, csharp, kraken-exchange-api, netstandard
- Language: C#
- Homepage:
- Size: 87.9 KB
- Stars: 37
- Watchers: 12
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
KrakenCore
.NET client for Kraken bitcoin exchange API
> ⚠ This is an alpha version, meaning the API has not been tested on any production application. USE AT OWN RISK! Also, the API does not include the [tentative private user funding API](https://www.kraken.com/help/api#private-user-funding) as it is subject to change.
## 🎉 Features
- ✖ Cross-platform based on [.NET Standard 2.0](https://docs.microsoft.com/en-us/dotnet/standard/net-standard)
- 🔁 Asynchronous API using [async and await](https://docs.microsoft.com/en-us/dotnet/csharp/async)
- 💪 Strongly typed models
- 🛂 Covered with tests
- 🔐 Supports two-factor authentication
## 📦 Getting Started
```csharp
using KrakenCore;
```
```csharp
var client = new KrakenClient(apiKey, privateKey);
var response = await client.GetAccountBalance();
foreach (var currency in response.Result)
Console.WriteLine($"{currency.Key} : {currency.Value}");
// ZEUR : 1000
// XXBT : 1
// XETH : 3
```
## 🔧 Extending Client
The client supports two extensibility points: one right before a request to Kraken is dispatched and one right after a response is received. These points provide additional context specific information (for example, the cost of a particular call) and can be used to implement features such as rate limiting or logging.
Sample extensions implemented in [the test suite](https://github.com/discosultan/KrakenCore/blob/6147afa9f7c6ba6ca38c2dee65102594cacb6fe6/tests/KrakenClient.Tests.cs#L46-L67):
```csharp
var client = new KrakenClient(ApiKey, PrivateKey)
{
InterceptRequest = async req =>
{
// Log request.
output.WriteLine(req.HttpRequest.ToString());
string content = await req.HttpRequest.Content.ReadAsStringAsync();
if (!string.IsNullOrWhiteSpace(content)) output.WriteLine(content);
// Wait if we have hit the API rate limit.
RateLimiter limiter = req.HttpRequest.RequestUri.OriginalString.Contains("/private/")
? privateApiRateLimiter
: publicApiRateLimiter;
await limiter.WaitAccess(req.ApiCallCost);
}
};
```
## 🙏 Related Work
- [C# Kraken API](https://bitbucket.org/arrivets/krakenapi)
- [C# Library to access the Kraken REST API](https://github.com/trenki2/KrakenApi)