mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
Merge pull request #1539 from c9s/c9s/fix-and-improve-query-order-until-filled
FIX: add check for order pointer
This commit is contained in:
commit
945c442b92
|
@ -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