.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 as it is subject to change.
- Β β Cross-platform based on .NET Standard 2.0
- π Asynchronous API using async and await
- πͺ Strongly typed models
- π Covered with tests
- π Supports two-factor authentication
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
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);
}
};