Skip to content

Commit c09ca6b

Browse files
authored
added rate limiter for BinanceGroupCommon (#784)
1 parent 054218b commit c09ca6b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ protected BinanceGroupCommon()
6161
MarketSymbolIsUppercase = true;
6262
WebSocketOrderBookType = WebSocketOrderBookType.DeltasOnly;
6363
ExchangeGlobalCurrencyReplacements["BCC"] = "BCH";
64+
/* Binance rate limits are a combination of 3 things:
65+
* - 1200 request weights per 1 minute
66+
* - 100 orders per 10 seconds
67+
* - 200,000 orders per 1 day
68+
* - 5,000 raw requests per 5 min
69+
* Since the most restrictive is the 100 orders per 10 seconds, and OCO orders count for 2, we can conservatively do a little less than 50 per 10 seconds
70+
*/
71+
RateLimit = new RateGate(40, TimeSpan.FromSeconds(10)); // set to 9 to be safe
6472
}
6573

6674
public override Task<string> ExchangeMarketSymbolToGlobalMarketSymbolAsync(string marketSymbol)

0 commit comments

Comments
 (0)