Files
gocryptotrader/exchanges/coinbasepro/ratelimit.go
Ryan O'Hara-Reid f6a95da536 exchanges/request: abstract and consolidate rate limiting code to request package (#1477)
* 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>
2024-06-03 11:57:31 +10:00

23 lines
593 B
Go

package coinbasepro
import (
"time"
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
)
// Coinbasepro rate limit conts
const (
coinbaseproRateInterval = time.Second
coinbaseproAuthRate = 5
coinbaseproUnauthRate = 2
)
// GetRateLimit returns the rate limit for the exchange
func GetRateLimit() request.RateLimitDefinitions {
return request.RateLimitDefinitions{
request.Auth: request.NewRateLimitWithWeight(coinbaseproRateInterval, coinbaseproAuthRate, 1),
request.UnAuth: request.NewRateLimitWithWeight(coinbaseproRateInterval, coinbaseproUnauthRate, 1),
}
}