Skip to content

πŸ’± .NET client for Kraken Bitcoin & cryptocurrency exchange API

License

Notifications You must be signed in to change notification settings

discosultan/KrakenCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KrakenCore

NuGet Package AppVeyor Build Status Travis Build Status

⚠ 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 as it is subject to change.

πŸŽ‰ Features

  • Β βœ– Cross-platform based on .NET Standard 2.0
  • πŸ” Asynchronous API using async and await
  • πŸ’ͺ Strongly typed models
  • πŸ›‚ Covered with tests
  • πŸ” Supports two-factor authentication

πŸ“¦ Getting Started

using KrakenCore;
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:

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

About

πŸ’± .NET client for Kraken Bitcoin & cryptocurrency exchange API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages