mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 15:10:42 +00:00
Request package update & rate limit system expansion (#413)
* Initial rework of rework of requester - WIP * Implementing and checking rate limits - WIP * implemented coinbene rate limiting shenanigans * add in remaining WIP * fixy * use authenticated rate limit * drop ceiling as this can be done with a counter later * add functionality to struct * purge config options for rate limiting so as to keep things minimal * prepare futures and swap rate limiting for implementation * Address linter issues * Addressed nits, fixed race * fix linter issue * remove global var as this was only setting when newrequester was called * moved rate limit functionality into its own file * Update Bitfinex with correct rate limit and test endpoints (WIP) * finish off bitfinex adjustments * fixes * fix linter issues * slowed rate for coinbasepro * drop rate limit for huobi as the doc times have intermittent 429 issues. * Set MACOSX_DEPLOYMENT_TARGET to remove linking warning * Addr Thrasher nits * Addr glorious nits * unexport do request function * fixed nitorinos * Fixed something I missed * move disabled rate limiter into loadexchange and use interface functionality * Add temp quick fix
This commit is contained in:
@@ -179,20 +179,17 @@ func ValidateSettings(b *Engine, s *Settings) {
|
||||
b.Settings.EnableExchangeWebsocketSupport = s.EnableExchangeWebsocketSupport
|
||||
b.Settings.EnableExchangeRESTSupport = s.EnableExchangeRESTSupport
|
||||
b.Settings.EnableExchangeVerbose = s.EnableExchangeVerbose
|
||||
b.Settings.EnableExchangeHTTPRateLimiter = s.EnableExchangeHTTPDebugging
|
||||
b.Settings.EnableExchangeHTTPRateLimiter = s.EnableExchangeHTTPRateLimiter
|
||||
b.Settings.EnableExchangeHTTPDebugging = s.EnableExchangeHTTPDebugging
|
||||
b.Settings.DisableExchangeAutoPairUpdates = s.DisableExchangeAutoPairUpdates
|
||||
b.Settings.ExchangePurgeCredentials = s.ExchangePurgeCredentials
|
||||
b.Settings.EnableWebsocketRoutine = s.EnableWebsocketRoutine
|
||||
|
||||
if !b.Settings.EnableExchangeHTTPRateLimiter {
|
||||
request.DisableRateLimiter = true
|
||||
}
|
||||
|
||||
// Checks if the flag values are different from the defaults
|
||||
b.Settings.MaxHTTPRequestJobsLimit = s.MaxHTTPRequestJobsLimit
|
||||
if b.Settings.MaxHTTPRequestJobsLimit != request.DefaultMaxRequestJobs && s.MaxHTTPRequestJobsLimit > 0 {
|
||||
request.MaxRequestJobs = b.Settings.MaxHTTPRequestJobsLimit
|
||||
if b.Settings.MaxHTTPRequestJobsLimit != int(request.DefaultMaxRequestJobs) &&
|
||||
s.MaxHTTPRequestJobsLimit > 0 {
|
||||
request.MaxRequestJobs = int32(b.Settings.MaxHTTPRequestJobsLimit)
|
||||
}
|
||||
|
||||
b.Settings.RequestTimeoutRetryAttempts = s.RequestTimeoutRetryAttempts
|
||||
@@ -404,7 +401,7 @@ func (e *Engine) Start() error {
|
||||
|
||||
if e.Settings.EnableDepositAddressManager {
|
||||
e.DepositAddressManager = new(DepositAddressManager)
|
||||
e.DepositAddressManager.Sync()
|
||||
go e.DepositAddressManager.Sync()
|
||||
}
|
||||
|
||||
if e.Settings.EnableOrderManager {
|
||||
|
||||
@@ -275,6 +275,19 @@ func LoadExchange(name string, useWG bool, wg *sync.WaitGroup) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !Bot.Settings.EnableExchangeHTTPRateLimiter {
|
||||
log.Warnf(log.ExchangeSys,
|
||||
"Loaded exchange %s rate limiting has been turned off.\n",
|
||||
exch.GetName())
|
||||
err = exch.DisableRateLimiter()
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys,
|
||||
"Loaded exchange %s rate limiting cannot be turned off: %s.\n",
|
||||
exch.GetName(),
|
||||
err)
|
||||
}
|
||||
}
|
||||
|
||||
Bot.Exchanges = append(Bot.Exchanges, exch)
|
||||
|
||||
base := exch.GetBase()
|
||||
|
||||
Reference in New Issue
Block a user