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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
@ -54,15 +53,17 @@ func QueryOrderUntilFilled(
|
||||||
OrderID: strconv.FormatUint(orderId, 10),
|
OrderID: strconv.FormatUint(orderId, 10),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err2 != nil || o == nil {
|
if err2 != nil {
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.Status != types.OrderStatusFilled {
|
// for final status return nil error to stop the retry
|
||||||
return errors.New("order is not filled yet")
|
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)
|
err = GeneralBackoff(ctx, op)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user