Skip to content

Commit

Permalink
🔧 test(coinbase): Add wait loop for order status to ensure it is open
Browse files Browse the repository at this point in the history
  • Loading branch information
dboyliao committed Feb 26, 2025
1 parent 9432a58 commit d0a7249
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/exchange/coinbase/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ func Test_OrdersAPI(t *testing.T) {
order, err = ex.QueryOrder(ctx, types.OrderQuery{Symbol: "ETHUSD", OrderID: order.UUID, ClientOrderID: order.UUID})
assert.NoError(t, err)

// the status might be pending at the beginning. Wait until it is open
for {
if order.OriginalStatus == "open" {
break
}
order, err = ex.QueryOrder(ctx, types.OrderQuery{Symbol: "ETHUSD", OrderID: order.UUID, ClientOrderID: order.UUID})
assert.NoError(t, err)
}

orders, err := ex.QueryOpenOrders(ctx, "ETHUSD")
assert.NoError(t, err)
found := false
Expand Down

0 comments on commit d0a7249

Please sign in to comment.