mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
check order pointer
This commit is contained in:
parent
3cee573dbd
commit
75cb5dd09c
|
@ -2,6 +2,7 @@ package retry
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
|
@ -10,6 +11,8 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/types"
|
||||
)
|
||||
|
||||
var ErrOrderIsNil = errors.New("order object is nil")
|
||||
|
||||
type advancedOrderCancelService interface {
|
||||
CancelAllOrders(ctx context.Context) ([]types.Order, error)
|
||||
CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
|
||||
|
@ -57,6 +60,10 @@ func QueryOrderUntilFilled(
|
|||
return err2
|
||||
}
|
||||
|
||||
if o == nil {
|
||||
return ErrOrderIsNil
|
||||
}
|
||||
|
||||
// for final status return nil error to stop the retry
|
||||
switch o.Status {
|
||||
case types.OrderStatusFilled, types.OrderStatusCanceled:
|
||||
|
|
Loading…
Reference in New Issue
Block a user