schedule: fix schedule subscription

This commit is contained in:
c9s 2021-08-19 16:35:05 +08:00
parent cf29cfadd0
commit 66b7e1fc3f

View File

@ -96,6 +96,12 @@ func (s *Strategy) ID() string {
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.Interval.String()})
if s.BelowMovingAverage != nil {
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.BelowMovingAverage.Interval.String()})
}
if s.AboveMovingAverage != nil {
session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: s.AboveMovingAverage.Interval.String()})
}
}
func (s *Strategy) Validate() error {