mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
Merge pull request #1409 from c9s/edwin/bybit/pint-log
CHORE: [bybit] print fee rate log
This commit is contained in:
commit
594ad89c67
|
@ -7,6 +7,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/time/rate"
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi"
|
"github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,6 +17,10 @@ const (
|
||||||
feeRatePollingPeriod = time.Minute
|
feeRatePollingPeriod = time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
pollFeeRateRateLimiter = rate.NewLimiter(rate.Every(10*time.Minute), 1)
|
||||||
|
)
|
||||||
|
|
||||||
type symbolFeeDetail struct {
|
type symbolFeeDetail struct {
|
||||||
bybitapi.FeeRate
|
bybitapi.FeeRate
|
||||||
|
|
||||||
|
@ -78,6 +84,10 @@ func (p *feeRatePoller) poll(ctx context.Context) error {
|
||||||
p.symbolFeeDetail = symbolFeeRate
|
p.symbolFeeDetail = symbolFeeRate
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
|
||||||
|
if pollFeeRateRateLimiter.Allow() {
|
||||||
|
log.Infof("updated fee rate: %+v", p.symbolFeeDetail)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user