grid2: emit grid ready once the grid is recovered

This commit is contained in:
c9s 2023-02-16 21:33:42 +08:00
parent eb4e25c008
commit 2aee3cea59
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1151,6 +1151,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
if numMissing := len(missingPrices); numMissing <= 1 {
s.logger.Infof("GRID RECOVER: no missing grid prices, stop re-playing order history")
s.setGrid(grid)
s.EmitGridReady()
return nil
} else {
s.logger.Infof("GRID RECOVER: found missing prices: %v", missingPrices)
@ -1193,6 +1194,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
if isCompleteGridOrderBook(orderBook, s.GridNum) {
s.logger.Infof("GRID RECOVER: all orders are active orders, do not need recover")
s.setGrid(grid)
s.EmitGridReady()
return nil
}
@ -1209,6 +1211,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
s.logger.Infof("GRID RECOVER: found %d filled grid orders", len(filledOrders))
s.setGrid(grid)
s.EmitGridReady()
for _, o := range filledOrders {
s.processFilledOrder(o)