diff --git a/Examples/BlazorClient/BlazorClient.csproj b/Examples/BlazorClient/BlazorClient.csproj index b9bf64f..d08e083 100644 --- a/Examples/BlazorClient/BlazorClient.csproj +++ b/Examples/BlazorClient/BlazorClient.csproj @@ -5,20 +5,21 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/Examples/BlazorClient/Pages/Index.razor b/Examples/BlazorClient/Pages/Index.razor index 3772236..aa33306 100644 --- a/Examples/BlazorClient/Pages/Index.razor +++ b/Examples/BlazorClient/Pages/Index.razor @@ -7,6 +7,7 @@ @inject IBybitRestClient bybitClient @inject ICoinbaseRestClient coinbaseClient @inject ICoinExRestClient coinexClient +@inject ICryptoComRestClient cryptocomClient @inject IGateIoRestClient gateioClient @inject IHTXRestClient huobiClient @inject IKrakenRestClient krakenClient @@ -33,6 +34,7 @@ var bybitTask = bybitClient.V5Api.ExchangeData.GetSpotTickersAsync("BTCUSDT"); var coinbaseTask = coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT"); var coinexTask = coinexClient.SpotApi.ExchangeData.GetTickerAsync("BTCUSDT"); + var cryptocomTask = cryptocomClient.ExchangeApi.ExchangeData.GetTickersAsync("BTC_USDT"); var gateioTask = gateioClient.SpotApi.ExchangeData.GetTickersAsync("BTC_USDT"); var htxTask = huobiClient.SpotApi.ExchangeData.GetTickerAsync("btcusdt"); var krakenTask = krakenClient.SpotApi.ExchangeData.GetTickerAsync("XBTUSD"); @@ -66,6 +68,9 @@ if (coinexTask.Result.Success) _prices.Add("CoinEx", coinexTask.Result.Data.Ticker.LastPrice); + if (cryptocomTask.Result.Success) + _prices.Add("CryptoCom", cryptocomTask.Result.Data.First().LastPrice ?? 0); + if (gateioTask.Result.Success) _prices.Add("GateIo", gateioTask.Result.Data.First().LastPrice); diff --git a/Examples/BlazorClient/Pages/LiveData.razor b/Examples/BlazorClient/Pages/LiveData.razor index ec5f879..b51f5a9 100644 --- a/Examples/BlazorClient/Pages/LiveData.razor +++ b/Examples/BlazorClient/Pages/LiveData.razor @@ -7,6 +7,7 @@ @inject IBybitSocketClient bybitSocketClient @inject ICoinbaseSocketClient coinbaseSocketClient @inject ICoinExSocketClient coinExSocketClient +@inject ICryptoComSocketClient cryptocomSocketClient @inject IGateIoSocketClient gateioSocketClient @inject IHTXSocketClient htxSocketClient @inject IKrakenSocketClient krakenSocketClient @@ -41,9 +42,10 @@ bybitSocketClient.V5SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("Bybit", data.Data.LastPrice)), coinExSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETHBTC", data => UpdateData("CoinEx", data.Data.LastPrice)), coinbaseSocketClient.AdvancedTradeApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Coinbase", data.Data.LastPrice)), + cryptocomSocketClient.ExchangeApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("CryptoCom", data.Data.LastPrice ?? 0)), gateioSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH_BTC", data => UpdateData("GateIo", data.Data.LastPrice)), htxSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ethbtc", data => UpdateData("HTX", data.Data.ClosePrice ?? 0)), - krakenSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH/XBT", data => UpdateData("Kraken", data.Data.LastTrade.Price)), + krakenSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH/XBT", data => UpdateData("Kraken", data.Data.LastPrice)), kucoinSocketClient.SpotApi.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("Kucoin", data.Data.LastPrice ?? 0)), mexcSocketClient.SpotApi.SubscribeToMiniTickerUpdatesAsync("ETHBTC", data => UpdateData("Mexc", data.Data.LastPrice)), okxSocketClient.UnifiedApi.ExchangeData.SubscribeToTickerUpdatesAsync("ETH-BTC", data => UpdateData("OKX", data.Data.LastPrice ?? 0)), diff --git a/Examples/BlazorClient/Pages/OrderBooks.razor b/Examples/BlazorClient/Pages/OrderBooks.razor index e102bcd..1bec6f7 100644 --- a/Examples/BlazorClient/Pages/OrderBooks.razor +++ b/Examples/BlazorClient/Pages/OrderBooks.razor @@ -10,6 +10,7 @@ @using CoinEx.Net.Interfaces @using Coinbase.Net.Interfaces @using CryptoExchange.Net.Interfaces +@using CryptoCom.Net.Interfaces @using GateIo.Net.Interfaces @using HTX.Net.Interfaces @using Kraken.Net.Interfaces @@ -25,6 +26,7 @@ @inject IBybitOrderBookFactory bybitFactory @inject ICoinbaseOrderBookFactory coinbaseFactory @inject ICoinExOrderBookFactory coinExFactory +@inject ICryptoComOrderBookFactory cryptocomFactory @inject IGateIoOrderBookFactory gateioFactory @inject IHTXOrderBookFactory htxFactory @inject IKrakenOrderBookFactory krakenFactory @@ -72,6 +74,7 @@ { "Bybit", bybitFactory.Create("ETHBTC", Bybit.Net.Enums.Category.Spot) }, { "Coinbase", coinbaseFactory.Create("ETH-BTC", null) }, { "CoinEx", coinExFactory.CreateSpot("ETHBTC") }, + { "CryptoCom", cryptocomFactory.CreateExchange("ETH_BTC") }, { "GateIo", gateioFactory.CreateSpot("ETH_BTC") }, { "HTX", htxFactory.CreateSpot("ethbtc") }, { "Kraken", krakenFactory.CreateSpot("ETH/XBT") }, diff --git a/Examples/BlazorClient/Shared/NavMenu.razor b/Examples/BlazorClient/Shared/NavMenu.razor index 12b1f0a..d691d6e 100644 --- a/Examples/BlazorClient/Shared/NavMenu.razor +++ b/Examples/BlazorClient/Shared/NavMenu.razor @@ -14,7 +14,7 @@ + @@ -307,6 +311,9 @@
dotnet add package CoinEx.Net
+
+
dotnet add package CryptoCom.Net
+
dotnet add package GateIo.Net
@@ -373,6 +380,9 @@ + @@ -422,6 +432,9 @@
builder.Services.AddCoinEx();
+
+
+
builder.Services.AddCryptoCom();
builder.Services.AddGateIo();
@@ -477,6 +490,9 @@ + @@ -775,6 +791,35 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
InterfaceDescription
ICryptoComRestClientThe client for accessing the Crypto.com REST API
ICryptoComSocketClientThe client for accessing the Crypto.com Websocket API
ICryptoComOrderBookFactoryA factory for creating SymbolOrderBook instances for the Crypto.com 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
+
@@ -1004,6 +1049,9 @@ + @@ -1140,6 +1188,18 @@ if (!tickersResult.Success) // Handle error, tickersResult.Error contains more information } else +{ + // Handle data, tickersResult.Data will contain the actual data +} + +
+
var client = new CryptoComRestClient();
+var tickersResult = await client.ExchangeApi.ExchangeData.GetTickersAsync();
+if (!tickersResult.Success)
+{
+  // Handle error, tickersResult.Error contains more information
+}
+else
 {
   // Handle data, tickersResult.Data will contain the actual data
 }
@@ -1317,6 +1377,9 @@ else + @@ -1434,6 +1497,17 @@ 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 +
+
+
var client = new CryptoComSocketClient();
+var subscribeResult = await client.ExchangeApi.SubscribeToTickerUpdatesAsync("ETH_USD", 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
@@ -1681,6 +1755,9 @@ var binanceTriggered = CheckForTrigger(lastBinanceTicker); + @@ -1798,7 +1875,14 @@ var usdFuturesSharedRestClient = coinExRestClient.FuturesApi.SharedClient; // Futures API common functionality socket client var usdFuturesSharedSocketClient = coinExSocketClient.FuturesApi.SharedClient; -
+ +
+
// Spot/Futures API common functionality rest client
+var sharedRestClients = cryptoComRestClient.ExchangeApi.SharedClient;
+
+// Spot/Futures API common functionality socket client
+var sharedSocketClient = cryptoComSocketClient.ExchangeApi.SharedClient;
+
// Spot API common functionality rest client
 var spotSharedRestClients = gateioRestClient.SpotApi.SharedClient;
@@ -2127,6 +2211,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
 			  
+			  
 			  
@@ -2227,6 +2314,15 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
 			  
builder.Services.AddCoinEx(
+  restOptions => {
+    restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
+  },
+  socketOptions => {
+    socketOptions.RequestTimeout = TimeSpan.FromSeconds(10);
+  });
+
+
+
builder.Services.AddCryptoCom(
   restOptions => {
     restOptions.RequestTimeout = TimeSpan.FromSeconds(30);
   },
@@ -2325,6 +2421,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
 			  
+			  
 			  
@@ -2401,6 +2500,12 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY
 			  
var client = new CoinExRestClient(opts =>
+{
+    opts.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+
+
+
var client = new CryptoComRestClient(opts =>
 {
     opts.RequestTimeout = TimeSpan.FromSeconds(30);
 });
@@ -2475,6 +2580,9 @@ options.ApiCredentials = new ApiCredentials("YOUR PUBLIC KEY", "YOUR PRIVATE KEY + @@ -2557,6 +2665,13 @@ var client = new CoinGeckoRestClient();
options.RequestTimeout = TimeSpan.FromSeconds(30); }); var client = new CoinExRestClient();
+
+
+
CryptoComRestClient.SetDefaultOptions(options =>
+{
+    options.RequestTimeout = TimeSpan.FromSeconds(30);
+});
+var client = new CryptoComRestClient();
GateIoRestClient.SetDefaultOptions(options =>
@@ -2810,6 +2925,9 @@ var client = new OKXRestClient();
+ @@ -2957,6 +3075,19 @@ if (!startResult.Success) } // 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 CryptoComSpotSymbolOrderBook("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();
 
@@ -3204,6 +3335,9 @@ var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options + @@ -3304,6 +3438,20 @@ var binanceClient = new BinanceRestClient(new HttpClient(), logFactory, options

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

CoinbaseExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
 
+
+
+
+
services.AddCryptoCom(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 CryptoComExchange.RateLimiter exposes an event which triggers when a rate limit is reached

+
CryptoComExchange.RateLimiter.RateLimitTriggered += (rateLimitEvent) => Console.WriteLine("Limit triggered: " + rateLimitEvent);
+
 
@@ -3472,6 +3620,9 @@ var responseSource = result.DataSource; + @@ -3519,6 +3670,9 @@ await exchangeRestClient.Binance.SpotApi.ExchangeData.GetExchangeInfoAsync();
await coinExClient.SpotApiV2.ExchangeData.GetSymbolsAsync();
+
+
+
await cryptoComClient.ExchangeApi.ExchangeData.GetSymbolsAsync();
await gateIoClient.SpotApi.ExchangeData.GetSymbolsAsync();
@@ -3583,6 +3737,9 @@ await exchangeRestClient.Binance.SpotApi.ExchangeData.GetExchangeInfoAsync(); Coinex + @@ -3631,6 +3788,9 @@ await coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT");
await coinExClient.SpotApiV2.ExchangeData.GetTickersAsync(new[] { "BTCUSDT" });
+
+
+
await cryptoComClient.ExchangeApi.ExchangeData.GetTickersAsync("BTC_USDT");
await gateioClient.SpotApi.ExchangeData.GetTickersAsync("BTC_USDT");
@@ -3695,6 +3855,9 @@ await coinbaseClient.AdvancedTradeApi.ExchangeData.GetSymbolAsync("BTC-USDT"); Coinex + @@ -3742,6 +3905,9 @@ await exchangeRestClient.Binance.SpotApi.Account.GetBalancesAsync();
await coinExClient.SpotApiV2.Account.GetBalancesAsync();
+
+
+
await cryptoComClient.ExchangeApi.Account.GetBalancesAsync();
await gateioClient.SpotApi.Account.GetBalancesAsync();
@@ -3810,6 +3976,9 @@ var result = await htxClient.SpotApi.Account.GetBalancesAsync(); + @@ -3857,6 +4026,9 @@ await exchangeRestClient.Binance.SpotApi.Trading.PlaceOrderAsync("BTCUSDT", Orde
await coinExClient.SpotApiV2.Trading.PlaceOrderAsync("BTCUSDT", AccountType.Spot, OrderSide.Buy, OrderTypeV2.Limit, 0.1m, 50000);
+
+
+
await cryptoComClient.ExchangeApi.Trading.PlaceOrderAsync("BTC_USDT", OrderSide.Buy, OrderType.Limit, 0.1m, price: 50000, timeInForce: TimeInForce.GoodTillCancel);
await gateIoClient.SpotApi.Trading.PlaceOrderAsync("BTC_USDT", OrderSide.Buy, NewOrderType.Limit, 0.1m, 50000, timeInForce: TimeInForce.GoodTillCancel);
@@ -3925,6 +4097,9 @@ var result = await htxClient.SpotApi.Trading.PlaceOrderAsync(account.Id, "BTCUSD + @@ -3989,6 +4164,11 @@ await exchangeSocketClient.Binance.SpotApi.ExchangeData.SubscribeToTickerUpdates
await coinExSocketClient.SpotApiV2.SubscribeToTickerUpdatesAsync(new[] { "ETHUSDT" }, data => {
     // Handle update
+});
+
+
+
await cryptoComSocketClient.ExchangeApi.SubscribeToTickerUpdatesAsync("ETH_USDT", data => {
+    // Handle update
 });
@@ -4044,7 +4224,7 @@ await exchangeSocketClient.Binance.SpotApi.ExchangeData.SubscribeToTickerUpdates CryptoClients + @@ -4108,7 +4291,7 @@ _ = Task.Run(async () => { } });
-
+
// Retrieve the listen key
 var listenKey = await binanceClient.SpotApi.Account.StartUserStreamAsync();
 
@@ -4174,6 +4357,11 @@ _ = Task.Run(async () => {
 					  
await coinExSocketClient.SpotApiV2.SubscribeToOrderUpdatesAsync(data => {
     // Handle update
+});
+
+
+
await cryptoComSocketClient.ExchangeApi.SubscribeToOrderUpdatesAsync(data => {
+    // Handle update
 });
InterfaceDescription