Skip to content

Commit

Permalink
retry: improve QueryOrderTradesUntilSuccessfulLite retry function
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jan 24, 2025
1 parent 547c1d9 commit 32cb0b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/exchange/retry/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,20 @@ func QueryOrderTradesUntilSuccessfulLite(
) (trades []types.Trade, err error) {
var op = func() (err2 error) {
trades, err2 = ex.QueryOrderTrades(ctx, q)
if err2 != nil {
return err2
}

if len(trades) == 0 {
return fmt.Errorf("empty trades of order #%d on exchange %T", q.OrderID, ex)

Check failure on line 193 in pkg/exchange/retry/order.go

View workflow job for this annotation

GitHub Actions / build (6.2, 1.21)

fmt.Errorf format %d has arg q.OrderID of wrong type string
}

for _, trade := range trades {
if trade.FeeProcessing {
return fmt.Errorf("there are some trades which trading fee is not ready")
}
}

return err2
}

Expand Down

0 comments on commit 32cb0b5

Please sign in to comment.