grid2: add more logs

This commit is contained in:
c9s 2023-03-05 17:34:50 +08:00
parent 07f2de4300
commit 4927dd7f98
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1320,9 +1320,11 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
// for MAX exchange we need the order ID to query the closed order history
if s.GridProfitStats != nil && s.GridProfitStats.InitialOrderID > 0 {
lastOrderID = s.GridProfitStats.InitialOrderID
s.logger.Infof("found initial order id #%d from grid stats", lastOrderID)
} else {
if oid, ok := findEarliestOrderID(openOrders); ok {
lastOrderID = oid
s.logger.Infof("found earliest order id #%d from open orders", lastOrderID)
}
}
@ -1826,6 +1828,7 @@ func (s *Strategy) recoverGrid(ctx context.Context, session *bbgo.ExchangeSessio
// do recover only when openOrders > 0
if len(openOrders) == 0 {
s.logger.Warn("0 open orders, skip recovery process")
return nil
}
@ -1838,7 +1841,7 @@ func (s *Strategy) recoverGrid(ctx context.Context, session *bbgo.ExchangeSessio
}
if err := s.recoverGridWithOpenOrders(ctx, historyService, openOrders); err != nil {
return errors.Wrap(err, "recover grid error")
return errors.Wrap(err, "grid recover error")
}
return nil