grid2: fix recover sorting

This commit is contained in:
c9s 2023-02-22 00:50:00 +08:00
parent 03dfb4386e
commit bc98fe3bcc
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1238,9 +1238,9 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
// for reverse order recovering, we need the orders to be sort by update time ascending-ly
types.SortOrdersUpdateTimeAscending(tmpOrders)
if len(tmpOrders) > 1 && len(tmpOrders) == int(s.GridNum)+1 {
if len(tmpOrders) > 1 && len(tmpOrders) == int(s.GridNum) {
// remove the latest updated order because it's near the empty slot
tmpOrders = tmpOrders[:len(tmpOrders)-1]
tmpOrders = tmpOrders[1:]
}
// we will only submit reverse orders for filled orders