diff --git a/HTX.Net/Clients/SpotApi/HTXRestClientSpotApi.cs b/HTX.Net/Clients/SpotApi/HTXRestClientSpotApi.cs index dd486d7..e5cef06 100644 --- a/HTX.Net/Clients/SpotApi/HTXRestClientSpotApi.cs +++ b/HTX.Net/Clients/SpotApi/HTXRestClientSpotApi.cs @@ -30,8 +30,6 @@ internal partial class HTXRestClientSpotApi : RestApiClient, IHTXRestClientSpotA /// public string ExchangeName => "HTX"; - internal readonly string _brokerId; - #region Api clients /// @@ -57,7 +55,6 @@ internal HTXRestClientSpotApi(ILogger logger, HttpClient? httpClient, HTXRestOpt Margin = new HTXRestClientSpotApiMargin(this); Trading = new HTXRestClientSpotApiTrading(this); - _brokerId = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "AA1ef14811"; } #endregion diff --git a/HTX.Net/Clients/SpotApi/HTXRestClientSpotApiTrading.cs b/HTX.Net/Clients/SpotApi/HTXRestClientSpotApiTrading.cs index 2b14061..45600ee 100644 --- a/HTX.Net/Clients/SpotApi/HTXRestClientSpotApiTrading.cs +++ b/HTX.Net/Clients/SpotApi/HTXRestClientSpotApiTrading.cs @@ -47,7 +47,7 @@ public async Task> PlaceOrderAsync( }; parameters.AddString("amount", quantity); - clientOrderId ??= ExchangeHelpers.AppendRandomString(_baseClient._brokerId, 64); + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId); parameters.AddOptionalParameter("client-order-id", clientOrderId); parameters.AddOptionalString("stop-price", stopPrice); @@ -84,8 +84,8 @@ public async Task>> PlaceMultiple { "type", orderType } }; parameters.AddString("amount", order.Quantity); - order.ClientOrderId ??= ExchangeHelpers.AppendRandomString(_baseClient._brokerId, 64); - + order.ClientOrderId = LibraryHelpers.ApplyBrokerId(order.ClientOrderId, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId); + parameters.AddOptionalParameter("client-order-id", order.ClientOrderId); parameters.AddOptionalString("stop-price", order.StopPrice); parameters.AddOptionalEnum("source", order.Source); @@ -180,6 +180,8 @@ public async Task> CancelOrderAsync(long orderId, Cancellati /// public async Task> CancelOrderByClientOrderIdAsync(string clientOrderId, CancellationToken ct = default) { + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection() { { "client-order-id", clientOrderId } @@ -239,8 +241,8 @@ public async Task> CancelOrdersAsync(IEnumer throw new ArgumentException("Either orderIds or clientOrderIds should be provided"); var parameters = new ParameterCollection(); - parameters.AddOptionalParameter("order-ids", orderIds?.Select(s => s.ToString(CultureInfo.InvariantCulture))); - parameters.AddOptionalParameter("client-order-ids", clientOrderIds?.Select(s => s.ToString(CultureInfo.InvariantCulture))); + parameters.AddOptionalParameter("order-ids", orderIds?.Select(s => s.ToString(CultureInfo.InvariantCulture)).ToArray()); + parameters.AddOptionalParameter("client-order-ids", clientOrderIds?.Select(s => LibraryHelpers.ApplyBrokerId(s, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId).ToString(CultureInfo.InvariantCulture)).ToArray()); var request = _definitions.GetOrCreate(HttpMethod.Post, "v1/order/orders/batchcancel", HTXExchange.RateLimiter.EndpointLimit, 1, true, new SingleLimitGuard(50, TimeSpan.FromSeconds(2), RateLimitWindowType.Sliding, keySelector: SingleLimitGuard.PerApiKey)); @@ -268,6 +270,8 @@ public async Task> GetOrderAsync(long orderId, Cancellat /// public async Task> GetOrderByClientOrderIdAsync(string clientOrderId, CancellationToken ct = default) { + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection() { { "clientOrderId", clientOrderId } @@ -381,13 +385,14 @@ public async Task> PlaceConditionalOrde { symbol = symbol.ToLowerInvariant(); + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId); var parameters = new ParameterCollection() { { "accountId", accountId }, { "symbol", symbol }, { "orderSide", EnumConverter.GetString(side) }, { "orderType", EnumConverter.GetString(type) }, - { "clientOrderId", clientOrderId ?? Guid.NewGuid().ToString() } + { "clientOrderId", clientOrderId } }; parameters.AddString("stopPrice", stopPrice); @@ -411,7 +416,7 @@ public async Task> CancelConditio { var parameters = new ParameterCollection() { - { "clientOrderIds", clientOrderIds } + { "clientOrderIds", clientOrderIds.Select(x => LibraryHelpers.ApplyBrokerId(x, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId)).ToArray() } }; var request = _definitions.GetOrCreate(HttpMethod.Post, $"v2/algo-orders/cancellation", HTXExchange.RateLimiter.EndpointLimit, 1, true, @@ -488,6 +493,8 @@ public async Task>> GetClosedCond /// public async Task> GetConditionalOrderAsync(string clientOrderId, CancellationToken ct = default) { + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, _baseClient.ClientOptions.AllowAppendingClientOrderId); + var parameters = new ParameterCollection() { { "clientOrderId", clientOrderId } diff --git a/HTX.Net/Clients/SpotApi/HTXSocketClientSpotApi.cs b/HTX.Net/Clients/SpotApi/HTXSocketClientSpotApi.cs index 3526799..aab7837 100644 --- a/HTX.Net/Clients/SpotApi/HTXSocketClientSpotApi.cs +++ b/HTX.Net/Clients/SpotApi/HTXSocketClientSpotApi.cs @@ -28,9 +28,8 @@ internal partial class HTXSocketClientSpotApi : SocketApiClient, IHTXSocketClien private static readonly MessagePath _channelPath = MessagePath.Get().Property("ch"); private static readonly MessagePath _pingPath = MessagePath.Get().Property("ping"); - #region fields - internal readonly string _brokerId; - #endregion + /// + public new HTXSocketOptions ClientOptions => (HTXSocketOptions)base.ClientOptions; #region ctor internal HTXSocketClientSpotApi(ILogger logger, HTXSocketOptions options) @@ -43,8 +42,6 @@ internal HTXSocketClientSpotApi(ILogger logger, HTXSocketOptions options) RateLimiter = HTXExchange.RateLimiter.SpotConnection; - _brokerId = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "AA1ef14811"; - SetDedicatedConnection(options.Environment.SocketBaseAddress.AppendPath("ws/trade"), true); } @@ -299,7 +296,7 @@ public async Task> PlaceOrderAsync( var request = new HTXSocketPlaceOrderRequest() { AccountId = accountId, - ClientOrderId = clientOrderId ?? ExchangeHelpers.AppendRandomString(_brokerId, 64), + ClientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, ClientOptions.AllowAppendingClientOrderId), Price = price, Type = orderType, Quantity = quantity, @@ -333,7 +330,7 @@ public async Task>> PlaceMultipleOrd var parameters = new HTXSocketPlaceOrderRequest() { AccountId = long.Parse(order.AccountId), - ClientOrderId = order.ClientOrderId ?? ExchangeHelpers.AppendRandomString(_brokerId, 64), + ClientOrderId = LibraryHelpers.ApplyBrokerId(order.ClientOrderId, HTXExchange.ClientOrderId, 64, ClientOptions.AllowAppendingClientOrderId), Price = order.Price, Type = orderType, Quantity = order.Quantity, @@ -429,6 +426,9 @@ public async Task CancelOrdersAsync( string? clientOrderId = null, CancellationToken ct = default) { + if (clientOrderId != null) + clientOrderId = LibraryHelpers.ApplyBrokerId(clientOrderId, HTXExchange.ClientOrderId, 64, ClientOptions.AllowAppendingClientOrderId); + var result = await CancelOrdersAsync(orderId == null ? null : [orderId], clientOrderId == null ? null : [clientOrderId], ct).ConfigureAwait(false); if (!result) return result.AsDataless(); @@ -445,9 +445,10 @@ public async Task> CancelOrdersAsync( IEnumerable? clientOrderIds = null, CancellationToken ct = default) { + var parameters = new ParameterCollection(); - parameters.AddOptional("order-ids", orderIds); - parameters.AddOptional("client-order-ids", clientOrderIds); + parameters.AddOptional("order-ids", orderIds?.ToArray()); + parameters.AddOptional("client-order-ids", clientOrderIds?.Select(x => LibraryHelpers.ApplyBrokerId(x, HTXExchange.ClientOrderId, 64, ClientOptions.AllowAppendingClientOrderId)).ToArray()); var query = new HTXOrderQuery(new HTXSocketOrderRequest { diff --git a/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApi.cs b/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApi.cs index 4e9a6c9..17eab1f 100644 --- a/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApi.cs +++ b/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApi.cs @@ -19,8 +19,6 @@ internal partial class HTXRestClientUsdtFuturesApi : RestApiClient, IHTXRestClie /// public string ExchangeName => "HTX"; - internal readonly string _brokerId; - #region Api clients /// @@ -43,7 +41,6 @@ internal HTXRestClientUsdtFuturesApi(ILogger log, HttpClient? httpClient, HTXRes SubAccount = new HTXRestClientUsdtFuturesApiSubAccount(this); Trading = new HTXRestClientUsdtFuturesApiTrading(this); - _brokerId = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "AA1ef14811"; } #endregion diff --git a/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApiTrading.cs b/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApiTrading.cs index aeac415..3cb5784 100644 --- a/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApiTrading.cs +++ b/HTX.Net/Clients/UsdtFutures/HTXRestClientUsdtFuturesApiTrading.cs @@ -57,7 +57,7 @@ public async Task> PlaceIsolatedMarginOrderAsync( { "volume", quantity }, { "direction", EnumConverter.GetString(side) }, { "lever_rate", leverageRate }, - { "channel_code", _baseClient._brokerId }, + { "channel_code", HTXExchange.ClientOrderId }, { "order_price_type", EnumConverter.GetString(orderPriceType) } }; parameters.AddOptionalParameter("price", price?.ToString(CultureInfo.InvariantCulture)); @@ -105,7 +105,7 @@ public async Task> PlaceCrossMarginOrderAsync( { "volume", quantity }, { "direction", EnumConverter.GetString(side) }, { "lever_rate", leverageRate }, - { "channel_code", _baseClient._brokerId }, + { "channel_code", HTXExchange.ClientOrderId }, { "order_price_type", EnumConverter.GetString(orderPriceType) } }; parameters.AddOptionalParameter("contract_code", contractCode); @@ -554,7 +554,7 @@ public async Task> PlaceIsolatedMarginTriggerOrderAsy { var parameters = new ParameterCollection() { - { "channel_code", _baseClient._brokerId } + { "channel_code", HTXExchange.ClientOrderId } }; parameters.Add("contract_code", contractCode); parameters.AddEnum("trigger_type", triggerType); @@ -580,7 +580,7 @@ public async Task> PlaceCrossMarginTriggerOrderAsync( { var parameters = new ParameterCollection() { - { "channel_code", _baseClient._brokerId } + { "channel_code", HTXExchange.ClientOrderId } }; parameters.AddOptional("contract_code", contractCode); parameters.AddEnum("trigger_type", triggerType); @@ -966,7 +966,7 @@ public async Task> PlaceIsolatedMarginTrailingOrderAs { var parameters = new ParameterCollection() { - { "channel_code", _baseClient._brokerId } + { "channel_code", HTXExchange.ClientOrderId } }; parameters.Add("contract_code", contractCode); parameters.Add("reduce_only", reduceOnly ? 1 : 0); @@ -991,7 +991,7 @@ public async Task> PlaceCrossMarginTrailingOrderAsync { var parameters = new ParameterCollection() { - { "channel_code", _baseClient._brokerId } + { "channel_code", HTXExchange.ClientOrderId } }; parameters.AddOptional("contract_code", contractCode); parameters.AddOptional("pair", pair); diff --git a/HTX.Net/HTX.Net.csproj b/HTX.Net/HTX.Net.csproj index bc86f5b..541b5d1 100644 --- a/HTX.Net/HTX.Net.csproj +++ b/HTX.Net/HTX.Net.csproj @@ -48,7 +48,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/HTX.Net/HTX.Net.xml b/HTX.Net/HTX.Net.xml index 940b534..1f8ddb8 100644 --- a/HTX.Net/HTX.Net.xml +++ b/HTX.Net/HTX.Net.xml @@ -419,6 +419,9 @@ + + + @@ -17387,6 +17390,16 @@ HTX 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 +
+
Options for the HTX SymbolOrderBook @@ -17427,14 +17440,19 @@ ctor - + - Whether public requests should be signed if ApiCredentials are provided. Needed for accurate rate limiting. + 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
- + - Broker id + Whether public requests should be signed if ApiCredentials are provided. Needed for accurate rate limiting. @@ -17462,9 +17480,14 @@ ctor - + - Broker id + 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
diff --git a/HTX.Net/HTXExchange.cs b/HTX.Net/HTXExchange.cs index a0728f8..fff3fd1 100644 --- a/HTX.Net/HTXExchange.cs +++ b/HTX.Net/HTXExchange.cs @@ -38,6 +38,9 @@ public static class HTXExchange "https://www.htx.com/en-us/opend/newApiPages/" }; + internal const string ClientOrderId = "AA1ef14811"; + internal const string ClientOrderIdPrefix = ClientOrderId + LibraryHelpers.ClientOrderIdSeperator; + /// /// Format a base and quote asset to an HTX recognized symbol /// diff --git a/HTX.Net/Objects/Models/HTXBatchCancelResult.cs b/HTX.Net/Objects/Models/HTXBatchCancelResult.cs index 7560947..70ebe5d 100644 --- a/HTX.Net/Objects/Models/HTXBatchCancelResult.cs +++ b/HTX.Net/Objects/Models/HTXBatchCancelResult.cs @@ -46,6 +46,7 @@ public record HTXFailedCancelResult /// The id of the failed order /// [JsonPropertyName("client-order-id")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } } } diff --git a/HTX.Net/Objects/Models/HTXBatchPlaceResult.cs b/HTX.Net/Objects/Models/HTXBatchPlaceResult.cs index acd8c7b..c85581d 100644 --- a/HTX.Net/Objects/Models/HTXBatchPlaceResult.cs +++ b/HTX.Net/Objects/Models/HTXBatchPlaceResult.cs @@ -14,6 +14,7 @@ public record HTXBatchPlaceResult /// Client order id /// [JsonPropertyName("client-order-id")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// /// Whether the placement was successful diff --git a/HTX.Net/Objects/Models/HTXConditionalOrder.cs b/HTX.Net/Objects/Models/HTXConditionalOrder.cs index 7c0f1e6..de61446 100644 --- a/HTX.Net/Objects/Models/HTXConditionalOrder.cs +++ b/HTX.Net/Objects/Models/HTXConditionalOrder.cs @@ -26,6 +26,7 @@ public record HTXConditionalOrder /// Client order id /// [JsonPropertyName("clientOrderId")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string ClientOrderId { get; set; } = string.Empty; /// /// Symbol diff --git a/HTX.Net/Objects/Models/HTXOpenOrder.cs b/HTX.Net/Objects/Models/HTXOpenOrder.cs index 9e7d478..8a61db8 100644 --- a/HTX.Net/Objects/Models/HTXOpenOrder.cs +++ b/HTX.Net/Objects/Models/HTXOpenOrder.cs @@ -18,6 +18,7 @@ public record HTXOpenOrder /// The order id as specified by the client /// [JsonPropertyName("client-order-id")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// diff --git a/HTX.Net/Objects/Models/HTXOrder.cs b/HTX.Net/Objects/Models/HTXOrder.cs index 550c931..c7889c7 100644 --- a/HTX.Net/Objects/Models/HTXOrder.cs +++ b/HTX.Net/Objects/Models/HTXOrder.cs @@ -17,6 +17,7 @@ public record HTXOrder /// The order id as specified by the client /// [JsonPropertyName("client-order-id")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string ClientOrderId { get; set; } = string.Empty; /// diff --git a/HTX.Net/Objects/Models/HTXPlacedConditionalOrder.cs b/HTX.Net/Objects/Models/HTXPlacedConditionalOrder.cs index e3a1855..7ff5f8e 100644 --- a/HTX.Net/Objects/Models/HTXPlacedConditionalOrder.cs +++ b/HTX.Net/Objects/Models/HTXPlacedConditionalOrder.cs @@ -9,6 +9,7 @@ public record HTXPlacedConditionalOrder /// The id /// [JsonPropertyName("clientOrderId")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string ClientOrderId { get; set; } = string.Empty; } } diff --git a/HTX.Net/Objects/Models/Socket/HTXOrderCancelationUpdate.cs b/HTX.Net/Objects/Models/Socket/HTXOrderCancelationUpdate.cs index d27c4d6..95d2148 100644 --- a/HTX.Net/Objects/Models/Socket/HTXOrderCancelationUpdate.cs +++ b/HTX.Net/Objects/Models/Socket/HTXOrderCancelationUpdate.cs @@ -59,6 +59,7 @@ public record HTXOrderCancelationUpdate /// Client order id /// [JsonPropertyName("clientOrderId")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// /// Stop price diff --git a/HTX.Net/Objects/Models/Socket/HTXOrderUpdate.cs b/HTX.Net/Objects/Models/Socket/HTXOrderUpdate.cs index c6d66ff..711769d 100644 --- a/HTX.Net/Objects/Models/Socket/HTXOrderUpdate.cs +++ b/HTX.Net/Objects/Models/Socket/HTXOrderUpdate.cs @@ -23,6 +23,7 @@ public record HTXOrderUpdate /// Client order id /// [JsonPropertyName("clientOrderId")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// /// Order status diff --git a/HTX.Net/Objects/Models/Socket/HTXTradeUpdate.cs b/HTX.Net/Objects/Models/Socket/HTXTradeUpdate.cs index 7112082..2118df8 100644 --- a/HTX.Net/Objects/Models/Socket/HTXTradeUpdate.cs +++ b/HTX.Net/Objects/Models/Socket/HTXTradeUpdate.cs @@ -106,6 +106,7 @@ public record HTXTradeUpdate /// Client order id /// [JsonPropertyName("clientOrderId")] + [JsonConverterCtor($"{HTXExchange.ClientOrderIdPrefix}->")] public string? ClientOrderId { get; set; } /// /// Stop price diff --git a/HTX.Net/Objects/Options/HTXOptions.cs b/HTX.Net/Objects/Options/HTXOptions.cs index 783f8fc..3560e18 100644 --- a/HTX.Net/Objects/Options/HTXOptions.cs +++ b/HTX.Net/Objects/Options/HTXOptions.cs @@ -11,5 +11,14 @@ namespace HTX.Net.Objects.Options /// public class HTXOptions : 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/HTX.Net/Objects/Options/HTXRestOptions.cs b/HTX.Net/Objects/Options/HTXRestOptions.cs index a677e7d..1edfa47 100644 --- a/HTX.Net/Objects/Options/HTXRestOptions.cs +++ b/HTX.Net/Objects/Options/HTXRestOptions.cs @@ -22,16 +22,21 @@ public HTXRestOptions() { Default?.Set(this); } - + /// - /// Whether public requests should be signed if ApiCredentials are provided. Needed for accurate rate limiting. + /// 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 SignPublicRequests { get; set; } = false; + public bool AllowAppendingClientOrderId { get; set; } = false; /// - /// Broker id + /// Whether public requests should be signed if ApiCredentials are provided. Needed for accurate rate limiting. /// - public string? BrokerId { get; set; } + public bool SignPublicRequests { get; set; } = false; /// /// Spot API options @@ -46,8 +51,8 @@ public HTXRestOptions() internal HTXRestOptions Set(HTXRestOptions targetOptions) { targetOptions = base.Set(targetOptions); + targetOptions.AllowAppendingClientOrderId = AllowAppendingClientOrderId; targetOptions.SignPublicRequests = SignPublicRequests; - targetOptions.BrokerId = BrokerId; targetOptions.SpotOptions = SpotOptions.Set(targetOptions.SpotOptions); targetOptions.UsdtMarginSwapOptions = UsdtMarginSwapOptions.Set(targetOptions.UsdtMarginSwapOptions); return targetOptions; diff --git a/HTX.Net/Objects/Options/HTXSocketOptions.cs b/HTX.Net/Objects/Options/HTXSocketOptions.cs index be8deac..e02c9ab 100644 --- a/HTX.Net/Objects/Options/HTXSocketOptions.cs +++ b/HTX.Net/Objects/Options/HTXSocketOptions.cs @@ -25,9 +25,14 @@ public HTXSocketOptions() } /// - /// Broker id + /// 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; /// /// Spot API options @@ -42,7 +47,7 @@ public HTXSocketOptions() internal HTXSocketOptions Set(HTXSocketOptions targetOptions) { targetOptions = base.Set(targetOptions); - targetOptions.BrokerId = BrokerId; + targetOptions.AllowAppendingClientOrderId = AllowAppendingClientOrderId; targetOptions.SpotOptions = SpotOptions.Set(targetOptions.SpotOptions); targetOptions.UsdtMarginSwapOptions = UsdtMarginSwapOptions.Set(targetOptions.UsdtMarginSwapOptions); return targetOptions;