mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* initial consolidation of rate limiting code to request package to reduce bespoke code implementation * continued * finish abstraction * lint * exchanges: fix tests * linter: fix * poloniex: fix auth rate limit not being set * ratelimiter: convert from token to weight * glorious: nits addressed with fire * linter: rip * change func name set -> get * fix test * derbit: impl --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
23 lines
545 B
Go
23 lines
545 B
Go
package bitmex
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
|
|
)
|
|
|
|
// Bitmex rate limits
|
|
const (
|
|
bitmexRateInterval = time.Minute
|
|
bitmexUnauthRate = 30
|
|
bitmexAuthRate = 60
|
|
)
|
|
|
|
// GetRateLimit returns the rate limit for the exchange
|
|
func GetRateLimit() request.RateLimitDefinitions {
|
|
return request.RateLimitDefinitions{
|
|
request.Auth: request.NewRateLimitWithWeight(bitmexRateInterval, bitmexAuthRate, 1),
|
|
request.UnAuth: request.NewRateLimitWithWeight(bitmexRateInterval, bitmexUnauthRate, 1),
|
|
}
|
|
}
|