mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +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>
29 lines
1.0 KiB
Go
29 lines
1.0 KiB
Go
package bitflyer
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
|
|
)
|
|
|
|
// Exchange specific rate limit consts
|
|
const (
|
|
biflyerRateInterval = time.Minute * 5
|
|
bitflyerPrivateRequestRate = 500
|
|
bitflyerPrivateLowVolumeRequestRate = 100
|
|
bitflyerPrivateSendOrderRequestRate = 300
|
|
bitflyerPublicRequestRate = 500
|
|
)
|
|
|
|
// GetRateLimit returns the rate limit for the exchange
|
|
func GetRateLimit() request.RateLimitDefinitions {
|
|
return request.RateLimitDefinitions{
|
|
request.Auth: request.NewRateLimitWithWeight(biflyerRateInterval, bitflyerPrivateRequestRate, 1),
|
|
request.UnAuth: request.NewRateLimitWithWeight(biflyerRateInterval, bitflyerPublicRequestRate, 1),
|
|
// TODO: Below limits need to also take from auth rate limit. This
|
|
// can not yet be tested and verified so is left not done for now.
|
|
orders: request.NewRateLimitWithWeight(biflyerRateInterval, bitflyerPrivateSendOrderRequestRate, 1),
|
|
lowVolume: request.NewRateLimitWithWeight(time.Minute, bitflyerPrivateLowVolumeRequestRate, 1),
|
|
}
|
|
}
|