mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
adjust updateLimiter to 3 seconds one time
This commit is contained in:
parent
93770a0d9f
commit
356a8b77ac
|
@ -297,7 +297,7 @@ func (e *TwapExecution) cancelActiveOrders(ctx context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *TwapExecution) orderUpdater(ctx context.Context) {
|
func (e *TwapExecution) orderUpdater(ctx context.Context) {
|
||||||
rateLimiter := rate.NewLimiter(rate.Every(time.Minute), 15)
|
updateLimiter := rate.NewLimiter(rate.Every(3 * time.Second), 1)
|
||||||
ticker := time.NewTimer(e.UpdateInterval)
|
ticker := time.NewTimer(e.UpdateInterval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ func (e *TwapExecution) orderUpdater(ctx context.Context) {
|
||||||
return
|
return
|
||||||
|
|
||||||
case <-e.orderBook.C:
|
case <-e.orderBook.C:
|
||||||
if !rateLimiter.Allow() {
|
if !updateLimiter.Allow() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ func (e *TwapExecution) orderUpdater(ctx context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
if !rateLimiter.Allow() {
|
if !updateLimiter.Allow() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user