diff --git a/go.mod b/go.mod index d25bcbcb4..0642f0552 100644 --- a/go.mod +++ b/go.mod @@ -141,7 +141,6 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tebeka/strftime v0.1.3 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect diff --git a/pkg/bbgo/activeorderbook.go b/pkg/bbgo/activeorderbook.go index aee0e0c36..066cdbc8c 100644 --- a/pkg/bbgo/activeorderbook.go +++ b/pkg/bbgo/activeorderbook.go @@ -372,7 +372,7 @@ func (b *ActiveOrderBook) Update(order types.Order) { b.C.Emit() - case types.OrderStatusCanceled, types.OrderStatusRejected: + case types.OrderStatusCanceled, types.OrderStatusRejected, types.OrderStatusExpired: // TODO: note that orders transit to "canceled" may have partially filled log.Debugf("[ActiveOrderBook] order is %s, removing order %s", order.Status, order) b.orders.Remove(order.OrderID) diff --git a/pkg/exchange/binance/convert_futures.go b/pkg/exchange/binance/convert_futures.go index 03c164f0b..2a3b38057 100644 --- a/pkg/exchange/binance/convert_futures.go +++ b/pkg/exchange/binance/convert_futures.go @@ -87,11 +87,11 @@ func toLocalFuturesOrderType(orderType types.OrderType) (futures.OrderType, erro case types.OrderTypeLimit, types.OrderTypeLimitMaker: return futures.OrderTypeLimit, nil - // case types.OrderTypeStopLimit: - // return futures.OrderTypeStopLossLimit, nil //TODO + case types.OrderTypeStopLimit: + return futures.OrderTypeStop, nil - // case types.OrderTypeStopMarket: - // return futures.OrderTypeStopLoss, nil //TODO + case types.OrderTypeStopMarket: + return futures.OrderTypeStopMarket, nil case types.OrderTypeMarket: return futures.OrderTypeMarket, nil @@ -224,6 +224,9 @@ func toGlobalFuturesOrderType(orderType futures.OrderType) types.OrderType { case futures.OrderTypeLimit: return types.OrderTypeLimit + case futures.OrderTypeStop: + return types.OrderTypeStopLimit + case futures.OrderTypeMarket: return types.OrderTypeMarket diff --git a/pkg/types/order.go b/pkg/types/order.go index 1cc722e47..183968819 100644 --- a/pkg/types/order.go +++ b/pkg/types/order.go @@ -120,12 +120,16 @@ const ( // OrderStatusRejected means the order is not placed successfully, it's rejected by the api OrderStatusRejected OrderStatus = "REJECTED" + + // OrderStatusExpired means the order is expired, it's an end state. + OrderStatusExpired OrderStatus = "EXPIRED" ) func (o OrderStatus) Closed() bool { return o == OrderStatusFilled || o == OrderStatusCanceled || - o == OrderStatusRejected + o == OrderStatusRejected || + o == OrderStatusExpired } type SubmitOrder struct {