mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-11 16:32:57 +00:00
Doc fixes
+20
-7
@@ -1,10 +1,10 @@
|
||||
Changes from 4.x to 5.x:
|
||||
|
||||
## Client structure
|
||||
The client structure has been changed to make clients more consistent across different implementations. Where before clients could either have `client.Method() (bittrexClient.GetTickersAsync())`, `client.[Api].Method() (kcuoinClient.Spot.GetTickersAsync())` or `client.[Api].[Topic].Method() (binanceClient.Spot.Market.GetTickersAsync())`. This has been unified to be `client.[Api]Api.[Topic].Method()`:
|
||||
`bittrexClient.SpotApi.ExchangeData.GetTickersAsync()`
|
||||
`kucoinClient.SpotApi.ExchangeData.GetTickersAsync()`
|
||||
`binanceClient.SpotApi.ExchangeData.GetTickersAsync()`
|
||||
The client structure has been changed to make clients more consistent across different implementations. Where before clients could either have `client.Method()`, `client.[Api].Method()` or `client.[Api].[Topic].Method()`. 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()`
|
||||
|
||||
Socket clients are restructured as `client.[Api]Streams.Method()`:
|
||||
`bittrexClient.SpotStreams.SubscribeToTickerUpdatesAsync()`
|
||||
@@ -15,10 +15,22 @@ Socket clients are restructured as `client.[Api]Streams.Method()`:
|
||||
## 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*
|
||||
````C#
|
||||
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*
|
||||
````C#
|
||||
var binanceClient = new BinanceClient(new BinanceClientOptions()
|
||||
{
|
||||
//
|
||||
// Client options
|
||||
LogLevel = LogLevel.Trace,
|
||||
RequestTimeout = TimeSpan.FromSeconds(60),
|
||||
ApiCredentials = new ApiCredentials("API KEY", "API SECRET"),
|
||||
@@ -31,10 +43,11 @@ var binanceClient = new BinanceClient(new BinanceClientOptions()
|
||||
}
|
||||
});
|
||||
````
|
||||
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:
|
||||
This, in combination with the client restructuring, allows for more logically implemented interfaces, see this example:
|
||||
*V4*
|
||||
````C#
|
||||
var spotClients = new [] {
|
||||
@@ -61,7 +74,7 @@ var futuresClients = new [] {
|
||||
````
|
||||
|
||||
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 mapping logic. It also removes the need for the `Common` prefix on properties:
|
||||
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*
|
||||
````C#
|
||||
var kline = await ((IExhangeClient)binanceClient).GetKlinesAysnc(/*params*/);
|
||||
|
||||
+2
-2
@@ -41,13 +41,13 @@ var client = new BinanceClient(new BinanceClientOptions
|
||||
|
||||
````
|
||||
|
||||
The client instance will have the following options:
|
||||
The client instance will have the following options:
|
||||
`LogLevel = Debug`
|
||||
`OutputOriginalData = true`
|
||||
`ApiCredentials = set`
|
||||
|
||||
## 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 XXXclients).
|
||||
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)).
|
||||
|
||||
````C#
|
||||
|
||||
|
||||
Reference in New Issue
Block a user