mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +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>
25 lines
552 B
Go
25 lines
552 B
Go
package btse
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
|
|
)
|
|
|
|
const (
|
|
btseRateInterval = time.Second
|
|
btseQueryLimit = 15
|
|
btseOrdersLimit = 75
|
|
|
|
queryFunc request.EndpointLimit = iota
|
|
orderFunc
|
|
)
|
|
|
|
// GetRateLimit returns the rate limit for the exchange
|
|
func GetRateLimit() request.RateLimitDefinitions {
|
|
return request.RateLimitDefinitions{
|
|
orderFunc: request.NewRateLimitWithWeight(btseRateInterval, btseOrdersLimit, 1),
|
|
queryFunc: request.NewRateLimitWithWeight(btseRateInterval, btseQueryLimit, 1),
|
|
}
|
|
}
|