grid2: fix length check

This commit is contained in:
c9s 2023-03-05 23:20:17 +08:00
parent dfba758e88
commit 773b055711
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1405,7 +1405,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
filledOrders := types.OrdersFilled(tmpOrders) filledOrders := types.OrdersFilled(tmpOrders)
// if the number of FILLED orders and NEW orders equals to GridNum, then we need to remove an extra filled order for the replay events // if the number of FILLED orders and NEW orders equals to GridNum, then we need to remove an extra filled order for the replay events
if len(tmpOrders) == int(s.GridNum) && len(filledOrders) > 1 { if len(tmpOrders) == int(s.GridNum) && len(filledOrders) > 0 {
// remove the latest updated order because it's near the empty slot // remove the latest updated order because it's near the empty slot
filledOrders = filledOrders[1:] filledOrders = filledOrders[1:]
} }