mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
@ -10,6 +11,8 @@ import (
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var ErrOrderIsNil = errors.New("order object is nil")
|
||||||
|
|
||||||
type advancedOrderCancelService interface {
|
type advancedOrderCancelService interface {
|
||||||
CancelAllOrders(ctx context.Context) ([]types.Order, error)
|
CancelAllOrders(ctx context.Context) ([]types.Order, error)
|
||||||
CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
|
CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
|
||||||
|
@ -57,6 +60,10 @@ func QueryOrderUntilFilled(
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o == nil {
|
||||||
|
return ErrOrderIsNil
|
||||||
|
}
|
||||||
|
|
||||||
// for final status return nil error to stop the retry
|
// for final status return nil error to stop the retry
|
||||||
switch o.Status {
|
switch o.Status {
|
||||||
case types.OrderStatusFilled, types.OrderStatusCanceled:
|
case types.OrderStatusFilled, types.OrderStatusCanceled:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user