Skip to content

Commit

Permalink
Updated websocket rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Jul 9, 2024
1 parent c24fcd4 commit fb407c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Binance.Net/BinanceExchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void Initialize()
.AddGuard(new RateLimitGuard(RateLimitGuard.PerApiKeyPerEndpoint, new PathStartFilter("sapi/"), 180000, TimeSpan.FromMinutes(1), RateLimitWindowType.Fixed)); // Uid limit of 180000 request weight per minute to /sapi endpoints
SpotSocket = new RateLimitGate("Spot Socket")
.AddGuard(new RateLimitGuard(RateLimitGuard.PerHost, new IGuardFilter[] { new LimitItemTypeFilter(RateLimitItemType.Connection) }, 300, TimeSpan.FromMinutes(5), RateLimitWindowType.Fixed)) // 300 connections per 5 minutes per host
.AddGuard(new RateLimitGuard(RateLimitGuard.PerEndpoint, new IGuardFilter[] { new HostFilter("wss://stream.binance.com"), new LimitItemTypeFilter(RateLimitItemType.Request) }, 5, TimeSpan.FromSeconds(1), RateLimitWindowType.Fixed)) // 5 requests per second per path (connection)
.AddGuard(new RateLimitGuard(RateLimitGuard.PerEndpoint, new IGuardFilter[] { new HostFilter("wss://stream.binance.com"), new LimitItemTypeFilter(RateLimitItemType.Request) }, 4, TimeSpan.FromSeconds(1), RateLimitWindowType.Sliding)) // 5 requests per second per path (connection)
.AddGuard(new RateLimitGuard(RateLimitGuard.PerHost, new IGuardFilter[] { new HostFilter("wss://ws-api.binance.com") }, 6000, TimeSpan.FromMinutes(1), RateLimitWindowType.Fixed, connectionWeight: 2)); // 6000 request weight per minute in total
FuturesRest = new RateLimitGate("Futures Rest")
.AddGuard(new RateLimitGuard(RateLimitGuard.PerHost, new IGuardFilter[] { new HostFilter("https://fapi.binance.com") }, 2400, TimeSpan.FromMinutes(1), RateLimitWindowType.Fixed)) // IP limit of 2400 request weight per minute to fapi.binance.com host
Expand Down

0 comments on commit fb407c0

Please sign in to comment.