From dd0f793478cbd99b5cb168db29207f2bd996afd2 Mon Sep 17 00:00:00 2001 From: JKorf Date: Tue, 5 Mar 2024 08:45:33 +0100 Subject: [PATCH] Fix for SpotApi.Trading.CancelAllOrdersAsync type parameter --- .../SpotApi/KucoinRestClientSpotApiTrading.cs | 2 +- Kucoin.Net/Converters/TradeTypeConverter.cs | 1 + Kucoin.Net/Enums/TradeType.cs | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Kucoin.Net/Clients/SpotApi/KucoinRestClientSpotApiTrading.cs b/Kucoin.Net/Clients/SpotApi/KucoinRestClientSpotApiTrading.cs index ea9ae228..8f9379df 100644 --- a/Kucoin.Net/Clients/SpotApi/KucoinRestClientSpotApiTrading.cs +++ b/Kucoin.Net/Clients/SpotApi/KucoinRestClientSpotApiTrading.cs @@ -312,7 +312,7 @@ public async Task> CancelAllOrdersAsync(stri symbol?.ValidateKucoinSymbol(); var parameters = new Dictionary(); parameters.AddOptionalParameter("symbol", symbol); - parameters.AddOptionalParameter("tradeType", type); + parameters.AddOptionalParameter("tradeType", EnumConverter.GetString(type)); return await _baseClient.Execute(_baseClient.GetUri("orders"), HttpMethod.Delete, ct, parameters, true, weight: 60).ConfigureAwait(false); } diff --git a/Kucoin.Net/Converters/TradeTypeConverter.cs b/Kucoin.Net/Converters/TradeTypeConverter.cs index 6f53856e..3b29ac1f 100644 --- a/Kucoin.Net/Converters/TradeTypeConverter.cs +++ b/Kucoin.Net/Converters/TradeTypeConverter.cs @@ -14,6 +14,7 @@ public TradeTypeConverter(bool quotes) : base(quotes) protected override List> Mapping => new List> { + new KeyValuePair(TradeType.IsolatedMarginTrade, "ISOLATED_MARGIN_TRADE"), new KeyValuePair(TradeType.MarginTrade, "MARGIN_TRADE"), new KeyValuePair(TradeType.SpotTrade, "TRADE") }; diff --git a/Kucoin.Net/Enums/TradeType.cs b/Kucoin.Net/Enums/TradeType.cs index f433200b..30034469 100644 --- a/Kucoin.Net/Enums/TradeType.cs +++ b/Kucoin.Net/Enums/TradeType.cs @@ -1,4 +1,6 @@ -namespace Kucoin.Net.Enums +using CryptoExchange.Net.Attributes; + +namespace Kucoin.Net.Enums { /// /// Type of trade @@ -6,12 +8,19 @@ public enum TradeType { /// - /// Stop trade + /// Spot trade /// + [Map("TRADE")] SpotTrade, /// /// Margin trade /// - MarginTrade + [Map("MARGIN_TRADE")] + MarginTrade, + /// + /// Isolated margin trade + /// + [Map("MARGIN_ISOLATED_TRADE")] + IsolatedMarginTrade } }