From 356a8b77ac66b8902319a4c25ec5938ef25d63d8 Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 15 May 2021 09:20:46 +0800 Subject: [PATCH] adjust updateLimiter to 3 seconds one time --- pkg/bbgo/twap_order_executor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/bbgo/twap_order_executor.go b/pkg/bbgo/twap_order_executor.go index 3cb81a937..7ea3b068e 100644 --- a/pkg/bbgo/twap_order_executor.go +++ b/pkg/bbgo/twap_order_executor.go @@ -297,7 +297,7 @@ func (e *TwapExecution) cancelActiveOrders(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) defer ticker.Stop() @@ -316,7 +316,7 @@ func (e *TwapExecution) orderUpdater(ctx context.Context) { return case <-e.orderBook.C: - if !rateLimiter.Allow() { + if !updateLimiter.Allow() { break } @@ -329,7 +329,7 @@ func (e *TwapExecution) orderUpdater(ctx context.Context) { } case <-ticker.C: - if !rateLimiter.Allow() { + if !updateLimiter.Allow() { break }