diff --git a/pkg/bbgo/serialmarketdatastore.go b/pkg/bbgo/serialmarketdatastore.go index f660e49fa..0b4e321ac 100644 --- a/pkg/bbgo/serialmarketdatastore.go +++ b/pkg/bbgo/serialmarketdatastore.go @@ -87,8 +87,11 @@ func (store *SerialMarketDataStore) tickerProcessor(ctx context.Context) { duration := store.MinInterval.Duration() relativeTime := time.Now().UnixNano() % int64(duration) waitTime := int64(duration) - relativeTime - ch := time.After(time.Duration(waitTime)) - <-ch + select { + case <-time.After(time.Duration(waitTime)): + case <-ctx.Done(): + return + } intervalCloseTicker := time.NewTicker(duration) defer intervalCloseTicker.Stop() diff --git a/pkg/strategy/drift/strategy.go b/pkg/strategy/drift/strategy.go index cf4287c87..6c5e97243 100644 --- a/pkg/strategy/drift/strategy.go +++ b/pkg/strategy/drift/strategy.go @@ -857,7 +857,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se var buffer bytes.Buffer if err := canvas.Render(chart.PNG, &buffer); err != nil { log.WithError(err).Errorf("cannot render indicators in drift") - reply.Message(fmt.Sprintf("[error] cannot render indicators in drift: %v", err)) return } bbgo.SendPhoto(&buffer) @@ -870,7 +869,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se var buffer bytes.Buffer if err := canvas.Render(chart.PNG, &buffer); err != nil { log.WithError(err).Errorf("cannot render pnl in drift") - reply.Message(fmt.Sprintf("[error] cannot render pnl in drift: %v", err)) return } bbgo.SendPhoto(&buffer) @@ -883,7 +881,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se var buffer bytes.Buffer if err := canvas.Render(chart.PNG, &buffer); err != nil { log.WithError(err).Errorf("cannot render cumpnl in drift") - reply.Message(fmt.Sprintf("[error] canot render cumpnl in drift: %v", err)) return } bbgo.SendPhoto(&buffer) diff --git a/pkg/strategy/elliottwave/draw.go b/pkg/strategy/elliottwave/draw.go index 6378839dc..fa1427424 100644 --- a/pkg/strategy/elliottwave/draw.go +++ b/pkg/strategy/elliottwave/draw.go @@ -22,7 +22,6 @@ func (s *Strategy) InitDrawCommands(store *bbgo.SerialMarketDataStore, profit, c var buffer bytes.Buffer if err := canvas.Render(chart.PNG, &buffer); err != nil { log.WithError(err).Errorf("cannot render indicators in ewo") - reply.Message(fmt.Sprintf("[error] cannot render indicators in ewo: %v", err)) return } bbgo.SendPhoto(&buffer) @@ -34,7 +33,6 @@ func (s *Strategy) InitDrawCommands(store *bbgo.SerialMarketDataStore, profit, c var buffer bytes.Buffer if err := canvas.Render(chart.PNG, &buffer); err != nil { log.WithError(err).Errorf("cannot render pnl in ewo") - reply.Message(fmt.Sprintf("[error] cannot render pnl in ewo: %v", err)) return } bbgo.SendPhoto(&buffer) @@ -46,7 +44,6 @@ func (s *Strategy) InitDrawCommands(store *bbgo.SerialMarketDataStore, profit, c var buffer bytes.Buffer if err := canvas.Render(chart.PNG, &buffer); err != nil { log.WithError(err).Errorf("cannot render cumpnl in ewo") - reply.Message(fmt.Sprintf("[error] canot render cumpnl in ewo: %v", err)) return } bbgo.SendPhoto(&buffer)