fix: remove redundant notification

This commit is contained in:
zenix 2022-10-21 16:28:21 +09:00
parent ce86544c43
commit 493b81f16c
3 changed files with 5 additions and 8 deletions

View File

@ -87,8 +87,11 @@ func (store *SerialMarketDataStore) tickerProcessor(ctx context.Context) {
duration := store.MinInterval.Duration() duration := store.MinInterval.Duration()
relativeTime := time.Now().UnixNano() % int64(duration) relativeTime := time.Now().UnixNano() % int64(duration)
waitTime := int64(duration) - relativeTime waitTime := int64(duration) - relativeTime
ch := time.After(time.Duration(waitTime)) select {
<-ch case <-time.After(time.Duration(waitTime)):
case <-ctx.Done():
return
}
intervalCloseTicker := time.NewTicker(duration) intervalCloseTicker := time.NewTicker(duration)
defer intervalCloseTicker.Stop() defer intervalCloseTicker.Stop()

View File

@ -857,7 +857,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
var buffer bytes.Buffer var buffer bytes.Buffer
if err := canvas.Render(chart.PNG, &buffer); err != nil { if err := canvas.Render(chart.PNG, &buffer); err != nil {
log.WithError(err).Errorf("cannot render indicators in drift") log.WithError(err).Errorf("cannot render indicators in drift")
reply.Message(fmt.Sprintf("[error] cannot render indicators in drift: %v", err))
return return
} }
bbgo.SendPhoto(&buffer) bbgo.SendPhoto(&buffer)
@ -870,7 +869,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
var buffer bytes.Buffer var buffer bytes.Buffer
if err := canvas.Render(chart.PNG, &buffer); err != nil { if err := canvas.Render(chart.PNG, &buffer); err != nil {
log.WithError(err).Errorf("cannot render pnl in drift") log.WithError(err).Errorf("cannot render pnl in drift")
reply.Message(fmt.Sprintf("[error] cannot render pnl in drift: %v", err))
return return
} }
bbgo.SendPhoto(&buffer) bbgo.SendPhoto(&buffer)
@ -883,7 +881,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
var buffer bytes.Buffer var buffer bytes.Buffer
if err := canvas.Render(chart.PNG, &buffer); err != nil { if err := canvas.Render(chart.PNG, &buffer); err != nil {
log.WithError(err).Errorf("cannot render cumpnl in drift") log.WithError(err).Errorf("cannot render cumpnl in drift")
reply.Message(fmt.Sprintf("[error] canot render cumpnl in drift: %v", err))
return return
} }
bbgo.SendPhoto(&buffer) bbgo.SendPhoto(&buffer)

View File

@ -22,7 +22,6 @@ func (s *Strategy) InitDrawCommands(store *bbgo.SerialMarketDataStore, profit, c
var buffer bytes.Buffer var buffer bytes.Buffer
if err := canvas.Render(chart.PNG, &buffer); err != nil { if err := canvas.Render(chart.PNG, &buffer); err != nil {
log.WithError(err).Errorf("cannot render indicators in ewo") log.WithError(err).Errorf("cannot render indicators in ewo")
reply.Message(fmt.Sprintf("[error] cannot render indicators in ewo: %v", err))
return return
} }
bbgo.SendPhoto(&buffer) bbgo.SendPhoto(&buffer)
@ -34,7 +33,6 @@ func (s *Strategy) InitDrawCommands(store *bbgo.SerialMarketDataStore, profit, c
var buffer bytes.Buffer var buffer bytes.Buffer
if err := canvas.Render(chart.PNG, &buffer); err != nil { if err := canvas.Render(chart.PNG, &buffer); err != nil {
log.WithError(err).Errorf("cannot render pnl in ewo") log.WithError(err).Errorf("cannot render pnl in ewo")
reply.Message(fmt.Sprintf("[error] cannot render pnl in ewo: %v", err))
return return
} }
bbgo.SendPhoto(&buffer) bbgo.SendPhoto(&buffer)
@ -46,7 +44,6 @@ func (s *Strategy) InitDrawCommands(store *bbgo.SerialMarketDataStore, profit, c
var buffer bytes.Buffer var buffer bytes.Buffer
if err := canvas.Render(chart.PNG, &buffer); err != nil { if err := canvas.Render(chart.PNG, &buffer); err != nil {
log.WithError(err).Errorf("cannot render cumpnl in ewo") log.WithError(err).Errorf("cannot render cumpnl in ewo")
reply.Message(fmt.Sprintf("[error] canot render cumpnl in ewo: %v", err))
return return
} }
bbgo.SendPhoto(&buffer) bbgo.SendPhoto(&buffer)