grid2: emit grid ready only when there is no error

This commit is contained in:
c9s 2023-02-16 22:49:22 +08:00
parent 55476e4176
commit 56628aca73
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -891,14 +891,14 @@ func (s *Strategy) openGrid(ctx context.Context, session *bbgo.ExchangeSession)
s.debugGridOrders(submitOrders, lastPrice)
// try to always emit grid ready
defer s.EmitGridReady()
createdOrders, err2 := s.orderExecutor.SubmitOrders(ctx, submitOrders...)
if err2 != nil {
return err
}
// try to always emit grid ready
defer s.EmitGridReady()
// update the number of orders to metrics
baseLabels := s.newPrometheusLabels()
metricsGridNumOfOrders.With(baseLabels).Set(float64(len(createdOrders)))