strategy: update dynamic spread after kline being filtered

This commit is contained in:
Andy Cheng 2022-05-17 19:00:02 +08:00
parent 0e76a90ee4
commit 7d3181f3fd

View File

@ -671,6 +671,10 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
return return
} }
if kline.Symbol != s.Symbol || kline.Interval != s.Interval {
return
}
// Update spreads // Update spreads
high := kline.GetHigh().Float64() high := kline.GetHigh().Float64()
open := kline.GetOpen().Float64() open := kline.GetOpen().Float64()
@ -704,10 +708,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
log.Infof("new ask spread: %v", s.AskSpread.Percentage()) log.Infof("new ask spread: %v", s.AskSpread.Percentage())
} }
if kline.Symbol != s.Symbol || kline.Interval != s.Interval {
return
}
if err := s.activeMakerOrders.GracefulCancel(ctx, s.session.Exchange); err != nil { if err := s.activeMakerOrders.GracefulCancel(ctx, s.session.Exchange); err != nil {
log.WithError(err).Errorf("graceful cancel order error") log.WithError(err).Errorf("graceful cancel order error")
} }