grid2: invert if

This commit is contained in:
c9s 2023-10-09 17:10:11 +08:00 committed by chiahung
parent 5f9d020ac8
commit a39925b912

View File

@ -74,8 +74,9 @@ func (s *Strategy) syncActiveOrders(ctx context.Context) error {
// update active orders not in open orders
for _, activeOrder := range activeOrders {
if _, exist := openOrdersMap[activeOrder.OrderID]; !exist {
if _, exist := openOrdersMap[activeOrder.OrderID]; exist {
delete(openOrdersMap, activeOrder.OrderID)
} else {
s.logger.Infof("found active order #%d is not in the open orders, updating...", activeOrder.OrderID)
updatedOrder, err := retry.QueryOrderUntilSuccessful(ctx, s.orderQueryService, types.OrderQuery{
@ -89,8 +90,6 @@ func (s *Strategy) syncActiveOrders(ctx context.Context) error {
}
activeOrderBook.Update(*updatedOrder)
} else {
delete(openOrdersMap, activeOrder.OrderID)
}
}