grid2: emit grid ready earlier

This commit is contained in:
c9s 2023-02-16 18:13:51 +08:00
parent f039c97e63
commit eb4e25c008
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -884,6 +884,9 @@ func (s *Strategy) openGrid(ctx context.Context, session *bbgo.ExchangeSession)
s.debugGridOrders(submitOrders, lastPrice) s.debugGridOrders(submitOrders, lastPrice)
// try to always emit grid ready
defer s.EmitGridReady()
createdOrders, err2 := s.orderExecutor.SubmitOrders(ctx, submitOrders...) createdOrders, err2 := s.orderExecutor.SubmitOrders(ctx, submitOrders...)
if err2 != nil { if err2 != nil {
return err return err
@ -911,7 +914,6 @@ func (s *Strategy) openGrid(ctx context.Context, session *bbgo.ExchangeSession)
} }
s.logger.Infof("ALL GRID ORDERS SUBMITTED") s.logger.Infof("ALL GRID ORDERS SUBMITTED")
s.EmitGridReady()
s.updateOpenOrderPricesMetrics(createdOrders) s.updateOpenOrderPricesMetrics(createdOrders)
return nil return nil