Merge pull request #1472 from c9s/c9s/grid2-check-price-for-subscribe

FIX: [grid2] subscribe 1m kline only when one of the trigger price is set
This commit is contained in:
c9s 2023-12-26 12:01:29 +08:00 committed by GitHub
commit d0f9052cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,7 +264,9 @@ func (s *Strategy) Initialize() error {
} }
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
if !s.TriggerPrice.IsZero() || !s.StopLossPrice.IsZero() || !s.TakeProfitPrice.IsZero() {
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m}) session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: types.Interval1m})
}
if s.AutoRange != nil { if s.AutoRange != nil {
interval := s.AutoRange.Interval() interval := s.AutoRange.Interval()