mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
retry: fix and improve QueryOrderUntilFilled status check
This commit is contained in:
parent
ac181959e5
commit
c68832459d
|
@ -2,7 +2,6 @@ package retry
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
|
@ -54,15 +53,17 @@ func QueryOrderUntilFilled(
|
|||
OrderID: strconv.FormatUint(orderId, 10),
|
||||
})
|
||||
|
||||
if err2 != nil || o == nil {
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
|
||||
if o.Status != types.OrderStatusFilled {
|
||||
return errors.New("order is not filled yet")
|
||||
// for final status return nil error to stop the retry
|
||||
switch o.Status {
|
||||
case types.OrderStatusFilled, types.OrderStatusCanceled:
|
||||
return nil
|
||||
}
|
||||
|
||||
return err2
|
||||
return fmt.Errorf("order is not filled yet: status=%s E/Q=%s/%s", o.Status, o.ExecutedQuantity.String(), o.Quantity.String())
|
||||
}
|
||||
|
||||
err = GeneralBackoff(ctx, op)
|
||||
|
|
Loading…
Reference in New Issue
Block a user