diff --git a/Binance.Net.UnitTests/RestRequestTests.cs b/Binance.Net.UnitTests/RestRequestTests.cs index f48cc9ff..0d7a1c16 100644 --- a/Binance.Net.UnitTests/RestRequestTests.cs +++ b/Binance.Net.UnitTests/RestRequestTests.cs @@ -283,7 +283,7 @@ public async Task ValidateUsdFuturesTradingCalls() await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.GetOrderEditHistoryAsync("ETHUSDT", 123), "GetOrderEditHistory"); await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.CancelOrderAsync("ETHUSDT", 123), "CancelOrder"); await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.CancelAllOrdersAsync("ETHUSDT"), "CancelAllOrders"); - await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.EditOrderAsync("ETHUSDT", Enums.OrderSide.Buy, 1, 1, 123), "EditOrder"); + await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.EditOrderAsync("ETHUSDT", Enums.OrderSide.Buy, 1, 1, Enums.PriceMatch.None, 123), "EditOrder"); await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.EditMultipleOrdersAsync(new[] { new BinanceFuturesBatchEditOrder() }), "EditMultipleOrders", skipResponseValidation: true); await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.CancelAllOrdersAfterTimeoutAsync("ETHUSDT", TimeSpan.Zero), "CancelAllOrdersAfterTimeout"); await tester.ValidateAsync(client => client.UsdFuturesApi.Trading.CancelMultipleOrdersAsync("ETHUSDT", new List { 123 }), "CancelMultipleOrders", skipResponseValidation: true); diff --git a/Binance.Net/Binance.Net.xml b/Binance.Net/Binance.Net.xml index 332bc9f4..a685cfef 100644 --- a/Binance.Net/Binance.Net.xml +++ b/Binance.Net/Binance.Net.xml @@ -2214,7 +2214,7 @@ - + @@ -2434,7 +2434,7 @@ - + @@ -12288,7 +12288,7 @@ Cancellation token Id's for canceled order - + Edit an existing order @@ -12297,6 +12297,7 @@ Order side New quantity New price + Only avaliable for Limit/Stop/TakeProfit order Order id of the order to edit Client order id of the order to edit The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request @@ -12999,7 +13000,7 @@ The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request Cancellation token - + Edit an existing order @@ -13008,6 +13009,7 @@ Order side New quantity New price + Only avaliable for Limit/Stop/TakeProfit order Order id of the order to edit Client order id of the order to edit The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request @@ -26215,6 +26217,11 @@ Price + + + PriceMatch + + Parameters for a new futures batch order diff --git a/Binance.Net/Clients/UsdFuturesApi/BinanceRestClientUsdFuturesApiTrading.cs b/Binance.Net/Clients/UsdFuturesApi/BinanceRestClientUsdFuturesApiTrading.cs index 3deb876e..53a1ebd2 100644 --- a/Binance.Net/Clients/UsdFuturesApi/BinanceRestClientUsdFuturesApiTrading.cs +++ b/Binance.Net/Clients/UsdFuturesApi/BinanceRestClientUsdFuturesApiTrading.cs @@ -295,7 +295,7 @@ public async Task> CancelAllOrdersA #region Edit Order /// - public async Task> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal price, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) + public async Task> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal? price = null, PriceMatch? priceMatch = null, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) { if (!orderId.HasValue && string.IsNullOrEmpty(origClientOrderId)) throw new ArgumentException("Either orderId or origClientOrderId must be sent"); @@ -308,8 +308,9 @@ public async Task> EditOrderAsync(string s { "symbol", symbol }, { "side", EnumConverter.GetString(side) }, { "quantity", quantity.ToString(CultureInfo.InvariantCulture) }, - { "price", price.ToString(CultureInfo.InvariantCulture) }, }; + parameters.AddOptionalParameter("price", price?.ToString(CultureInfo.InvariantCulture)); + parameters.AddOptionalEnum("priceMatch", priceMatch); parameters.AddOptionalParameter("orderId", orderId?.ToString(CultureInfo.InvariantCulture)); parameters.AddOptionalParameter("origClientOrderId", origClientOrderId); parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)); @@ -341,8 +342,9 @@ public async Task>> { { "symbol", order.Symbol }, { "quantity", order.Quantity.ToString(CultureInfo.InvariantCulture) }, - { "price", order.Price.ToString(CultureInfo.InvariantCulture) }, }; + orderParameters.AddOptionalParameter("price", order.Price?.ToString(CultureInfo.InvariantCulture)); + orderParameters.AddOptionalEnum("priceMatch", order.PriceMatch); orderParameters.AddEnum("side", order.Side); orderParameters.AddOptionalParameter("orderId", order.OrderId?.ToString(CultureInfo.InvariantCulture)); orderParameters.AddOptionalParameter("origClientOrderId", clientOrderId); diff --git a/Binance.Net/Clients/UsdFuturesApi/BinanceSocketClientUsdFuturesApiTrading.cs b/Binance.Net/Clients/UsdFuturesApi/BinanceSocketClientUsdFuturesApiTrading.cs index 8a85650f..26bcc0cc 100644 --- a/Binance.Net/Clients/UsdFuturesApi/BinanceSocketClientUsdFuturesApiTrading.cs +++ b/Binance.Net/Clients/UsdFuturesApi/BinanceSocketClientUsdFuturesApiTrading.cs @@ -89,7 +89,7 @@ public async Task>> PlaceOrde #region Edit Order /// - public async Task>> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal price, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) + public async Task>> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal? price = null, PriceMatch? priceMatch = null, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) { if (!orderId.HasValue && string.IsNullOrEmpty(origClientOrderId)) throw new ArgumentException("Either orderId or origClientOrderId must be sent"); @@ -102,8 +102,9 @@ public async Task>> EditOrder { "symbol", symbol }, { "side", EnumConverter.GetString(side) }, { "quantity", quantity.ToString(CultureInfo.InvariantCulture) }, - { "price", price.ToString(CultureInfo.InvariantCulture) }, }; + parameters.AddOptionalParameter("price", price?.ToString(CultureInfo.InvariantCulture)); + parameters.AddOptionalEnum("priceMatch", priceMatch); parameters.AddOptionalParameter("orderId", orderId?.ToString(CultureInfo.InvariantCulture)); parameters.AddOptionalParameter("origClientOrderId", origClientOrderId); parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture)); diff --git a/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceRestClientUsdFuturesApiTrading.cs b/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceRestClientUsdFuturesApiTrading.cs index 6c900cdf..16905e61 100644 --- a/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceRestClientUsdFuturesApiTrading.cs +++ b/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceRestClientUsdFuturesApiTrading.cs @@ -137,12 +137,13 @@ Task>>> PlaceMultip /// Order side /// New quantity /// New price + /// Only avaliable for Limit/Stop/TakeProfit order /// Order id of the order to edit /// Client order id of the order to edit /// The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request /// Cancellation token /// - Task> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal price, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default); + Task> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal? price, PriceMatch? priceMatch = null, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default); /// /// Edit multiple existing orders diff --git a/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceSocketClientUsdFuturesApiTrading.cs b/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceSocketClientUsdFuturesApiTrading.cs index dfd0f6c1..18a007c8 100644 --- a/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceSocketClientUsdFuturesApiTrading.cs +++ b/Binance.Net/Interfaces/Clients/UsdFuturesApi/IBinanceSocketClientUsdFuturesApiTrading.cs @@ -64,12 +64,13 @@ Task>> PlaceOrderAsync(string /// Order side /// New quantity /// New price + /// Only avaliable for Limit/Stop/TakeProfit order /// Order id of the order to edit /// Client order id of the order to edit /// The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request /// Cancellation token /// - Task>> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal price, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default); + Task>> EditOrderAsync(string symbol, OrderSide side, decimal quantity, decimal? price = null, PriceMatch? priceMatch = null, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default); /// /// Cancels a pending order diff --git a/Binance.Net/Objects/Models/Futures/BinanceFuturesBatchEditOrder.cs b/Binance.Net/Objects/Models/Futures/BinanceFuturesBatchEditOrder.cs index 218fd29c..ba13eb09 100644 --- a/Binance.Net/Objects/Models/Futures/BinanceFuturesBatchEditOrder.cs +++ b/Binance.Net/Objects/Models/Futures/BinanceFuturesBatchEditOrder.cs @@ -30,6 +30,10 @@ public record BinanceFuturesBatchEditOrder /// /// Price /// - public decimal Price { get; set; } + public decimal? Price { get; set; } + /// + /// PriceMatch + /// + public PriceMatch? PriceMatch { get; set; } } }