max: adjust max rate limiters

This commit is contained in:
c9s 2024-03-15 15:19:52 +08:00
parent 14fd4ea449
commit f785398249
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -55,14 +55,14 @@ func New(key, secret string) *Exchange {
v3client: &v3.Client{Client: client}, v3client: &v3.Client{Client: client},
v3margin: &v3.MarginService{Client: client}, v3margin: &v3.MarginService{Client: client},
queryTradeLimiter: rate.NewLimiter(rate.Every(1*time.Second), 2), queryTradeLimiter: rate.NewLimiter(rate.Every(250*time.Millisecond), 2),
// 1200 cpm (1200 requests per minute = 20 requests per second) // 1200 cpm (1200 requests per minute = 20 requests per second)
submitOrderLimiter: rate.NewLimiter(rate.Every(50*time.Millisecond), 20), submitOrderLimiter: rate.NewLimiter(rate.Every(50*time.Millisecond), 20),
// closedOrderQueryLimiter is used for the closed orders query rate limit, 1 request per second // closedOrderQueryLimiter is used for the closed orders query rate limit, 1 request per second
closedOrderQueryLimiter: rate.NewLimiter(rate.Every(1*time.Second), 1), closedOrderQueryLimiter: rate.NewLimiter(rate.Every(1*time.Second), 1),
accountQueryLimiter: rate.NewLimiter(rate.Every(1*time.Second), 1), accountQueryLimiter: rate.NewLimiter(rate.Every(250*time.Millisecond), 1),
marketDataLimiter: rate.NewLimiter(rate.Every(2*time.Second), 10), marketDataLimiter: rate.NewLimiter(rate.Every(2*time.Second), 10),
} }
} }