From ef280077cd3d49a8f05419d50a558c6759454051 Mon Sep 17 00:00:00 2001 From: Edwin Date: Mon, 13 Nov 2023 11:53:41 +0800 Subject: [PATCH] pkg/exchange: print fee rate log --- pkg/exchange/bybit/market_info_poller.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/exchange/bybit/market_info_poller.go b/pkg/exchange/bybit/market_info_poller.go index 95664718f..e35a1e4c2 100644 --- a/pkg/exchange/bybit/market_info_poller.go +++ b/pkg/exchange/bybit/market_info_poller.go @@ -7,6 +7,8 @@ import ( "sync" "time" + "golang.org/x/time/rate" + "github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi" ) @@ -15,6 +17,10 @@ const ( feeRatePollingPeriod = time.Minute ) +var ( + pollFeeRateRateLimiter = rate.NewLimiter(rate.Every(10*time.Minute), 1) +) + type symbolFeeDetail struct { bybitapi.FeeRate @@ -78,6 +84,10 @@ func (p *feeRatePoller) poll(ctx context.Context) error { p.symbolFeeDetail = symbolFeeRate p.mu.Unlock() + if pollFeeRateRateLimiter.Allow() { + log.Infof("updated fee rate: %+v", p.symbolFeeDetail) + } + return nil }