diff --git a/CryptoClients.Net/CryptoClients.Net.xml b/CryptoClients.Net/CryptoClients.Net.xml
index 54f04eb..8d00fa4 100644
--- a/CryptoClients.Net/CryptoClients.Net.xml
+++ b/CryptoClients.Net/CryptoClients.Net.xml
@@ -434,6 +434,9 @@
+
+
+
@@ -850,6 +853,9 @@
+
+
+
@@ -1324,6 +1330,15 @@
The exchange name
Filter clients by trading mode
+
+
+ Set API credentials for an exchange
+
+ Exchange name
+ API key
+ API secret
+ API passphrase
+
Get the clients for all exchanges
@@ -2190,6 +2205,15 @@
WhiteBit Websocket API
+
+
+ Set API credentials for an exchange
+
+ Exchange name
+ API key
+ API secret
+ API passphrase
+
Get all ISharedClient Socket Api interfaces supported for the specified exchange
diff --git a/CryptoClients.Net/ExchangeRestClient.cs b/CryptoClients.Net/ExchangeRestClient.cs
index f6053da..0df96c3 100644
--- a/CryptoClients.Net/ExchangeRestClient.cs
+++ b/CryptoClients.Net/ExchangeRestClient.cs
@@ -9,9 +9,11 @@
using Bitfinex.Net.Objects.Options;
using Bitget.Net.Clients;
using Bitget.Net.Interfaces.Clients;
+using Bitget.Net.Objects;
using Bitget.Net.Objects.Options;
using BitMart.Net.Clients;
using BitMart.Net.Interfaces.Clients;
+using BitMart.Net.Objects;
using BitMart.Net.Objects.Options;
using Bybit.Net.Clients;
using Bybit.Net.Interfaces.Clients;
@@ -22,6 +24,7 @@
using CoinEx.Net.Clients;
using CoinEx.Net.Interfaces.Clients;
using CoinEx.Net.Objects.Options;
+using CryptoClients.Net.Enums;
using CryptoClients.Net.Interfaces;
using CryptoClients.Net.Models;
using CryptoCom.Net.Clients;
@@ -43,12 +46,14 @@
using Kraken.Net.Objects.Options;
using Kucoin.Net.Clients;
using Kucoin.Net.Interfaces.Clients;
+using Kucoin.Net.Objects;
using Kucoin.Net.Objects.Options;
using Mexc.Net.Clients;
using Mexc.Net.Interfaces.Clients;
using Mexc.Net.Objects.Options;
using OKX.Net.Clients;
using OKX.Net.Interfaces.Clients;
+using OKX.Net.Objects;
using OKX.Net.Objects.Options;
using System;
using System.Collections.Generic;
@@ -476,6 +481,31 @@ public IEnumerable GetExchangeSharedClients(string name, TradingM
return result.ToList();
}
+ ///
+ public void SetApiCredentials(string exchange, string apiKey, string apiSecret, string? apiPass = null)
+ {
+ switch (exchange)
+ {
+ case "Binance": Binance.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "BingX": BingX.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Bitfinex": Bitfinex.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Bitget": Bitget.SetApiCredentials(new BitgetApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for Bitget credentials", nameof(apiPass)))); break;
+ case "BitMart": BitMart.SetApiCredentials(new BitMartApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for BitMart credentials", nameof(apiPass)))); break;
+ case "Bybit": Bybit.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Coinbase": Coinbase.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "CoinEx": CoinEx.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "CryptoCom": CryptoCom.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "GateIo": GateIo.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "HTX": HTX.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Kraken": Kraken.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Kucoin": Kraken.SetApiCredentials(new KucoinApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for Kucoin credentials", nameof(apiPass)))); break;
+ case "Mexc": Kraken.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "OKX": Kraken.SetApiCredentials(new OKXApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for OKX credentials", nameof(apiPass)))); break;
+ case "WhiteBit": Kraken.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ default: throw new ArgumentException("Exchange not recognized", nameof(exchange));
+ }
+ }
+
#region Get Spot Tickers
///
diff --git a/CryptoClients.Net/ExchangeSocketClient.cs b/CryptoClients.Net/ExchangeSocketClient.cs
index 4f3bfe9..60f4ebc 100644
--- a/CryptoClients.Net/ExchangeSocketClient.cs
+++ b/CryptoClients.Net/ExchangeSocketClient.cs
@@ -9,9 +9,11 @@
using Bitfinex.Net.Objects.Options;
using Bitget.Net.Clients;
using Bitget.Net.Interfaces.Clients;
+using Bitget.Net.Objects;
using Bitget.Net.Objects.Options;
using BitMart.Net.Clients;
using BitMart.Net.Interfaces.Clients;
+using BitMart.Net.Objects;
using BitMart.Net.Objects.Options;
using Bybit.Net.Clients;
using Bybit.Net.Interfaces.Clients;
@@ -43,12 +45,14 @@
using Kraken.Net.Objects.Options;
using Kucoin.Net.Clients;
using Kucoin.Net.Interfaces.Clients;
+using Kucoin.Net.Objects;
using Kucoin.Net.Objects.Options;
using Mexc.Net.Clients;
using Mexc.Net.Interfaces.Clients;
using Mexc.Net.Objects.Options;
using OKX.Net.Clients;
using OKX.Net.Interfaces.Clients;
+using OKX.Net.Objects;
using OKX.Net.Objects.Options;
using System;
using System.Collections.Generic;
@@ -369,6 +373,31 @@ public IEnumerable GetExchangeSharedClients(string name, TradingM
return result.ToList();
}
+ ///
+ public void SetApiCredentials(string exchange, string apiKey, string apiSecret, string? apiPass = null)
+ {
+ switch (exchange)
+ {
+ case "Binance": Binance.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "BingX": BingX.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Bitfinex": Bitfinex.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Bitget": Bitget.SetApiCredentials(new BitgetApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for Bitget credentials", nameof(apiPass)))); break;
+ case "BitMart": BitMart.SetApiCredentials(new BitMartApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for BitMart credentials", nameof(apiPass)))); break;
+ case "Bybit": Bybit.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Coinbase": Coinbase.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "CoinEx": CoinEx.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "CryptoCom": CryptoCom.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "GateIo": GateIo.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "HTX": HTX.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Kraken": Kraken.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "Kucoin": Kraken.SetApiCredentials(new KucoinApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for Kucoin credentials", nameof(apiPass)))); break;
+ case "Mexc": Kraken.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ case "OKX": Kraken.SetApiCredentials(new OKXApiCredentials(apiKey, apiSecret, apiPass ?? throw new ArgumentException("ApiPass required for OKX credentials", nameof(apiPass)))); break;
+ case "WhiteBit": Kraken.SetApiCredentials(new ApiCredentials(apiKey, apiSecret)); break;
+ default: throw new ArgumentException("Exchange not recognized", nameof(exchange));
+ }
+ }
+
#region Subscribe All Ticker
///
diff --git a/CryptoClients.Net/Interfaces/IExchangeRestClient.cs b/CryptoClients.Net/Interfaces/IExchangeRestClient.cs
index 3594d5c..2fc632b 100644
--- a/CryptoClients.Net/Interfaces/IExchangeRestClient.cs
+++ b/CryptoClients.Net/Interfaces/IExchangeRestClient.cs
@@ -109,6 +109,15 @@ public interface IExchangeRestClient
/// Filter clients by trading mode
IEnumerable GetExchangeSharedClients(string exchange, TradingMode? tradingMode = null);
+ ///
+ /// Set API credentials for an exchange
+ ///
+ /// Exchange name
+ /// API key
+ /// API secret
+ /// API passphrase
+ void SetApiCredentials(string exchange, string apiKey, string apiSecret, string? apiPass = null);
+
///
/// Get the clients for all exchanges
///
diff --git a/CryptoClients.Net/Interfaces/IExchangeSocketClient.cs b/CryptoClients.Net/Interfaces/IExchangeSocketClient.cs
index 217dc84..aab640d 100644
--- a/CryptoClients.Net/Interfaces/IExchangeSocketClient.cs
+++ b/CryptoClients.Net/Interfaces/IExchangeSocketClient.cs
@@ -93,6 +93,15 @@ public interface IExchangeSocketClient
///
IWhiteBitSocketClient WhiteBit { get; }
+ ///
+ /// Set API credentials for an exchange
+ ///
+ /// Exchange name
+ /// API key
+ /// API secret
+ /// API passphrase
+ void SetApiCredentials(string exchange, string apiKey, string apiSecret, string? apiPass = null);
+
///
/// Get all ISharedClient Socket Api interfaces supported for the specified exchange
///