From 4d17d7e0499c19d041333fcc84ccdeec748df2a9 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 26 Dec 2023 10:56:08 +0800 Subject: [PATCH] grid2: subscribe 1m kline only when one of the trigger price is set --- pkg/strategy/grid2/strategy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index f3c79803c..209b82feb 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -264,7 +264,9 @@ func (s *Strategy) Initialize() error { } func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { - session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m}) + if !s.TriggerPrice.IsZero() || !s.StopLossPrice.IsZero() || !s.TakeProfitPrice.IsZero() { + session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m}) + } if s.AutoRange != nil { interval := s.AutoRange.Interval()