diff --git a/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApi.cs b/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApi.cs index 84abb1b..ce77348 100644 --- a/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApi.cs +++ b/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApi.cs @@ -50,6 +50,8 @@ public class CoinExRestClientSpotApi : RestApiClient, ICoinExClientSpotApi, ISpo public ICoinExClientSpotApiTrading Trading { get; } #endregion + internal readonly string _brokerId; + #region ctor internal CoinExRestClientSpotApi(ILogger logger, HttpClient? httpClient, CoinExRestOptions options) : base(logger, httpClient, options.Environment.RestBaseAddress, options, options.SpotOptions) @@ -61,6 +63,8 @@ internal CoinExRestClientSpotApi(ILogger logger, HttpClient? httpClient, CoinExR manualParseError = true; ParameterPositions[HttpMethod.Delete] = HttpMethodParameterPosition.InUri; + _brokerId = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "147866029"; + } #endregion diff --git a/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApiTrading.cs b/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApiTrading.cs index 6c15729..197e82d 100644 --- a/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApiTrading.cs +++ b/CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApiTrading.cs @@ -74,6 +74,8 @@ public async Task> PlaceOrderAsync( endpoint = PlaceImmediateOrCancelOrderEndpoint; } + clientOrderId = clientOrderId ?? ExchangeHelpers.AppendRandomString(_baseClient._brokerId, 32); + var parameters = new Dictionary { { "market", symbol }, diff --git a/CoinEx.Net/CoinEx.Net.csproj b/CoinEx.Net/CoinEx.Net.csproj index e57dc01..b684156 100644 --- a/CoinEx.Net/CoinEx.Net.csproj +++ b/CoinEx.Net/CoinEx.Net.csproj @@ -53,6 +53,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + \ No newline at end of file diff --git a/CoinEx.Net/CoinEx.Net.xml b/CoinEx.Net/CoinEx.Net.xml index 6ecf937..8619942 100644 --- a/CoinEx.Net/CoinEx.Net.xml +++ b/CoinEx.Net/CoinEx.Net.xml @@ -2205,6 +2205,11 @@ Options for the Spot API + + + The broker reference id to use + + Options for the CoinExSocketClient diff --git a/CoinEx.Net/Objects/Options/CoinExRestOptions.cs b/CoinEx.Net/Objects/Options/CoinExRestOptions.cs index f229d77..7927ebe 100644 --- a/CoinEx.Net/Objects/Options/CoinExRestOptions.cs +++ b/CoinEx.Net/Objects/Options/CoinExRestOptions.cs @@ -26,6 +26,11 @@ public class CoinExRestOptions : RestExchangeOptions /// public RestApiOptions SpotOptions { get; private set; } = new RestApiOptions(); + /// + /// The broker reference id to use + /// + public string? BrokerId { get; set; } + internal CoinExRestOptions Copy() { var options = Copy();