1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-11 16:32:57 +00:00

Squashed commit of the following:

commit 90f285d7f6bcd926ce9ca3d5832b1d70a5eae6ab
Author: JKorf <jankorf91@gmail.com>
Date:   Sun Jun 25 19:51:12 2023 +0200

    Docs

commit 72187035c703d1402b37bd2f4c3e066706f28d67
Author: JKorf <jankorf91@gmail.com>
Date:   Sat Jun 24 16:02:53 2023 +0200

    docs

commit 8411977292f1fb0b6e0705b1ad675b79a5311d90
Author: JKorf <jankorf91@gmail.com>
Date:   Fri Jun 23 18:25:15 2023 +0200

    wip

commit cb7d33aad5d2751104c8b8a6c6eadbf0d36b672c
Author: JKorf <jankorf91@gmail.com>
Date:   Fri Jun 2 19:26:26 2023 +0200

    wip

commit 4359a2d05ea1141cff516dab18f364a6ca854e18
Author: JKorf <jankorf91@gmail.com>
Date:   Wed May 31 20:51:36 2023 +0200

    wip

commit c6adb1b2f728d143f6bd667139c619581122a3c9
Author: JKorf <jankorf91@gmail.com>
Date:   Mon May 1 21:13:47 2023 +0200

    wip

commit 7fee733f82fa6ff574030452f0955c9e817647dd
Author: JKorf <jankorf91@gmail.com>
Date:   Thu Apr 27 13:02:56 2023 +0200

    wip

commit f8057313ffc9b0c31effcda71d35d105ea390971
Author: JKorf <jankorf91@gmail.com>
Date:   Mon Apr 17 21:37:51 2023 +0200

    wip
This commit is contained in:
JKorf
2023-06-25 19:58:46 +02:00
parent 19cc020852
commit 690f2a63e5
74 changed files with 1946 additions and 1826 deletions
+25 -45
View File
@@ -5,12 +5,12 @@ nav_order: 2
## How to use the library
Each implementation generally provides two different clients, which will be the access point for the API's. First of the rest client, which is typically available via [ExchangeName]Client, and a socket client, which is generally named [ExchangeName]SocketClient. For example `BinanceClient` and `BinanceSocketClient`.
Each implementation generally provides two different clients, which will be the access point for the API's. First of is the rest client, which is typically available via [ExchangeName]RestClient, and a socket client, which is generally named [ExchangeName]SocketClient. For example `BinanceRestClient` and `BinanceSocketClient`.
## Rest client
The rest client gives access to the Rest endpoint of the API. Rest endpoints are accessed by sending an HTTP request and receiving a response. The client is split in different sub-clients, which are named API Clients. These API clients are then again split in different topics. Typically a Rest client will look like this:
- KucoinClient
- [ExchangeName]RestClient
- SpotApi
- Account
- ExchangeData
@@ -21,6 +21,7 @@ The rest client gives access to the Rest endpoint of the API. Rest endpoints are
- Trading
This rest client has 2 different API clients, the `SpotApi` and the `FuturesApi`, each offering their own set of endpoints.
*Requesting ticker info on the spot API*
```csharp
var client = new KucoinClient();
@@ -30,7 +31,7 @@ var tickersResult = kucoinClient.SpotApi.ExchangeData.GetTickersAsync();
Structuring the client like this should make it easier to find endpoints and allows for separate options and functionality for different API clients. For example, some API's have totally separate API's for futures, with different base addresses and different API credentials, while other API's have implemented this in the same API. Either way, this structure can facilitate a similar interface.
### Rest API client
The Api clients are parts of the total API with a common identifier. In the previous Kucoin example, it separates the Spot and the Futures API. This again is then separated into topics. Most Rest clients implement the following structure:
The Api clients are parts of the total API with a common identifier. In the previous example, it separates the Spot and the Futures API. This again is then separated into topics. Most Rest clients implement the following structure:
**Account**
Endpoints related to the user account. This can for example be endpoints for accessing account settings, or getting account balances. The endpoints in this topic will require API credentials to be provided in the client options.
@@ -44,13 +45,19 @@ Endpoints related to trading. These are endpoints for placing and retrieving ord
### Processing request responses
Each request will return a WebCallResult<T> with the following properties:
`ResponseHeaders`: The headers returned from the server
`ResponseStatusCode`: The status code as returned by the server
`Success`: Whether or not the call was successful. If successful the `Data` property will contain the resulting data, if not successful the `Error` property will contain more details about what the issue was
`Error`: Details on what went wrong with a call. Only filled when `Success` == `false`
`Data`: Data returned by the server
`RequestHeaders`: The headers send to the server in the request message
`RequestMethod`: The Http method of the request
`RequestUrl`: The url the request was send to
`ResponseLength`: The length in bytes of the response message
`ResponseTime`: The duration between sending the request and receiving the response
`ResponseHeaders`: The headers returned from the server
`ResponseStatusCode`: The status code as returned by the server
`Success`: Whether or not the call was successful. If successful the `Data` property will contain the resulting data, if not successful the `Error` property will contain more details about what the issue was
`Error`: Details on what went wrong with a call. Only filled when `Success` == `false`
`OriginalData`: Will contain the originally received unparsed data if this has been enabled in the client options
`Data`: Data returned by the server, only available if `Success` == `true`
When processing the result of a call it should always be checked for success. Not doing so will result in `NullReference` exceptions.
When processing the result of a call it should always be checked for success. Not doing so will result in `NullReference` exceptions when the call fails for whatever reason.
*Check call result*
```csharp
@@ -65,7 +72,7 @@ Console.WriteLine("Result: " + callResult.Data);
```
## Socket client
The socket client gives access to the websocket API of an exchange. Websocket API's offer streams to which updates are pushed to which a client can listen. Some exchanges also offer some degree of functionality by allowing clients to give commands via the websocket, but most exchanges only allow this via the Rest API.
The socket client gives access to the websocket API of an exchange. Websocket API's offer streams to which updates are pushed to which a client can listen, and sometimes also allow request/response communication.
Just like the Rest client is divided in Rest Api clients, the Socket client is divided into Socket Api clients, each with their own range of API functionality. Socket Api clients are generally not divided into topics since the number of methods isn't as big as with the Rest client. To use the Kucoin client as example again, it looks like this:
```csharp
@@ -80,7 +87,7 @@ Just like the Rest client is divided in Rest Api clients, the Socket client is d
var subscribeResult = kucoinSocketClient.SpotStreams.SubscribeToAllTickerUpdatesAsync(DataHandler);
```
Subscribe methods require a data handler parameter, which is the method which will be called when an update is received from the server. This can be the name of a method or a lambda expression.
Subscribe methods always require a data handler parameter, which is the method which will be called when an update is received from the server. This can be the name of a method or a lambda expression.
*Method reference*
```csharp
@@ -100,12 +107,16 @@ await kucoinSocketClient.SpotStreams.SubscribeToAllTickerUpdatesAsync(updateData
});
```
All updates are wrapped in a `DataEvent<>` object, which contain a `Timestamp`, `OriginalData`, `Topic`, and a `Data` property. The `Timestamp` is the timestamp when the data was received (not send!). `OriginalData` will contain the originally received data if this has been enabled in the client options. `Topic` will contain the topic of the update, which is typically the symbol or asset the update is for. The `Data` property contains the received update data.
All updates are wrapped in a `DataEvent<>` object, which contain the following properties:
`Timestamp`: The timestamp when the data was received (not send!)
`OriginalData`: Will contain the originally received unparsed data if this has been enabled in the client options
`Topic`: Will contain the topic of the update, which is typically the symbol or asset the update is for
`Data`: Contains the received update data.
*[WARNING] Do not use `using` statements in combination with constructing a `SocketClient`. Doing so will dispose the `SocketClient` instance when the subscription is done, which will result in the connection getting closed. Instead assign the socket client to a variable outside of the method scope.*
*[WARNING] Do not use `using` statements in combination with constructing a `SocketClient` without blocking the thread. Doing so will dispose the `SocketClient` instance when the subscription is done, which will result in the connection getting closed. Instead assign the socket client to a variable outside of the method scope.*
### Processing subscribe responses
Subscribing to a stream will return a `CallResult<UpdateSubscription>` object. This should be checked for success the same way as the [rest client](#processing-request-responses). The `UpdateSubscription` object can be used to listen for connection events of the socket connection.
Subscribing to a stream will return a `CallResult<UpdateSubscription>` object. This should be checked for success the same way as a [rest request](#processing-request-responses). The `UpdateSubscription` object can be used to listen for connection events of the socket connection.
```csharp
var subscriptionResult = await kucoinSocketClient.SpotStreams.SubscribeToAllTickerUpdatesAsync(DataHandler);
@@ -158,34 +169,3 @@ await kucoinSocketClient.UnsubscribeAsync(subscriptionResult.Data.Id);
When you need to unsubscribe all current subscriptions on a client you can call `UnsubscribeAllAsync` on the client to unsubscribe all streams and close all connections.
## Dependency injection
Each library offers a `Add[Library]` extension method for `IServiceCollection`, which allows you to add the clients to the service collection. It also provides a callback for setting the client options. See this example for adding the `BinanceClient`:
```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddBinance((restClientOptions, socketClientOptions) => {
restClientOptions.ApiCredentials = new ApiCredentials("KEY", "SECRET");
restClientOptions.LogLevel = LogLevel.Trace;
socketClientOptions.ApiCredentials = new ApiCredentials("KEY", "SECRET");
});
}
```
Doing client registration this way will add the `IBinanceClient` as a transient service, and the `IBinanceSocketClient` as a scoped service.
Alternatively, the clients can be registered manually:
```csharp
BinanceClient.SetDefaultOptions(new BinanceClientOptions
{
ApiCredentials = new ApiCredentials("KEY", "SECRET"),
LogLevel = LogLevel.Trace
});
BinanceSocketClient.SetDefaultOptions(new BinanceSocketClientOptions
{
ApiCredentials = new ApiCredentials("KEY", "SECRET"),
});
services.AddTransient<IBinanceClient, BinanceClient>();
services.AddScoped<IBinanceSocketClient, BinanceSocketClient>();
```
+4 -11
View File
@@ -1,6 +1,6 @@
---
title: FAQ
nav_order: 11
nav_order: 12
---
## Frequently asked questions
@@ -48,18 +48,11 @@ private void SomeMethod()
```
### Can I use the TestNet/US/other API with this library
Yes, generally these are all supported and can be configured by setting the BaseAddress in the client options. Some known API addresses should be available in the [Exchange]ApiAddresses class. For example:
Yes, generally these are all supported and can be configured by setting the Environment in the client options. Some known environments should be available in the [Exchange]Environment class. For example:
```csharp
var client = new BinanceClient(new BinanceClientOptions
var client = new BinanceRestClient(options =>
{
SpotApiOptions = new BinanceApiClientOptions
{
BaseAddress = BinanceApiAddresses.TestNet.RestClientAddress
},
UsdFuturesApiOptions = new BinanceApiClientOptions
{
BaseAddress = BinanceApiAddresses.TestNet.UsdFuturesRestClientAddress
}
options.Environment = BinanceEnvironment.Testnet;
});
```
+2 -2
View File
@@ -1,6 +1,6 @@
---
title: Glossary
nav_order: 10
nav_order: 11
---
## Terms and definitions
@@ -18,7 +18,7 @@ nav_order: 10
|Network|Chain|The network of an asset. For example `ETH` allows multiple networks like `ERC20` and `BEP2`|
|Order book|Market depth|A list of (the top rows of) the current best bids and asks|
|Ticker|Stats|Statistics over the last 24 hours|
|Client implementation|Library|An implementation of the `CrytpoExchange.Net` library. For example `Binance.Net` or `FTX.Net`|
|Client implementation|Library|An implementation of the `CrytpoExchange.Net` library. For example `Binance.Net` or `Bybit.Net`|
### Other naming conventions
#### PlaceOrderAsync
+1 -1
View File
@@ -1,6 +1,6 @@
---
title: Common interfaces
nav_order: 5
nav_order: 7
---
## Shared interfaces
+106 -281
View File
@@ -1,320 +1,114 @@
---
title: Log config
nav_order: 4
title: Logging
nav_order: 5
---
## Configuring logging
The library offers extensive logging, for which you can supply your own logging implementation. The logging can be configured via the client options (see [Client options](https://github.com/JKorf/CryptoExchange.Net/wiki/Options)). The examples here are using the `BinanceClient` but they should be the same for each implementation.
The library offers extensive logging, which depends on the dotnet `Microsoft.Extensions.Logging.ILogger` interface. This should provide ease of use when connecting the library logging to your existing logging implementation.
Logging is based on the `Microsoft.Extensions.Logging.ILogger` interface. This should provide ease of use when connecting the library logging to your existing logging implementation.
## Serilog
To make the CryptoExchange.Net logging write to the Serilog logger you can use the following methods, depending on the type of project you're using. The following examples assume that the `Serilog.Sinks.Console` package is already installed.
### Dotnet hosting
With for example an ASP.Net Core or Blazor project the logging can be added to the dependency container, which you can then use to inject it into the client. Make sure to install the `Serilog.AspNetCore` package (https://github.com/serilog/serilog-aspnetcore).
<Details>
<Summary>
Using ILogger injection
</Summary>
<BlockQuote>
Adding `UseSerilog()` in the `CreateHostBuilder` will add the Serilog logging implementation as an ILogger which you can inject into implementations.
*Configuring Serilog as ILogger:*
*Configure logging to write to the console*
```csharp
IServiceCollection services = new ServiceCollection();
services
.AddBinance()
.AddLogging(options =>
{
options.SetMinimumLevel(LogLevel.Trace);
options.AddConsole();
});
```
public static void Main(string[] args)
The library provides a TraceLogger ILogger implementation which writes log messages using `Trace.WriteLine`, but any other logging library can be used.
*Configure logging to use trace logging*
```csharp
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddBinance()
.AddLogging(options =>
{
options.SetMinimumLevel(LogLevel.Trace);
options.AddProvider(new TraceLoggerProvider());
});
```
### Using an external logging library and dotnet DI
With for example an ASP.Net Core or Blazor project the logging can be configured by the dependency container, which can then automatically be used be the clients.
The next example shows how to use Serilog. This assumes the `Serilog.AspNetCore` package (https://github.com/serilog/serilog-aspnetcore) is installed.
*Using serilog:*
```csharp
using Binance.Net;
using Serilog;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBinance();
builder.Host.UseSerilog();
var app = builder.Build();
// startup
app.Run();
```
### Logging without dotnet DI
If you don't have a dependency injection service available because you are for example working on a simple console application you have 2 options for logging.
#### Create a ServiceCollection manually and get the client from the service provider
```csharp
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddBinance();
serviceCollection.AddLogging(options =>
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
options.SetMinimumLevel(LogLevel.Trace);
options.AddConsole();
}).BuildServiceProvider();
CreateHostBuilder(args).Build().Run();
}
var client = serviceCollection.GetRequiredService<IBinanceRestClient>();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
```
#### Create a LoggerFactory manually
*Injecting ILogger:*
```csharp
public class BinanceDataProvider
{
BinanceClient _client;
public BinanceDataProvider(ILogger<BinanceDataProvider> logger)
{
_client = new BinanceClient(new BinanceClientOptions
{
LogLevel = LogLevel.Trace,
LogWriters = new List<ILogger> { logger }
});
}
}
var logFactory = new LoggerFactory();
logFactory.AddProvider(new ConsoleLoggerProvider());
var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options => { });
```
</BlockQuote>
</Details>
<Details>
<Summary>
Using Add[Library] extension method
</Summary>
<BlockQuote>
When using the `Add[Library]` extension method, for instance `AddBinance()`, there is a small issue that there is no available `ILogger<>` yet when adding the library. This can be solved as follows:
*Configuring Serilog as ILogger:*
```csharp
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup(
context => new Startup(context.Configuration, LoggerFactory.Create(config => config.AddSerilog()) )); // <- this allows us to use ILoggerFactory in the Startup.cs
});
```
*Injecting ILogger:*
```csharp
public class Startup
{
private ILoggerFactory _loggerFactory;
public Startup(IConfiguration configuration, ILoggerFactory loggerFactory)
{
Configuration = configuration;
_loggerFactory = loggerFactory;
}
/* .. rest of class .. */
public void ConfigureServices(IServiceCollection services)
{
services.AddBinance((restClientOptions, socketClientOptions) => {
// Point the logging to use the ILogger configuration
restClientOptions.LogWriters = new List<ILogger> { _loggerFactory.CreateLogger<IBinanceClient>() };
});
// Rest of service registrations
}
}
```
</BlockQuote>
</Details>
### Console application
If you don't have a dependency injection service available because you are for example working on a simple console application you can use a slightly different approach.
*Configuring Serilog as ILogger:*
```csharp
var serilogLogger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
var loggerFactory = (ILoggerFactory)new LoggerFactory();
loggerFactory.AddSerilog(serilogLogger);
```
*Injecting ILogger:*
```csharp
var client = new BinanceClient(new BinanceClientOptions
{
LogLevel = LogLevel.Trace,
LogWriters = new List<ILogger> { loggerFactory.CreateLogger("") }
});
```
The `BinanceClient` will now write the logging it produces to the Serilog logger.
## Log4Net
To make the CryptoExchange.Net logging write to the Log4Net logge with for example an ASP.Net Core or Blazor project the logging can be added to the dependency container, which you can then use to inject it into the client you're using. Make sure to install the `Microsoft.Extensions.Logging.Log4Net.AspNetCore` package (https://github.com/huorswords/Microsoft.Extensions.Logging.Log4Net.AspNetCore).
Adding `AddLog4Net()` in the `ConfigureLogging` call will add the Log4Net implementation as an ILogger which you can inject into implementations. Make sure you have a log4net.config configuration file in your project.
*Configuring Log4Net as ILogger:*
```csharp
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureLogging(logging =>
{
logging.AddLog4Net();
logging.SetMinimumLevel(LogLevel.Trace);
});
webBuilder.UseStartup<Startup>();
});
```
*Injecting ILogger:*
```csharp
public class BinanceDataProvider
{
BinanceClient _client;
public BinanceDataProvider(ILogger<BinanceDataProvider> logger)
{
_client = new BinanceClient(new BinanceClientOptions
{
LogLevel = LogLevel.Trace,
LogWriters = new List<ILogger> { logger }
});
}
}
```
If you don't have the Dotnet dependency container available you'll need to provide your own ILogger implementation. See [Custom logger](#custom-logger).
## NLog
To make the CryptoExchange.Net logging write to the NLog logger you can use the following ways, depending on the type of project you're using.
### Dotnet hosting
With for example an ASP.Net Core or Blazor project the logging can be added to the dependency container, which you can then use to inject it into the client you're using. Make sure to install the `NLog.Web.AspNetCore` package (https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5).
Adding `UseNLog()` to the `CreateHostBuilder()` method will add the NLog implementation as an ILogger which you can inject into implementations. Make sure you have a nlog.config configuration file in your project.
*Configuring NLog as ILogger:*
```csharp
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseNLog();
```
*Injecting ILogger:*
```csharp
public class BinanceDataProvider
{
BinanceClient _client;
public BinanceDataProvider(ILogger<BinanceDataProvider> logger)
{
_client = new BinanceClient(new BinanceClientOptions
{
LogLevel = LogLevel.Trace,
LogWriters = new List<ILogger> { logger }
});
}
}
```
If you don't have the Dotnet dependency container available you'll need to provide your own ILogger implementation. See [Custom logger](#custom-logger).
## Custom logger
If you're using a different framework or for some other reason these methods don't work for you you can create a custom ILogger implementation to receive the logging. All you need to do is create an implementation of the ILogger interface and provide that to the client.
*A simple console logging implementation (note that the ConsoleLogger is already available in the CryptoExchange.Net library)*:
```csharp
public class ConsoleLogger : ILogger
{
public IDisposable BeginScope<TState>(TState state) => null;
public bool IsEnabled(LogLevel logLevel) => true;
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
var logMessage = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | {logLevel} | {formatter(state, exception)}";
Console.WriteLine(logMessage);
}
}
```
*Injecting the console logging implementation:*
```csharp
var client = new BinanceClient(new BinanceClientOptions
{
LogLevel = LogLevel.Trace,
LogWriters = new List<ILogger> { new ConsoleLogger() }
});
```
## Provide logging for issues
## Providing logging for issues
A big debugging tool when opening an issue on Github is providing logging of what data caused the issue. This can be provided two ways, via the `OriginalData` property of the call result or data event, or collecting the Trace logging.
### OriginalData
This is only useful when there is an issue in deserialization. So either a call result is giving a Deserialization error, or the result has a value that is unexpected. If that is the issue, please provide the original data that is received so the deserialization issue can be resolved based on the received data.
By default the `OriginalData` property in the `WebCallResult`/`DataEvent` object is not filled as saving the original data has a (very small) performance penalty. To save the original data in the `OriginalData` property the `OutputOriginalData` option should be set to `true` in the client options.
*Enabled output data*
```csharp
var client = new BinanceClient(new BinanceClientOptions
var client = new BinanceClient(options =>
{
OutputOriginalData = true
options.OutputOriginalData = true
});
```
*Accessing original data*
```csharp
// Rest request
var tickerResult = client.SpotApi.ExchangeData.GetTickersAsync();
var originallyRecievedData = tickerResult.OriginalData;
var tickerResult = await client.SpotApi.ExchangeData.GetTickersAsync();
var originallyReceivedData = tickerResult.OriginalData;
// Socket update
client.SpotStreams.SubscribeToAllTickerUpdatesAsync(update => {
await client.SpotStreams.SubscribeToAllTickerUpdatesAsync(update => {
var originallyRecievedData = update.OriginalData;
});
```
### Trace logging
Trace logging, which is the most verbose log level, can be enabled in the client options.
*Enabled output data*
```csharp
var client = new BinanceClient(new BinanceClientOptions
{
LogLevel = LogLevel.Trace
});
```
After enabling trace logging all data send to/received from the server is written to the log writers. By default this is written to the output window in Visual Studio via Debug.WriteLine, though this might be different depending on how you configured your logging.
Trace logging, which is the most verbose log level, will show everything the library does and includes the data that was send and received.
Output data will look something like this:
```
2021-12-17 10:40:42:296 | Debug | Binance | Client configuration: LogLevel: Trace, Writers: 1, OutputOriginalData: False, Proxy: -, AutoReconnect: True, ReconnectInterval: 00:00:05, MaxReconnectTries: , MaxResubscribeTries: 5, MaxConcurrentResubscriptionsPerSocket: 5, SocketResponseTimeout: 00:00:10, SocketNoDataTimeout: 00:00:00, SocketSubscriptionsCombineTarget: , CryptoExchange.Net: v5.0.0.0, Binance.Net: v8.0.0.0
@@ -323,3 +117,34 @@ Output data will look something like this:
2021-12-17 10:40:43:024 | Debug | Binance | [15] Response received in 571ms: {"symbol":"BTCUSDT","priceChange":"-1726.47000000","priceChangePercent":"-3.531","weightedAvgPrice":"48061.51544204","prevClosePrice":"48901.44000000","lastPrice":"47174.97000000","lastQty":"0.00352000","bidPrice":"47174.96000000","bidQty":"0.65849000","askPrice":"47174.97000000","askQty":"0.13802000","openPrice":"48901.44000000","highPrice":"49436.43000000","lowPrice":"46749.55000000","volume":"33136.69765000","quoteVolume":"1592599905.80360790","openTime":1639647642763,"closeTime":1639734042763,"firstId":1191596486,"lastId":1192649611,"count":1053126}
```
When opening an issue, please provide this logging when available.
### Example of serilog config and minimal API's
```csharp
using Binance.Net;
using Binance.Net.Interfaces.Clients;
using Serilog;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.CreateLogger();
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBinance();
builder.Host.UseSerilog();
var app = builder.Build();
// startup
app.Urls.Add("http://localhost:3000");
app.MapGet("/price/{symbol}", async (string symbol) =>
{
var client = app.Services.GetRequiredService<IBinanceRestClient>();
var result = await client.SpotApi.ExchangeData.GetPriceAsync(symbol);
return result.Data.Price;
});
app.Run();
```
+52 -79
View File
@@ -1,100 +1,73 @@
---
title: Migrate v4 to v5
nav_order: 9
title: Migrate v5 to v6
nav_order: 10
---
## Migrating from version 4 to version 5
When updating your code from version 4 implementations to version 5 implementations you will encounter a fair bit of breaking changes. Here is the general outline for changes made in the CryptoExchange.Net library. For more specific changes for each library visit the library migration guide.
## Migrating from version 5 to version 6
When updating your code from version 5 implementations to version 6 implementations you will encounter some breaking changes. Here is the general outline of changes made in the CryptoExchange.Net library. For more specific changes for each library visit the library migration guide.
*NOTE when updating it is not possible to have some client implementations use a V4 version and some clients a V5. When updating all libraries should be migrated*
*NOTE when updating it is not possible to have some client implementations use a V5 version and some clients a V6. When updating all libraries should be migrated*
## Client structure
The client structure has been changed to make clients more consistent across different implementations. Clients using V4 either had `client.Method()`, `client.[Api].Method()` or `client.[Api].[Topic].Method()`.
## Rest client name
To be more clear about different clients for different API's the rest client implementations have been renamed from [Exchange]Client to [Exchange]RestClient. This makes it more clear that it only implements the Rest API and the [Exchange]SocketClient the Socket API.
This has been unified to be `client.[Api]Api.[Topic].Method()`:
`bittrexClient.GetTickersAsync()` -> `bittrexClient.SpotApi.ExchangeData.GetTickersAsync()`
`kucoinClient.Spot.GetTickersAsync()` -> `kucoinClient.SpotApi.ExchangeData.GetTickersAsync()`
`binanceClient.Spot.Market.GetTickersAsync()` -> `binanceClient.SpotApi.ExchangeData.GetTickersAsync()`
## Options
Option parameters have been changed to a callback instead of an options object. This makes processing of the options easier and is in line with how dotnet handles option configurations.
Socket clients are restructured as `client.[Api]Streams.Method()`:
`bittrexClient.SpotStreams.SubscribeToTickerUpdatesAsync()`
`kucoinClient.SpotStreams.SubscribeToTickerUpdatesAsync()`
`binanceClient.SpotStreams.SubscribeToAllTickerUpdatesAsync()`
**BaseAddress**
The BaseAddress option has been replaced by the Environment option. The Environment options allows for selection/switching between different trade environments more easily. For example the environment can be switched between a testnet and live by changing only a single line instead of having to change all BaseAddresses.
**LogLevel/LogWriters**
The logging options have been removed and are now inherited by the DI configuration. See [Logging](https://jkorf.github.io/CryptoExchange.Net/Logging.html) for more info.
## Options structure
The options have been changed in 2 categories, options for the whole client, and options only for a specific sub Api. Some options might no longer be available on the base level and should be set on the Api options instead, for example the `BaseAddress`.
The following example sets some basic options, and specifically overwrites the USD futures Api options to use the test net address and different Api credentials:
*V4*
**HttpClient**
The HttpClient will now be received by the DI container instead of having to pass it manually. When not using DI it is still possible to provide a HttpClient, but it is now located in the client constructor.
*V5*
```csharp
var binanceClient = new BinanceClient(new BinanceApiClientOptions{
LogLevel = LogLevel.Trace,
RequestTimeout = TimeSpan.FromSeconds(60),
ApiCredentials = new ApiCredentials("API KEY", "API SECRET"),
BaseAddressUsdtFutures = new ApiCredentials("OTHER API KEY ONLY FOR USD FUTURES", "OTHER API SECRET ONLY FOR USD FUTURES")
// No way to set separate credentials for the futures API
});
```
*V5*
```csharp
var binanceClient = new BinanceClient(new BinanceClientOptions()
{
// Client options
LogLevel = LogLevel.Trace,
RequestTimeout = TimeSpan.FromSeconds(60),
ApiCredentials = new ApiCredentials("API KEY", "API SECRET"),
// Set options specifically for the USD futures API
UsdFuturesApiOptions = new BinanceApiClientOptions
{
BaseAddress = BinanceApiAddresses.TestNet.UsdFuturesRestClientAddress,
ApiCredentials = new ApiCredentials("OTHER API KEY ONLY FOR USD FUTURES", "OTHER API SECRET ONLY FOR USD FUTURES")
var client = new BinanceClient(new BinanceClientOptions(){
OutputOriginalData = true,
SpotApiOptions = new RestApiOptions {
BaseAddress = BinanceApiAddresses.TestNet.RestClientAddress
}
// Other options
});
```
See [Client options](https://github.com/JKorf/CryptoExchange.Net/wiki/Options) for more details on the specific options.
## IExchangeClient
The `IExchangeClient` has been replaced by the `ISpotClient` and `IFuturesClient`. Where previously the `IExchangeClient` was implemented on the base client level, the `ISpotClient`/`IFuturesClient` have been implemented on the sub-Api level.
This, in combination with the client restructuring, allows for more logically implemented interfaces, see this example:
*V4*
*V6*
```csharp
var spotClients = new [] {
(IExhangeClient)binanceClient,
(IExchangeClient)bittrexClient,
(IExchangeClient)kucoinClient.Spot
};
// There was no common implementation for futures client
var client = new BinanceClient(options => {
options.OutputOriginalData = true;
options.Environment = BinanceEnvironment.Testnet;
// Other options
});
```
*V5*
```csharp
var spotClients = new [] {
binanceClient.SpotApi.CommonSpotClient,
bittrexClient.SpotApi.CommonSpotClient,
kucoinClient.SpotApi.CommonSpotClient
};
## Socket api name
As socket API's are often more than just streams to subscribe to the name of the socket API clients have been changed from [Topic]Streams to [Topic]Api which matches the rest API client names. For example `SpotStreams` has become `SpotApi`, so `binanceSocketClient.UsdFuturesStreams.SubscribeXXX` has become `binanceSocketClient.UsdFuturesApi.SubscribeXXX`.
var futuresClients = new [] {
binanceClient.UsdFuturesApi.CommonFuturesClient,
kucoinClient.FuturesApi.CommonFuturesClient
};
## Add[Exchange] extension method
With the change in options providing the DI extension methods for the IServiceCollection have also been changed slightly. Also the socket clients will now be registered as Singleton by default instead of Scoped.
*V5*
```csharp
builder.Services.AddKucoin((restOpts, socketOpts) =>
{
restOpts.LogLevel = LogLevel.Debug;
restOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS");
socketOpts.LogLevel = LogLevel.Debug;
socketOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS");
}, ServiceLifetime.Singleton);
```
Where the IExchangeClient was returning interfaces which were implemented by models from the exchange, the `ISpotClient`/`IFuturesClient` returns actual objects defined in the `CryptoExchange.Net` library. This shifts the responsibility of parsing
the library model to a shared model from the model class to the client class, which makes more sense and removes the need for separate library models to implement the same mapping logic. It also removes the need for the `Common` prefix on properties:
*V4*
*V6*
```csharp
var kline = await ((IExhangeClient)binanceClient).GetKlinesAysnc(/*params*/);
var closePrice = kline.CommonClose;
```
*V5*
```csharp
var kline = await binanceClient.SpotApi.ComonSpotClient.GetKlinesAysnc(/*params*/);
var closePrice = kline.ClosePrice;
```
For more details on the interfaces see [Common interfaces](interfaces.html)
builder.Services.AddKucoin((restOpts) =>
{
restOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS");
},
(socketOpts) =>
{
socketOpts.ApiCredentials = new KucoinApiCredentials("KEY", "SECRET", "PASS");
});
```
+43 -36
View File
@@ -1,6 +1,6 @@
---
title: Client options
nav_order: 3
nav_order: 4
---
## Setting client options
@@ -10,10 +10,10 @@ Each implementation can be configured using client options. There are 2 ways to
*Set the default options to use for new clients*
```csharp
BinanceClient.SetDefaultOptions(new BinanceClientOptions
BinanceClient.SetDefaultOptions(options =>
{
LogLevel = LogLevel.Trace,
ApiCredentials = new ApiCredentials("KEY", "SECRET")
options.OutputOriginalData = true;
options.ApiCredentials = new ApiCredentials("KEY", "SECRET");
});
```
@@ -21,10 +21,10 @@ BinanceClient.SetDefaultOptions(new BinanceClientOptions
*Set the options to use for a single new client*
```csharp
var client = new BinanceClient(new BinanceClientOptions
var client = new BinanceClient(options =>
{
LogLevel = LogLevel.Trace,
ApiCredentials = new ApiCredentials("KEY", "SECRET")
options.OutputOriginalData = true;
options.ApiCredentials = new ApiCredentials("KEY", "SECRET");
});
```
@@ -32,39 +32,30 @@ var client = new BinanceClient(new BinanceClientOptions
When calling `SetDefaultOptions` each client created after that will use the options that were set, unless the specific option is overriden in the options that were provided to the client. Consider the following example:
```csharp
BinanceClient.SetDefaultOptions(new BinanceClientOptions
BinanceClient.SetDefaultOptions(options =>
{
LogLevel = LogLevel.Trace,
OutputOriginalData = true
options.OutputOriginalData = true;
});
var client = new BinanceClient(new BinanceClientOptions
var client = new BinanceClient(options =>
{
LogLevel = LogLevel.Debug,
ApiCredentials = new ApiCredentials("KEY", "SECRET")
options.OutputOriginalData = false;
});
```
The client instance will have the following options:
`LogLevel = Debug`
`OutputOriginalData = true`
`ApiCredentials = set`
`OutputOriginalData = false`
## Api options
The options are divided in two categories. The basic options, which will apply to everything the client does, and the Api options, which is limited to the specific API client (see [Clients](https://github.com/JKorf/CryptoExchange.Net/wiki/Clients)).
The options are divided in two categories. The basic options, which will apply to everything the client does, and the Api options, which is limited to the specific API client (see [Clients](https://jkorf.github.io/CryptoExchange.Net/Clients.html)).
```csharp
var client = new BinanceClient(new BinanceClientOptions
var client = new BinanceRestClient(options =>
{
LogLevel = LogLevel.Debug,
ApiCredentials = new ApiCredentials("GENERAL-KEY", "GENERAL-SECRET"),
SpotApiOptions = new BinanceApiClientOptions
{
ApiCredentials = new ApiCredentials("SPOT-KEY", "SPOT-SECRET") ,
BaseAddress = BinanceApiAddresses.Us.RestClientAddress
}
options.ApiCredentials = new ApiCredentials("GENERAL-KEY", "GENERAL-SECRET"),
options.SpotOptions.ApiCredentials = new ApiCredentials("SPOT-KEY", "SPOT-SECRET");
});
```
@@ -78,38 +69,39 @@ All clients have access to the following options, specific implementations might
|Option|Description|Default|
|------|-----------|-------|
|`LogWriters`| A list of `ILogger`s to handle log messages. | `new List<ILogger> { new DebugLogger() }` |
|`LogLevel`| The minimum log level before passing messages to the `LogWriters`. Messages with a more verbose level than the one specified here will be ignored. Setting this to `null` will pass all messages to the `LogWriters`.| `LogLevel.Information`
|`OutputOriginalData`|If set to `true` the originally received Json data will be output as well as the deserialized object. For `RestClient` calls the data will be in the `WebCallResult<T>.OriginalData` property, for `SocketClient` subscriptions the data will be available in the `DataEvent<T>.OriginalData` property when receiving an update. | `false`
|`ApiCredentials`| The API credentials to use for accessing protected endpoints. Typically a key/secret combination. Note that this is a `default` value for all API clients, and can be overridden per API client. See the `Base Api client options`| `null`
|`ApiCredentials`| The API credentials to use for accessing protected endpoints. Can either be an API key/secret using Hmac encryption or an API key/private key using RSA encryption for exchanges that support that. See [Credentials](#credentials). Note that this is a `default` value for all API clients, and can be overridden per API client. See the `Base Api client options`| `null`
|`Proxy`|The proxy to use for connecting to the API.| `null`
|`RequestTimeout`|The timeout for client requests to the server| `TimeSpan.FromSeconds(20)`
**Rest client options (extension of base client options)**
|Option|Description|Default|
|------|-----------|-------|
|`RequestTimeout`|The time out to use for requests.|`TimeSpan.FromSeconds(30)`|
|`HttpClient`|The `HttpClient` instance to use for making requests. When creating multiple `RestClient` instances a single `HttpClient` should be provided to prevent each client instance from creating its own. *[WARNING] When providing the `HttpClient` instance in the options both the `RequestTimeout` and `Proxy` client options will be ignored and should be set on the provided `HttpClient` instance.*| `null` |
|`AutoTimestamp`|Whether or not the library should attempt to sync the time between the client and server. If the time between server and client is not in sync authentication errors might occur. This option should be disabled when the client time sure to be in sync.|`true`|
|`TimestampRecalculationInterval`|The interval of how often the time synchronization between client and server should be executed| `TimeSpan.FromHours(1)`
|`Environment`|The environment the library should talk to. Some exchanges have testnet/sandbox environments which can be used instead of the real exchange. The environment option can be used to switch between different trade environments|`Live environment`
**Socket client options (extension of base client options)**
|Option|Description|Default|
|------|-----------|-------|
|`AutoReconnect`|Whether or not the socket should automatically reconnect when disconnected.|`true`
|`AutoReconnect`|Whether or not the socket should attempt to automatically reconnect when disconnected.|`true`
|`ReconnectInterval`|The time to wait between connection tries when reconnecting.|`TimeSpan.FromSeconds(5)`
|`SocketResponseTimeout`|The time in which a response is expected on a request before giving a timeout.|`TimeSpan.FromSeconds(10)`
|`SocketNoDataTimeout`|If no data is received after this timespan then assume the connection is dropped. This is mainly used for API's which have some sort of ping/keepalive system. For example; the Bitfinex API will sent a heartbeat message every 15 seconds, so the `SocketNoDataTimeout` could be set to 20 seconds. On API's without such a mechanism this might not work because there just might not be any update while still being fully connected. | `default(TimeSpan)` (no timeout)
|`SocketSubscriptionsCombineTarget`|The amount of subscriptions that should be made on a single socket connection. Not all exchanges support multiple subscriptions on a single socket. Setting this to a higher number increases subscription speed because not every subscription needs to connect to the server, but having more subscriptions on a single connection will also increase the amount of traffic on that single connection, potentially leading to issues.| Depends on implementation
|`MaxReconnectTries`|The maximum amount of tries for reconnecting|`null` (infinite)
|`MaxResubscribeTries`|The maximum amount of tries for resubscribing after successfully reconnecting the socket|5
|`MaxConcurrentResubscriptionsPerSocket`|The maximum number of concurrent resubscriptions per socket when resubscribing after reconnecting|5
|`MaxSocketConnections`|The maximum amount of distinct socket connections|`null`
|`DelayAfterConnect`|The time to wait before sending messages after connecting to the server.|`TimeSpan.Zero`
|`Environment`|The environment the library should talk to. Some exchanges have testnet/sandbox environments which can be used instead of the real exchange. The environment option can be used to switch between different trade environments|`Live environment`
**Base Api client options**
|Option|Description|Default|
|------|-----------|-------|
|`ApiCredentials`|The API credentials to use for this specific API client. Will override any credentials provided in the base client options|
|`BaseAddress`|The base address to the API. All calls to the API will use this base address as basis for the endpoints. This allows for swapping to test API's or swapping to a different cluster for example. Available base addresses are defined in the [Library]ApiAddresses helper class, for example `KucoinApiAddresses`|Depends on implementation
|`ApiCredentials`|If set to `true` the originally received Json data will be output as well as the deserialized object. For `RestClient` calls the data will be in the `WebCallResult<T>.OriginalData` property, for `SocketClient` subscriptions the data will be available in the `DataEvent<T>.OriginalData` property when receiving an update. Overrides the Base client options `OutputOriginalData` option if set| `false`
|`OutputOriginalData`|The base address to the API. All calls to the API will use this base address as basis for the endpoints. This allows for swapping to test API's or swapping to a different cluster for example. Available base addresses are defined in the [Library]ApiAddresses helper class, for example `KucoinApiAddresses`|Depends on implementation
**Options for Rest Api Client (extension of base api client options)**
@@ -117,6 +109,21 @@ All clients have access to the following options, specific implementations might
|------|-----------|-------|
|`RateLimiters`|A list of `IRateLimiter`s to use.|`new List<IRateLimiter>()`|
|`RateLimitingBehaviour`|What should happen when a rate limit is reached.|`RateLimitingBehaviour.Wait`|
|`AutoTimestamp`|Whether or not the library should attempt to sync the time between the client and server. If the time between server and client is not in sync authentication errors might occur. This option should be disabled when the client time sure to be in sync. Overrides the Rest client options `AutoTimestamp` option if set|`null`|
|`TimestampRecalculationInterval`|The interval of how often the time synchronization between client and server should be executed. Overrides the Rest client options `TimestampRecalculationInterval` option if set| `TimeSpan.FromHours(1)`
**Options for Socket Api Client (extension of base api client options)**
There are currently no specific options for socket API clients, the base API options are still available.
|Option|Description|Default|
|------|-----------|-------|
|`SocketNoDataTimeout`|If no data is received after this timespan then assume the connection is dropped. This is mainly used for API's which have some sort of ping/keepalive system. For example; the Bitfinex API will sent a heartbeat message every 15 seconds, so the `SocketNoDataTimeout` could be set to 20 seconds. On API's without such a mechanism this might not work because there just might not be any update while still being fully connected. Overrides the Socket client options `SocketNoDataTimeout` option if set | `default(TimeSpan)` (no timeout)
|`MaxSocketConnections`|The maximum amount of distinct socket connections. Overrides the Socket client options `MaxSocketConnections` option if set |`null`
## Credentials
Credentials are supported in 3 formats in the base library:
|Type|Description|Example|
|----|-----------|-------|
|`Hmac`|An API key + secret combination. The API key is send with the request and the secret is used to sign requests. This is the default authentication method on all exchanges. |`options.ApiCredentials = new ApiCredentials("51231f76e-9c503548-8fabs3f-rfgf12mkl3", "556be32-d563ba53-faa2dfd-b3n5c", CredentialType.Hmac);`|
|`RsaPem`|An API key + a public and private key pair generated by the user. The public key is shared with the exchange, while the private key is used to sign requests. This CredentialType expects the private key to be in .pem format and is only supported in .netstandard2.1 due to limitations of the framework|`options.ApiCredentials = new ApiCredentials("432vpV8daAaXAF4Qg", ""-----BEGIN PRIVATE KEY-----[PRIVATEKEY]-----END PRIVATE KEY-----", CredentialType.RsaPem);`|
|`RsaXml`|An API key + a public and private key pair generated by the user. The public key is shared with the exchange, while the private key is used to sign requests. This CredentialType expects the private key to be in xml format and is supported in .netstandard2.0 and .netstandard2.1, but it might mean the private key needs to be converted from the original format to xml|`options.ApiCredentials = new ApiCredentials("432vpV8daAaXAF4Qg", "<RSAKeyValue>[PRIVATEKEY]</RSAKeyValue>", CredentialType.RsaXml);`|
+14 -3
View File
@@ -4,11 +4,11 @@ nav_order: 6
---
## Locally synced order book
Each implementation provides an order book implementation. These implementations will provide a client side order book and will take care of synchronization with the server, and will handle reconnecting and resynchronizing in case of a dropped connection.
Each exchange implementation provides an order book implementation. These implementations will provide a client side order book and will take care of synchronization with the server, and will handle reconnecting and resynchronizing in case of a dropped connection.
Order book implementations are named as `[ExchangeName][Type]SymbolOrderBook`, for example `BinanceSpotSymbolOrderBook`.
## Usage
Start the book synchronization by calling the `StartAsync` method. This returns a success state whether the book is successfully synchronized and started. You can listen to the `OnStatusChange` event to be notified of when the status of a book changes. Note that the order book is only synchronized with the server when the state is `Synced`.
Start the book synchronization by calling the `StartAsync` method. This returns whether the book is successfully synchronized and started. You can listen to the `OnStatusChange` event to be notified of when the status of a book changes. Note that the order book is only synchronized with the server when the state is `Synced`. When the order book has been started and the state changes from `Synced` to `Reconnecting` the book will automatically reconnect and resync itself.
*Start an order book and print the top 3 rows*
```csharp
@@ -24,6 +24,7 @@ if (!startResult.Success)
while(true)
{
Console.Clear();
Console.WriteLine(book.ToString(3);
await Task.Delay(500);
}
@@ -54,4 +55,14 @@ book.OnStatusChange += (oldStatus, newStatus) => { Console.WriteLine($"State cha
book.OnOrderBookUpdate += (bidsAsks) => { Console.WriteLine($"Order book changed: {bidsAsks.Asks.Count()} asks, {bidsAsks.Bids.Count()} bids"); };
book.OnBestOffersChanged += (bestOffer) => { Console.WriteLine($"Best offer changed, best bid: {bestOffer.BestBid.Price}, best ask: {bestOffer.BestAsk.Price}"); };
```
```
### Order book factory
Each exchange implementation also provides an order book factory for creating ISymbolOrderBook instances. The naming convention for the factory is `[Exchange]OrderBookFactory`, for example `BinanceOrderBookFactory`. This type will be automatically added when using DI and can be used to facilitate easier testing.
*Creating an order book using the order book factory*
```csharp
var factory = services.GetRequiredService<IKucoinOrderBookFactory>();
var book = factory.CreateSpot("ETH-USDT");
var startResult = await book.StartAsync();
```
+1 -1
View File
@@ -1,6 +1,6 @@
---
title: Rate limiting
nav_order: 7
nav_order: 9
---
## Rate limiting
+2 -5
View File
@@ -17,7 +17,6 @@ These will always be on the latest CryptoExchange.Net version and the latest ver
|<a href="https://github.com/JKorf/Bittrex.Net"><img src="https://github.com/JKorf/Bittrex.Net/blob/master/Bittrex.Net/Icon/icon.png?raw=true"></a>|Bittrex|https://jkorf.github.io/Bittrex.Net/|
|<a href="https://github.com/JKorf/Bybit.Net"><img src="https://github.com/JKorf/Bybit.Net/blob/main/ByBit.Net/Icon/icon.png?raw=true"></a>|Bybit|https://jkorf.github.io/Bybit.Net/|
|<a href="https://github.com/JKorf/CoinEx.Net"><img src="https://github.com/JKorf/CoinEx.Net/blob/master/CoinEx.Net/Icon/icon.png?raw=true"></a>|CoinEx|https://jkorf.github.io/CoinEx.Net/|
|<a href="https://github.com/JKorf/FTX.Net"><img src="https://github.com/JKorf/FTX.Net/blob/main/FTX.Net/Icon/icon.png?raw=true"></a>|FTX|https://jkorf.github.io/FTX.Net/|
|<a href="https://github.com/JKorf/Huobi.Net"><img src="https://github.com/JKorf/Huobi.Net/blob/master/Huobi.Net/Icon/icon.png?raw=true"></a>|Huobi|https://jkorf.github.io/Huobi.Net/|
|<a href="https://github.com/JKorf/Kraken.Net"><img src="https://github.com/JKorf/Kraken.Net/blob/master/Kraken.Net/Icon/icon.png?raw=true"></a>|Kraken|https://jkorf.github.io/Kraken.Net/|
|<a href="https://github.com/JKorf/Kucoin.Net"><img src="https://github.com/JKorf/Kucoin.Net/blob/master/Kucoin.Net/Icon/icon.png?raw=true"></a>|Kucoin|https://jkorf.github.io/Kucoin.Net/|
@@ -52,16 +51,14 @@ Use one of the following following referral links to signup to a new exchange to
[Bittrex](https://bittrex.com/discover/join?referralCode=TST-DJM-CSX)
[Bybit](https://partner.bybit.com/b/jkorf)
[CoinEx](https://www.coinex.com/register?refer_code=hd6gn)
[FTX](https://ftx.com/referrals#a=31620192)
[Huobi](https://www.huobi.com/en-us/v/register/double-invite/?inviter_id=11343840&invite_code=fxp93)
[Kucoin](https://www.kucoin.com/ucenter/signup?rcode=RguMux)
### Donate
Make a one time donation in a crypto currency of your choice. If you prefer to donate a currency not listed here please contact me.
**Btc**: 12KwZk3r2Y3JZ2uMULcjqqBvXmpDwjhhQS
**Eth**: 0x069176ca1a4b1d6e0b7901a6bc0dbf3bb0bf5cc2
**Nano**: xrb_1ocs3hbp561ef76eoctjwg85w5ugr8wgimkj8mfhoyqbx4s1pbc74zggw7gs
**Btc**: bc1qz0jv0my7fc60rxeupr23e75x95qmlq6489n8gh
**Eth**: 0x8E21C4d955975cB645589745ac0c46ECA8FAE504
### Sponsor
Alternatively, sponsor me on Github using [Github Sponsors](https://github.com/sponsors/JKorf).