diff --git a/BitMart.Net/BitMart.Net.csproj b/BitMart.Net/BitMart.Net.csproj index 3f29cd1..3cedfbe 100644 --- a/BitMart.Net/BitMart.Net.csproj +++ b/BitMart.Net/BitMart.Net.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;netstandard2.1 10.0 @@ -48,10 +48,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + all runtime; build; native; contentfiles; analyzers; buildtransitive - \ No newline at end of file diff --git a/BitMart.Net/BitMartExchange.cs b/BitMart.Net/BitMartExchange.cs index bff8dae..ae593be 100644 --- a/BitMart.Net/BitMartExchange.cs +++ b/BitMart.Net/BitMartExchange.cs @@ -58,10 +58,14 @@ private void Initialize() { BitMart = new RateLimitGate("BitMart IP"); BitMart.RateLimitTriggered += (x) => RateLimitTriggered?.Invoke(x); + SocketLimits = new RateLimitGate("Socket limits") + .AddGuard(new RateLimitGuard(RateLimitGuard.PerHost, new LimitItemTypeFilter(RateLimitItemType.Connection), 100, TimeSpan.FromSeconds(60), RateLimitWindowType.Sliding, connectionWeight: 1)); + SocketLimits.RateLimitTriggered += (x) => RateLimitTriggered?.Invoke(x); } internal IRateLimitGate BitMart { get; private set; } + internal IRateLimitGate SocketLimits { get; private set; } } } diff --git a/BitMart.Net/Clients/SpotApi/BitMartSocketClientSpotApi.cs b/BitMart.Net/Clients/SpotApi/BitMartSocketClientSpotApi.cs index 91afd63..19833d1 100644 --- a/BitMart.Net/Clients/SpotApi/BitMartSocketClientSpotApi.cs +++ b/BitMart.Net/Clients/SpotApi/BitMartSocketClientSpotApi.cs @@ -47,8 +47,8 @@ internal BitMartSocketClientSpotApi(ILogger logger, BitMartSocketOptions options base(logger, options.Environment.SocketClientSpotAddress!, options, options.SpotOptions) { KeepAliveInterval = TimeSpan.Zero; - RegisterPeriodicQuery("ping", TimeSpan.FromSeconds(15), x => new PingQuery(), null); + RateLimiter = BitMartExchange.RateLimiter.SocketLimits; } #endregion