diff --git a/README.md b/README.md index f1b3c7b2..42117166 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ The following API's are directly supported. Note that there are 3rd party implem |Mexc|[JKorf/Mexc.Net](https://github.com/JKorf/Mexc.Net)|[![Nuget version](https://img.shields.io/nuget/v/JK.Mexc.net.svg?style=flat-square)](https://www.nuget.org/packages/JK.Mexc.Net)| |OKX|[JKorf/OKX.Net](https://github.com/JKorf/OKX.Net)|[![Nuget version](https://img.shields.io/nuget/v/JK.OKX.net.svg?style=flat-square)](https://www.nuget.org/packages/JK.OKX.Net)| |WhiteBit|[JKorf/WhiteBit.Net](https://github.com/JKorf/WhiteBit.Net)|[![Nuget version](https://img.shields.io/nuget/v/WhiteBit.net.svg?style=flat-square)](https://www.nuget.org/packages/WhiteBit.Net)| +|XT|[JKorf/XT.Net](https://github.com/JKorf/XT.Net)|[![Nuget version](https://img.shields.io/nuget/v/XT.net.svg?style=flat-square)](https://www.nuget.org/packages/XT.Net)| Any of these can be installed independently or install [CryptoClients.Net](https://github.com/jkorf/CryptoClients.Net) which includes all exchange API's. diff --git a/docs/index.html b/docs/index.html index a638ec6e..161288e8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -163,6 +163,7 @@

CryptoExchange.Net & Implementations

MexcJKorf/Mexc.Net OKXJKorf/OKX.Net WhiteBitJKorf/WhiteBit.Net + XTJKorf/XT.Net

Note that there are 3rd party implementations going around, but only the listed ones here are created and supported by me.

When using multiple of these API's the CryptoClients.Net package can be used which combines these packages and allows easy access to all exchange API's.

@@ -279,7 +280,10 @@

Installation

OKX +
@@ -347,6 +351,9 @@

Installation

dotnet add package WhiteBit.Net
+
+
dotnet add package XT.Net
+
@@ -415,6 +422,9 @@

Dependency Injection

+
@@ -471,6 +481,9 @@

Dependency Injection

builder.Services.AddWhiteBit();
+
+
builder.Services.AddXT();
+
@@ -531,6 +544,9 @@

Dependency Injection

+
@@ -1111,6 +1127,39 @@

Dependency Injection

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InterfaceDescription
IXTRestClientThe client for accessing the XT REST API
IXTSocketClientThe client for accessing the XT Websocket API
IXTOrderBookFactoryA factory for creating SymbolOrderBook instances for the XT API
IXTTrackerFactoryA factory for creating kline and trade Tracker instances for the XT API
ICryptoRestClientAn aggregating client from which multiple different library REST clients can be accessed
ICryptoSocketClientAn aggregating client from which multiple different library Websocket clients can be accessed
ISharedClientVarious interfaces deriving from ISharedClient which can be used for common functionality
+
@@ -1190,6 +1239,9 @@

REST API client

+
@@ -1404,6 +1456,18 @@

REST API client

// Handle error, tickersResult.Error contains more information } else +{ + // Handle data, tickersResult.Data will contain the actual data +} +
+
+
var client = new XTRestClient();
+var tickersResult = await client.SpotApi.ExchangeData.GetTickersAsync();
+if (!tickersResult.Success)
+{
+  // Handle error, tickersResult.Error contains more information
+}
+else
 {
   // Handle data, tickersResult.Data will contain the actual data
 }
@@ -1533,6 +1597,9 @@

Subscribing

+
@@ -1711,7 +1778,7 @@

Subscribing

} // Subscribing was successfull, the data will now be streamed into the data handler
-
+
var client = new WhiteBitSocketClient();
 var subscribeResult = await client.V4Api.ExchangeData.SubscribeToTickerUpdatesAsync("ETH_USDT", update => {
     // Handle the data update, update.Data will contain the actual data
@@ -1722,6 +1789,18 @@ 

Subscribing

} // Subscribing was successfull, the data will now be streamed into the data handler
+
+
var client = new XTSocketClient();
+var subscribeResult = await client.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync("eth_usdt", update => {
+    // Handle the data update, update.Data will contain the actual data
+});
+if (!subscribeResult.Success)
+{
+  // Handle error, subscribeResult.Error contains more information on why the subscription failed
+}
+// Subscribing was successfull, the data will now be streamed into the data handler
+
+
@@ -1922,6 +2001,9 @@

Cross Exchange Development

+
@@ -2105,6 +2187,19 @@

Cross Exchange Development

// Futures and Spot API common functionality socket client var spotSharedSocketClient = whitebitSocketClient.V4Api.SharedClient;
+
+
Spot API common functionality rest client
+var spotSharedRestClients = xtRestClient.SpotApi.SharedClient;
+
+Futures API common functionality rest client
+var futuresSharedRestClients = xtRestClient.UsdtFuturesApi.SharedClient;
+
+// Spot API common functionality socket client
+var spotSharedSocketClient = xtSocketClient.SpotApi.SharedClient;
+
+// Futures API common functionality socket client
+var futuresSharedSocketClient = xtSocketClient.FuturesApi.SharedClient;
+

TradingMode

@@ -2232,6 +2327,7 @@

Available Interfaces

ILeverageRestClientFor managing leverage for a Futures symbol IPositionHistoryRestClientFor requesting the user position closing history IPositionModeRestClientFor managing the position mode for the user + IFeeRestClientFor requesting maker and taker trading fee percentages for the user

Available Socket shared interfaces

@@ -2391,6 +2487,9 @@

Setting options

+
@@ -2605,6 +2704,18 @@

Setting options

// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration builder.Services.AddWhiteBit(builder.Configuration.GetSection("WhiteBit"));
+
+
builder.Services.AddXT(
+  options => {
+    options.Rest.RequestTimeout = TimeSpan.FromSeconds(30);
+    options.Socket.RequestTimeout = TimeSpan.FromSeconds(5);
+  });
+  
+// OR
+  
+// see https://github.com/JKorf/CryptoExchange.Net/tree/master/Examples/example-config.json for an example configuration
+builder.Services.AddXT(builder.Configuration.GetSection("XT"));
+
@@ -2666,6 +2777,9 @@

Setting options

+
@@ -2772,6 +2886,12 @@

Setting options

var client = new WhiteBitRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new XTRestClient(opts =>
 {
     opts.RequestTimeout = TimeSpan.FromSeconds(30);
 });
@@ -2834,6 +2954,9 @@

Setting options

+
@@ -2955,6 +3078,13 @@

Setting options

}); var client = new WhiteBitRestClient();
+
+
XTRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new XTRestClient();
+
@@ -3189,6 +3319,9 @@

Orderbooks

+
@@ -3409,6 +3542,19 @@

Orderbooks

} // Book has successfully started and synchronized +// Once no longer needed you can stop the live sync functionality by calling StopAsync() +await book.StopAsync(); + +
+
+
var book = new XTSymbolOrderBook("eth_usdt");
+var startResult = await book.StartAsync();
+if (!startResult.Success)
+{
+  // Handle error, error info available in startResult.Error
+}
+// Book has successfully started and synchronized
+
 // Once no longer needed you can stop the live sync functionality by calling StopAsync()
 await book.StopAsync();
 
@@ -3582,6 +3728,9 @@

Trackers

+
@@ -3921,6 +4070,26 @@

Trackers

// Tracker has successfully started // Note that it might not be fully synced yet, check tracker.Status for this. +// Once no longer needed you can stop the live sync functionality by calling StopAsync() +await tracker.StopAsync(); + +
+
+
// Either create a new factory or inject the IXTTrackerFactory interface
+var factory = new XTTrackerFactory();
+
+var symbol = new SharedSymbol(TradingMode.Spot, "ETH", "USDT");
+
+// Create a tracker for ETH/USDT keeping track of trades in the last 5 minutes
+var tracker = factory.CreateTradeTracker(symbol, period: TimeSpan.FromMinutes(5));
+var startResult = await tracker.StartAsync();
+if (!startResult.Success)
+{
+  // Handle error, error info available in startResult.Error
+}
+// Tracker has successfully started
+// Note that it might not be fully synced yet, check tracker.Status for this.
+
 // Once no longer needed you can stop the live sync functionality by calling StopAsync()
 await tracker.StopAsync();
 
@@ -4274,6 +4443,9 @@

Ratelimiting

+
@@ -4474,6 +4646,20 @@

Ratelimiting

To be notified of when a rate limit is hit the static WhiteBitExchange.RateLimiter exposes an event which triggers when a rate limit is reached

WhiteBitExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
 
+
+
+
+
services.AddXT(x =>
+    x.RatelimiterEnabled = true;
+    x.RateLimitingBehaviour = RateLimitingBehaviour.Wait;
+}, x =>
+{
+    x.RatelimiterEnabled = true;
+    x.RateLimitingBehaviour = RateLimitingBehaviour.Wait;
+});
+

To be notified of when a rate limit is hit the static XTExchange.RateLimiter exposes an event which triggers when a rate limit is reached

+
XTExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
+
 
@@ -4576,6 +4762,9 @@
WhiteBit +
WhiteBit +
WhiteBit +
+
WhiteBit +
WhiteBit +