liqmaker: fix interval checking

This commit is contained in:
c9s 2024-11-22 16:59:38 +08:00
parent 8073f4c304
commit 55e9910441
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -155,6 +155,8 @@ func (s *Strategy) updateMarketMetrics(ctx context.Context) error {
} }
func (s *Strategy) liquidityWorker(ctx context.Context, interval types.Interval) { func (s *Strategy) liquidityWorker(ctx context.Context, interval types.Interval) {
s.logger.Infof("starting liquidity worker with interval %v", interval)
metricsTicker := time.NewTicker(5 * time.Second) metricsTicker := time.NewTicker(5 * time.Second)
defer metricsTicker.Stop() defer metricsTicker.Stop()
@ -233,8 +235,7 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
} }
}) })
if intervalProvider, ok := session.Exchange.(types.CustomIntervalProvider); ok { if intervalProvider, ok := session.Exchange.(types.CustomIntervalProvider); ok && intervalProvider.IsSupportedInterval(s.LiquidityUpdateInterval) {
if intervalProvider.IsSupportedInterval(s.LiquidityUpdateInterval) {
session.UserDataStream.OnAuth(func() { session.UserDataStream.OnAuth(func() {
s.placeLiquidityOrders(ctx) s.placeLiquidityOrders(ctx)
}) })
@ -248,7 +249,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
go s.liquidityWorker(ctx, s.LiquidityUpdateInterval) go s.liquidityWorker(ctx, s.LiquidityUpdateInterval)
}) })
} }
}
bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) { bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) {
defer wg.Done() defer wg.Done()