diff --git a/Kucoin.Net/Clients/FuturesApi/KucoinSocketClientFuturesApi.cs b/Kucoin.Net/Clients/FuturesApi/KucoinSocketClientFuturesApi.cs index 30ee7a1e..410fc738 100644 --- a/Kucoin.Net/Clients/FuturesApi/KucoinSocketClientFuturesApi.cs +++ b/Kucoin.Net/Clients/FuturesApi/KucoinSocketClientFuturesApi.cs @@ -48,11 +48,11 @@ internal KucoinSocketClientFuturesApi(ILogger logger, KucoinSocketClient baseCli public override string GetListenerIdentifier(IMessageAccessor message) { var type = message.GetValue(_typePath); - if (type == "welcome") - return type; + if (string.Equals(type, "welcome", StringComparison.Ordinal)) + return type!; var id = message.GetValue(_idPath); - if (type != "message" && id != null) + if (!string.Equals(type, "message", StringComparison.Ordinal) && id != null) return id; return message.GetValue(_topicPath)!; diff --git a/Kucoin.Net/Clients/SpotApi/KucoinSocketClientSpotApi.cs b/Kucoin.Net/Clients/SpotApi/KucoinSocketClientSpotApi.cs index c2a2b67a..759a3393 100644 --- a/Kucoin.Net/Clients/SpotApi/KucoinSocketClientSpotApi.cs +++ b/Kucoin.Net/Clients/SpotApi/KucoinSocketClientSpotApi.cs @@ -57,16 +57,16 @@ protected override AuthenticationProvider CreateAuthenticationProvider(ApiCreden public override string GetListenerIdentifier(IMessageAccessor message) { var type = message.GetValue(_typePath); - if (type == "welcome") - return type; + if (string.Equals(type, "welcome", StringComparison.Ordinal)) + return type!; var topic = message.GetValue(_topicPath); var id = message.GetValue(_idPath); if (id != null) { - if (topic == "/account/balance") + if (string.Equals(topic, "/account/balance", StringComparison.Ordinal)) // This update also contain an id field, but should be identified by the topic regardless - return topic; + return topic!; return id; } diff --git a/Kucoin.Net/Objects/Models/Futures/Socket/KucoinFuturesOrderBookChange.cs b/Kucoin.Net/Objects/Models/Futures/Socket/KucoinFuturesOrderBookChange.cs index d9d9bb24..82341224 100644 --- a/Kucoin.Net/Objects/Models/Futures/Socket/KucoinFuturesOrderBookChange.cs +++ b/Kucoin.Net/Objects/Models/Futures/Socket/KucoinFuturesOrderBookChange.cs @@ -1,5 +1,6 @@ using Kucoin.Net.Enums; using Newtonsoft.Json; +using System; namespace Kucoin.Net.Objects.Models.Futures.Socket { @@ -21,7 +22,7 @@ public class KucoinFuturesOrderBookChange /// /// Side /// - public OrderSide Side => Change.Split(',')[1] == "sell" ? OrderSide.Sell : OrderSide.Buy; + public OrderSide Side => string.Equals(Change.Split(',')[1], "sell", StringComparison.Ordinal) ? OrderSide.Sell : OrderSide.Buy; /// /// Quantity /// diff --git a/Kucoin.Net/Objects/Sockets/Queries/KucoinQuery.cs b/Kucoin.Net/Objects/Sockets/Queries/KucoinQuery.cs index 72601476..d22ac9fd 100644 --- a/Kucoin.Net/Objects/Sockets/Queries/KucoinQuery.cs +++ b/Kucoin.Net/Objects/Sockets/Queries/KucoinQuery.cs @@ -3,6 +3,7 @@ using CryptoExchange.Net.Objects.Sockets; using CryptoExchange.Net.Sockets; using Kucoin.Net.Objects.Internal; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -20,7 +21,7 @@ public KucoinQuery(string type, string topic, bool auth) : base(new KucoinReques public override CallResult HandleMessage(SocketConnection connection, DataEvent message) { var kucoinResponse = message.Data; - if (kucoinResponse.Type == "error") + if (string.Equals(kucoinResponse.Type, "error", StringComparison.Ordinal)) return new CallResult(new ServerError(kucoinResponse.Code ?? 0, kucoinResponse.Data!)); return base.HandleMessage(connection, message); diff --git a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinBalanceSubscription.cs b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinBalanceSubscription.cs index 7b49eefe..8b67d93a 100644 --- a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinBalanceSubscription.cs +++ b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinBalanceSubscription.cs @@ -62,9 +62,9 @@ public override CallResult DoHandleMessage(SocketConnection connection, DataEven public override Type? GetMessageType(IMessageAccessor message) { var subject = message.GetValue(_subjectPath); - if (subject == "orderMargin.change") + if (string.Equals(subject, "orderMargin.change", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); - if (subject == "availableBalance.change") + if (string.Equals(subject, "availableBalance.change", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); return typeof(KucoinSocketUpdate); } diff --git a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinInstrumentSubscription.cs b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinInstrumentSubscription.cs index 76e108c5..27d1edf2 100644 --- a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinInstrumentSubscription.cs +++ b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinInstrumentSubscription.cs @@ -55,7 +55,7 @@ public override CallResult DoHandleMessage(SocketConnection connection, DataEven public override Type? GetMessageType(IMessageAccessor message) { var subject = message.GetValue(_subjectPath); - if (subject == "mark.index.price") + if (string.Equals(subject, "mark.index.price", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); return typeof(KucoinSocketUpdate); } diff --git a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinOrderSubscription.cs b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinOrderSubscription.cs index 93335570..25748073 100644 --- a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinOrderSubscription.cs +++ b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinOrderSubscription.cs @@ -61,9 +61,9 @@ public override CallResult DoHandleMessage(SocketConnection connection, DataEven public override Type? GetMessageType(IMessageAccessor message) { var type = message.GetValue(_typePath); - if (type == "match") + if (string.Equals(type, "match", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); - if (type == "received") + if (string.Equals(type, "received", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); return typeof(KucoinSocketUpdate); } diff --git a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinPositionSubscription.cs b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinPositionSubscription.cs index 7d48a724..8f268362 100644 --- a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinPositionSubscription.cs +++ b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinPositionSubscription.cs @@ -71,17 +71,17 @@ public override CallResult DoHandleMessage(SocketConnection connection, DataEven public override Type? GetMessageType(IMessageAccessor message) { var subject = message.GetValue(_subjectPath); - if (subject == "position.change") + if (string.Equals(subject, "position.change", StringComparison.Ordinal)) { var change = message.GetValue(_changeReasonPath); - if (change == null || change == "markPriceChange") + if (change == null || string.Equals(change, "markPriceChange", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); else return typeof(KucoinSocketUpdate); } - if (subject == "position.settlement") + if (string.Equals(subject, "position.settlement", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); - if (subject == "position.adjustRiskLimit") + if (string.Equals(subject, "position.adjustRiskLimit", StringComparison.Ordinal)) return typeof(KucoinSocketUpdate); return null; diff --git a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinSubscription.cs b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinSubscription.cs index c0becacc..5b18bb6f 100644 --- a/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinSubscription.cs +++ b/Kucoin.Net/Objects/Sockets/Subscriptions/KucoinSubscription.cs @@ -40,7 +40,7 @@ public override CallResult DoHandleMessage(SocketConnection connection, DataEven { var data = (KucoinSocketUpdate)message.Data; string? topic = data.Topic.Contains(":") ? data.Topic.Split(':').Last() : null; - if (topic == "all") + if (string.Equals(topic, "all", StringComparison.Ordinal)) topic = data.Subject; _handler.Invoke(message.As(data.Data, topic, SocketUpdateType.Update));