diff --git a/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApi.cs b/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApi.cs index e453459..a24a00d 100644 --- a/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApi.cs +++ b/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApi.cs @@ -13,8 +13,9 @@ namespace OKX.Net.Clients.UnifiedApi; internal partial class OKXRestClientUnifiedApi : RestApiClient, IOKXRestClientUnifiedApi, ISpotClient { #region Internal Fields + public new OKXRestOptions ClientOptions => (OKXRestOptions)base.ClientOptions; + private static TimeSyncState _timeSyncState = new("Unified Api"); - internal readonly string _ref; public event Action? OnOrderPlaced; public event Action? OnOrderCanceled; @@ -38,8 +39,6 @@ internal OKXRestClientUnifiedApi(ILogger logger, HttpClient? httpClient, OKXRest Trading = new OKXRestClientUnifiedApiTrading(this); SubAccounts = new OKXRestClientUnifiedApiSubAccounts(this); - _ref = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "1425d83a94fbBCDE"; - if (options.Environment.Name == TradeEnvironmentNames.Testnet) { StandardRequestHeaders = new Dictionary diff --git a/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApiTrading.cs b/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApiTrading.cs index 0c67f27..d407173 100644 --- a/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApiTrading.cs +++ b/OKX.Net/Clients/UnifiedApi/OKXRestClientUnifiedApiTrading.cs @@ -42,12 +42,12 @@ public virtual async Task> PlaceOrderAsync( CancellationToken ct = default) { - clientOrderId ??= ExchangeHelpers.AppendRandomString(_baseClient._ref, 32); + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); var parameters = new ParameterCollection { {"instId", symbol }, {"sz", quantity.ToString(CultureInfo.InvariantCulture) }, - {"tag", _baseClient._ref }, + {"tag", OKXExchange.ClientOrderId }, {"clOrdId", clientOrderId }, }; parameters.AddEnum("tdMode", tradeMode ?? Enums.TradeMode.Cash); @@ -61,6 +61,11 @@ public virtual async Task> PlaceOrderAsync( parameters.AddOptional("stpId", selfTradePreventionId); parameters.AddOptionalEnum("stpMode", selfTradePreventionMode); + if (attachedAlgoOrders != null) + { + foreach(var attachOrder in attachedAlgoOrders) + attachOrder.ClientOrderId = LibraryHelpers.ApplyBrokerId(attachOrder.ClientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + } parameters.AddOptional("attachAlgoOrds", attachedAlgoOrders?.ToArray()); parameters.AddOptional("tag", tag); @@ -118,8 +123,7 @@ public virtual async Task> CheckOrderAsync( { var parameters = new ParameterCollection { {"instId", symbol }, - {"sz", quantity.ToString(CultureInfo.InvariantCulture) }, - {"tag", _baseClient._ref }, + {"sz", quantity.ToString(CultureInfo.InvariantCulture) } }; parameters.AddEnum("tdMode", tradeMode ?? Enums.TradeMode.Cash); parameters.AddEnum("side", side); @@ -148,8 +152,8 @@ public virtual async Task>> Pla { foreach (var order in orders) { - var clientOrderId = order.ClientOrderId ?? ExchangeHelpers.AppendRandomString(_baseClient._ref, 32); - order.Tag = _baseClient._ref; + var clientOrderId = LibraryHelpers.ApplyBrokerId(order.ClientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + order.Tag = OKXExchange.ClientOrderId; order.ClientOrderId = clientOrderId; } @@ -186,6 +190,9 @@ public virtual async Task>> Pla /// public virtual async Task> CancelOrderAsync(string symbol, long? orderId = null, string? clientOrderId = null, CancellationToken ct = default) { + if (clientOrderId != null) + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection { {"instId", symbol }, }; @@ -265,6 +272,9 @@ public virtual async Task> AmendOrderAsync( TriggerPriceType? newStopLossPriceTriggerType = null, CancellationToken ct = default) { + if (clientOrderId != null) + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection { { "instId", symbol }, @@ -310,11 +320,11 @@ public virtual async Task> ClosePosition string? clientOrderId = null, CancellationToken ct = default) { - clientOrderId ??= ExchangeHelpers.AppendRandomString(_baseClient._ref, 32); + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); var parameters = new ParameterCollection { {"instId", symbol }, - {"tag", _baseClient._ref }, + {"tag", OKXExchange.ClientOrderId }, {"clOrdId", clientOrderId } }; parameters.AddEnum("mgnMode", marginMode); @@ -334,6 +344,9 @@ public virtual async Task> GetOrderDetailsAsync( string? clientOrderId = null, CancellationToken ct = default) { + if (clientOrderId != null) + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection { {"instId", symbol }, }; @@ -568,10 +581,11 @@ public virtual async Task> PlaceAlgoOrderAsy CancellationToken ct = default) { - clientOrderId ??= ExchangeHelpers.AppendRandomString(_baseClient._ref, 32); + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection { {"instId", symbol }, - {"tag", _baseClient._ref }, + {"tag", OKXExchange.ClientOrderId }, {"clOrdId", clientOrderId } }; parameters.AddEnum("tdMode", tradeMode); @@ -718,6 +732,9 @@ public virtual async Task> GetAlgoOrderAsync(string? if ((algoId == null) == (clientAlgoId == null)) throw new ArgumentException("Either algoId or clientAlgoId needs to be provided"); + if (clientAlgoId != null) + clientAlgoId = LibraryHelpers.ApplyBrokerId(clientAlgoId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection(); parameters.AddOptional("algoId", algoId); parameters.AddOptional("algoClOrdId", clientAlgoId); @@ -746,6 +763,9 @@ public virtual async Task> AmendAlgoOrd if ((algoId == null) == (clientAlgoId == null)) throw new ArgumentException("Either algoId or clientAlgoId needs to be provided"); + if (clientAlgoId != null) + clientAlgoId = LibraryHelpers.ApplyBrokerId(clientAlgoId, OKXExchange.ClientOrderId, 32, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection { { "instId", symbol }, diff --git a/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApi.cs b/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApi.cs index 12b7f58..c58a798 100644 --- a/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApi.cs +++ b/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApi.cs @@ -24,6 +24,8 @@ internal partial class OKXSocketClientUnifiedApi : SocketApiClient, IOKXSocketCl private static readonly MessagePath _instTypePath = MessagePath.Get().Property("arg").Property("instType"); private static readonly MessagePath _instFamilyPath = MessagePath.Get().Property("arg").Property("instFamily"); + public new OKXSocketOptions ClientOptions => (OKXSocketOptions)base.ClientOptions; + /// public IOKXSocketClientUnifiedApiAccount Account { get; } /// @@ -31,7 +33,6 @@ internal partial class OKXSocketClientUnifiedApi : SocketApiClient, IOKXSocketCl /// public IOKXSocketClientUnifiedApiTrading Trading { get; } - internal readonly string _ref; private readonly bool _demoTrading; #region ctor @@ -43,8 +44,6 @@ internal OKXSocketClientUnifiedApi(ILogger logger, OKXSocketOptions options) : ExchangeData = new OKXSocketClientUnifiedApiExchangeData(logger, this); Trading = new OKXSocketClientUnifiedApiTrading(logger, this); - _ref = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "078ee129065aBCDE"; - _demoTrading = options.Environment.Name == TradeEnvironmentNames.Testnet; RegisterPeriodicQuery("Ping", TimeSpan.FromSeconds(20), x => new OKXPingQuery(), null); diff --git a/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApiTrading.cs b/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApiTrading.cs index 7d29053..b91727a 100644 --- a/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApiTrading.cs +++ b/OKX.Net/Clients/UnifiedApi/OKXSocketClientUnifiedApiTrading.cs @@ -51,11 +51,11 @@ public async Task> PlaceOrderAsync(string symb { "sz", quantity.ToString(CultureInfo.InvariantCulture) }, }; - clientOrderId = clientOrderId ?? ExchangeHelpers.AppendRandomString(_client._ref, 32); + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _client.ClientOptions.AllowAppendingClientOrderId); parameters.AddOptionalParameter("ccy", asset); parameters.AddOptionalParameter("clOrdId", clientOrderId); - parameters.AddOptionalParameter("tag", _client._ref); + parameters.AddOptionalParameter("tag", OKXExchange.ClientOrderId); parameters.AddOptionalParameter("posSide", EnumConverter.GetString(positionSide)); parameters.AddOptionalParameter("px", price?.ToString(CultureInfo.InvariantCulture)); parameters.AddOptionalParameter("reduceOnly", reduceOnly); @@ -79,8 +79,8 @@ public async Task>> PlaceMultipleO { foreach (var order in orders) { - order.Tag = _client._ref; - order.ClientOrderId = order.ClientOrderId ?? ExchangeHelpers.AppendRandomString(_client._ref, 32); + order.Tag = OKXExchange.ClientOrderId; + order.ClientOrderId = LibraryHelpers.ApplyBrokerId(order.ClientOrderId, OKXExchange.ClientOrderId, 32, _client.ClientOptions.AllowAppendingClientOrderId); } return await _client.QueryInternalAsync(_client.GetUri("/ws/v5/private"), "batch-orders", orders, true, 1, ct).ConfigureAwait(false); @@ -89,6 +89,9 @@ public async Task>> PlaceMultipleO /// public async Task> CancelOrderAsync(string symbol, string? orderId = null, string? clientOrderId = null, CancellationToken ct = default) { + if (clientOrderId != null) + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _client.ClientOptions.AllowAppendingClientOrderId); + var parameters = new Dictionary() { { "instId", symbol } @@ -123,6 +126,9 @@ public virtual async Task> AmendOrderAsync( decimal? newPrice = null, CancellationToken ct = default) { + if (clientOrderId != null) + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, OKXExchange.ClientOrderId, 32, _client.ClientOptions.AllowAppendingClientOrderId); + var parameters = new Dictionary { { "instId", symbol }, diff --git a/OKX.Net/ExtensionMethods/ServiceCollectionExtensions.cs b/OKX.Net/ExtensionMethods/ServiceCollectionExtensions.cs index 7872f5e..b5c6c77 100644 --- a/OKX.Net/ExtensionMethods/ServiceCollectionExtensions.cs +++ b/OKX.Net/ExtensionMethods/ServiceCollectionExtensions.cs @@ -40,8 +40,10 @@ public static IServiceCollection AddOKX( var socketEnvName = options.Socket.Environment?.Name ?? options.Environment?.Name ?? OKXEnvironment.Live.Name; options.Rest.Environment = OKXEnvironment.GetEnvironmentByName(restEnvName) ?? options.Rest.Environment!; options.Rest.ApiCredentials = options.Rest.ApiCredentials ?? options.ApiCredentials; + options.Rest.AllowAppendingClientOrderId = options.Rest.AllowAppendingClientOrderId || options.AllowAppendingClientOrderId; options.Socket.Environment = OKXEnvironment.GetEnvironmentByName(socketEnvName) ?? options.Socket.Environment!; options.Socket.ApiCredentials = options.Socket.ApiCredentials ?? options.ApiCredentials; + options.Socket.AllowAppendingClientOrderId = options.Socket.AllowAppendingClientOrderId || options.AllowAppendingClientOrderId; services.AddSingleton(x => Options.Options.Create(options.Rest)); @@ -70,8 +72,10 @@ public static IServiceCollection AddOKX( options.Rest.Environment = options.Rest.Environment ?? options.Environment ?? OKXEnvironment.Live; options.Rest.ApiCredentials = options.Rest.ApiCredentials ?? options.ApiCredentials; + options.Rest.AllowAppendingClientOrderId = options.Rest.AllowAppendingClientOrderId || options.AllowAppendingClientOrderId; options.Socket.Environment = options.Socket.Environment ?? options.Environment ?? OKXEnvironment.Live; options.Socket.ApiCredentials = options.Socket.ApiCredentials ?? options.ApiCredentials; + options.Socket.AllowAppendingClientOrderId = options.Socket.AllowAppendingClientOrderId || options.AllowAppendingClientOrderId; services.AddSingleton(x => Options.Options.Create(options.Rest)); services.AddSingleton(x => Options.Options.Create(options.Socket)); diff --git a/OKX.Net/OKX.Net.csproj b/OKX.Net/OKX.Net.csproj index a2cbb26..5254b4d 100644 --- a/OKX.Net/OKX.Net.csproj +++ b/OKX.Net/OKX.Net.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;netstandard2.1 latest @@ -49,7 +49,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/OKX.Net/OKX.Net.xml b/OKX.Net/OKX.Net.xml index b428984..e443bfe 100644 --- a/OKX.Net/OKX.Net.xml +++ b/OKX.Net/OKX.Net.xml @@ -6312,6 +6312,16 @@ OKX options + + + Whether to allow the client to adjust the clientOrderId parameter send by the user when placing orders to include a client reference. This reference is used by the exchange to allocate a small percentage of the paid trading fees to developer of this library. Defaults to false.
+ Note that:
+ * It does not impact the amount of fees a user pays in any way
+ * It does not impact functionality. The reference is added just before sending the request and removed again during data deserialization
+ * It does respect client order id field limitations. For example if the user provided client order id parameter is too long to fit the reference it will not be added
+ * Toggling this option might fail operations using a clientOrderId parameter for pre-existing orders which were placed before the toggle. Operations on orders placed after the toggle will work as expected. It's adviced to toggle when there are no open orders +
+
Order book options @@ -6352,9 +6362,14 @@ Whether or not to sign public requests - + - Broker ID for earning rebates + Whether to allow the client to adjust the clientOrderId parameter send by the user when placing orders to include a client reference. This reference is used by the exchange to allocate a small percentage of the paid trading fees to developer of this library. Defaults to false.
+ Note that:
+ * It does not impact the amount of fees a user pays in any way
+ * It does not impact functionality. The reference is added just before sending the request and removed again during data deserialization
+ * It does respect client order id field limitations. For example if the user provided client order id parameter is too long to fit the reference it will not be added
+ * Toggling this option might fail operations using a clientOrderId parameter for pre-existing orders which were placed before the toggle. Operations on orders placed after the toggle will work as expected. It's adviced to toggle when there are no open orders
@@ -6377,9 +6392,14 @@ ctor - + - Broker ID for earning rebates + Whether to allow the client to adjust the clientOrderId parameter send by the user when placing orders to include a client reference. This reference is used by the exchange to allocate a small percentage of the paid trading fees to developer of this library. Defaults to false.
+ Note that:
+ * It does not impact the amount of fees a user pays in any way
+ * It does not impact functionality. The reference is added just before sending the request and removed again during data deserialization
+ * It does respect client order id field limitations. For example if the user provided client order id parameter is too long to fit the reference it will not be added
+ * Toggling this option might fail operations using a clientOrderId parameter for pre-existing orders which were placed before the toggle. Operations on orders placed after the toggle will work as expected. It's adviced to toggle when there are no open orders
@@ -8419,7 +8439,7 @@ - Client-supplied Algo ID when plaing order attaching TP/SL. + Client-supplied Algo ID when placing order attaching TP/SL. diff --git a/OKX.Net/OKXExchange.cs b/OKX.Net/OKXExchange.cs index 350c40c..474152e 100644 --- a/OKX.Net/OKXExchange.cs +++ b/OKX.Net/OKXExchange.cs @@ -36,6 +36,9 @@ public static class OKXExchange "https://www.okx.com/docs-v5/en/" }; + internal const string ClientOrderId = "1425d83a94fbBCDE"; + internal const string ClientOrderIdPrefix = ClientOrderId + LibraryHelpers.ClientOrderIdSeperator; + /// /// Format a base and quote asset to an OKX recognized symbol /// diff --git a/OKX.Net/Objects/Account/OKXAccountBill.cs b/OKX.Net/Objects/Account/OKXAccountBill.cs index 07195c7..d8e1fbc 100644 --- a/OKX.Net/Objects/Account/OKXAccountBill.cs +++ b/OKX.Net/Objects/Account/OKXAccountBill.cs @@ -137,6 +137,7 @@ public record OKXAccountBill /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Options/OKXOptions.cs b/OKX.Net/Objects/Options/OKXOptions.cs index 824affc..9ae4004 100644 --- a/OKX.Net/Objects/Options/OKXOptions.cs +++ b/OKX.Net/Objects/Options/OKXOptions.cs @@ -10,4 +10,13 @@ namespace OKX.Net.Objects.Options; /// public class OKXOptions : LibraryOptions { + /// + /// Whether to allow the client to adjust the clientOrderId parameter send by the user when placing orders to include a client reference. This reference is used by the exchange to allocate a small percentage of the paid trading fees to developer of this library. Defaults to false.
+ /// Note that:
+ /// * It does not impact the amount of fees a user pays in any way
+ /// * It does not impact functionality. The reference is added just before sending the request and removed again during data deserialization
+ /// * It does respect client order id field limitations. For example if the user provided client order id parameter is too long to fit the reference it will not be added
+ /// * Toggling this option might fail operations using a clientOrderId parameter for pre-existing orders which were placed before the toggle. Operations on orders placed after the toggle will work as expected. It's adviced to toggle when there are no open orders + ///
+ public bool AllowAppendingClientOrderId { get; set; } = false; } diff --git a/OKX.Net/Objects/Options/OKXRestOptions.cs b/OKX.Net/Objects/Options/OKXRestOptions.cs index 01e56a4..2c762f3 100644 --- a/OKX.Net/Objects/Options/OKXRestOptions.cs +++ b/OKX.Net/Objects/Options/OKXRestOptions.cs @@ -29,9 +29,14 @@ public OKXRestOptions() public bool SignPublicRequests { get; set; } /// - /// Broker ID for earning rebates + /// Whether to allow the client to adjust the clientOrderId parameter send by the user when placing orders to include a client reference. This reference is used by the exchange to allocate a small percentage of the paid trading fees to developer of this library. Defaults to false.
+ /// Note that:
+ /// * It does not impact the amount of fees a user pays in any way
+ /// * It does not impact functionality. The reference is added just before sending the request and removed again during data deserialization
+ /// * It does respect client order id field limitations. For example if the user provided client order id parameter is too long to fit the reference it will not be added
+ /// * Toggling this option might fail operations using a clientOrderId parameter for pre-existing orders which were placed before the toggle. Operations on orders placed after the toggle will work as expected. It's adviced to toggle when there are no open orders ///
- public string? BrokerId { get; set; } + public bool AllowAppendingClientOrderId { get; set; } = false; /// /// Options for the unified API @@ -42,7 +47,7 @@ internal OKXRestOptions Set(OKXRestOptions targetOptions) { targetOptions = base.Set(targetOptions); targetOptions.SignPublicRequests = SignPublicRequests; - targetOptions.BrokerId = BrokerId; + targetOptions.AllowAppendingClientOrderId = AllowAppendingClientOrderId; targetOptions.UnifiedOptions = UnifiedOptions.Set(targetOptions.UnifiedOptions); return targetOptions; } diff --git a/OKX.Net/Objects/Options/OKXSocketOptions.cs b/OKX.Net/Objects/Options/OKXSocketOptions.cs index c709c56..b162ba0 100644 --- a/OKX.Net/Objects/Options/OKXSocketOptions.cs +++ b/OKX.Net/Objects/Options/OKXSocketOptions.cs @@ -25,9 +25,14 @@ public OKXSocketOptions() } /// - /// Broker ID for earning rebates + /// Whether to allow the client to adjust the clientOrderId parameter send by the user when placing orders to include a client reference. This reference is used by the exchange to allocate a small percentage of the paid trading fees to developer of this library. Defaults to false.
+ /// Note that:
+ /// * It does not impact the amount of fees a user pays in any way
+ /// * It does not impact functionality. The reference is added just before sending the request and removed again during data deserialization
+ /// * It does respect client order id field limitations. For example if the user provided client order id parameter is too long to fit the reference it will not be added
+ /// * Toggling this option might fail operations using a clientOrderId parameter for pre-existing orders which were placed before the toggle. Operations on orders placed after the toggle will work as expected. It's adviced to toggle when there are no open orders ///
- public string? BrokerId { get; set; } + public bool AllowAppendingClientOrderId { get; set; } = false; /// /// Options for the Unified API @@ -37,7 +42,7 @@ public OKXSocketOptions() internal OKXSocketOptions Set(OKXSocketOptions targetOptions) { targetOptions = base.Set(targetOptions); - targetOptions.BrokerId = BrokerId; + targetOptions.AllowAppendingClientOrderId = AllowAppendingClientOrderId; targetOptions.UnifiedOptions = UnifiedOptions.Set(targetOptions.UnifiedOptions); return targetOptions; } diff --git a/OKX.Net/Objects/Trade/OKXAlgoOrder.cs b/OKX.Net/Objects/Trade/OKXAlgoOrder.cs index e077583..9e4e3b2 100644 --- a/OKX.Net/Objects/Trade/OKXAlgoOrder.cs +++ b/OKX.Net/Objects/Trade/OKXAlgoOrder.cs @@ -41,6 +41,7 @@ public record OKXAlgoOrder /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// @@ -278,6 +279,7 @@ public record OKXAlgoOrder /// Client algo order id /// [JsonPropertyName("algoClOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? AlgoClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXAlgoOrderAmendResponse.cs b/OKX.Net/Objects/Trade/OKXAlgoOrderAmendResponse.cs index 8b6b468..f1e6547 100644 --- a/OKX.Net/Objects/Trade/OKXAlgoOrderAmendResponse.cs +++ b/OKX.Net/Objects/Trade/OKXAlgoOrderAmendResponse.cs @@ -15,6 +15,7 @@ public record OKXAlgoOrderAmendResponse /// Client order id /// [JsonPropertyName("algoClOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXAlgoOrderResponse.cs b/OKX.Net/Objects/Trade/OKXAlgoOrderResponse.cs index e3a4c4c..0621ac9 100644 --- a/OKX.Net/Objects/Trade/OKXAlgoOrderResponse.cs +++ b/OKX.Net/Objects/Trade/OKXAlgoOrderResponse.cs @@ -15,12 +15,14 @@ public record OKXAlgoOrderResponse /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// /// Algo client order id /// [JsonPropertyName("algoClOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? AgloClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXClosePositionResponse.cs b/OKX.Net/Objects/Trade/OKXClosePositionResponse.cs index 4058e89..82ee8b1 100644 --- a/OKX.Net/Objects/Trade/OKXClosePositionResponse.cs +++ b/OKX.Net/Objects/Trade/OKXClosePositionResponse.cs @@ -23,6 +23,7 @@ public record OKXClosePositionResponse /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXOrder.cs b/OKX.Net/Objects/Trade/OKXOrder.cs index e84112d..3e69ed3 100644 --- a/OKX.Net/Objects/Trade/OKXOrder.cs +++ b/OKX.Net/Objects/Trade/OKXOrder.cs @@ -53,6 +53,7 @@ public record OKXOrder /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// @@ -212,9 +213,10 @@ public record OKXOrder public decimal? Leverage { get; set; } /// - /// Client-supplied Algo ID when plaing order attaching TP/SL. + /// Client-supplied Algo ID when placing order attaching TP/SL. /// [JsonPropertyName("attachAlgoClOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? AttachAlgoCllientOrderId { get; set; } /// @@ -266,6 +268,7 @@ public record OKXOrder /// Client algo order id /// [JsonPropertyName("algoClOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? AlgoClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXOrderAmendResponse.cs b/OKX.Net/Objects/Trade/OKXOrderAmendResponse.cs index 0083b18..f4a0787 100644 --- a/OKX.Net/Objects/Trade/OKXOrderAmendResponse.cs +++ b/OKX.Net/Objects/Trade/OKXOrderAmendResponse.cs @@ -15,6 +15,7 @@ public record OKXOrderAmendResponse /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXOrderCancelResponse.cs b/OKX.Net/Objects/Trade/OKXOrderCancelResponse.cs index 6bdb287..5a0c003 100644 --- a/OKX.Net/Objects/Trade/OKXOrderCancelResponse.cs +++ b/OKX.Net/Objects/Trade/OKXOrderCancelResponse.cs @@ -15,6 +15,7 @@ public record OKXOrderCancelResponse /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string ClientOrderId { get; set; } = string.Empty; /// diff --git a/OKX.Net/Objects/Trade/OKXOrderPlaceResponse.cs b/OKX.Net/Objects/Trade/OKXOrderPlaceResponse.cs index 77da634..e1de35b 100644 --- a/OKX.Net/Objects/Trade/OKXOrderPlaceResponse.cs +++ b/OKX.Net/Objects/Trade/OKXOrderPlaceResponse.cs @@ -15,6 +15,7 @@ public record OKXOrderPlaceResponse /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// diff --git a/OKX.Net/Objects/Trade/OKXTransaction.cs b/OKX.Net/Objects/Trade/OKXTransaction.cs index 99216e6..dc5248a 100644 --- a/OKX.Net/Objects/Trade/OKXTransaction.cs +++ b/OKX.Net/Objects/Trade/OKXTransaction.cs @@ -35,6 +35,7 @@ public record OKXTransaction /// Client order id /// [JsonPropertyName("clOrdId")] + [JsonConverterCtor($"{OKXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } ///