[add] 新增合约止盈订单类型
This commit is contained in:
parent
76a133a6b4
commit
021aa5542c
|
@ -93,6 +93,12 @@ func toLocalFuturesOrderType(orderType types.OrderType) (futures.OrderType, erro
|
|||
// case types.OrderTypeStopMarket:
|
||||
// return futures.OrderTypeStopLoss, nil //TODO
|
||||
|
||||
case types.OrderTypeStopMarket:
|
||||
return futures.OrderTypeStopMarket, nil //TODO
|
||||
|
||||
case types.OrderTypeTakeProfitMarket:
|
||||
return futures.OrderTypeTakeProfitMarket, nil
|
||||
|
||||
case types.OrderTypeMarket:
|
||||
return futures.OrderTypeMarket, nil
|
||||
}
|
||||
|
@ -211,7 +217,7 @@ func toGlobalFuturesOrderType(orderType futures.OrderType) types.OrderType {
|
|||
return types.OrderTypeStopLimit
|
||||
|
||||
case futures.OrderTypeTakeProfitMarket:
|
||||
return types.OrderTypeStopMarket
|
||||
return types.OrderTypeTakeProfitMarket
|
||||
|
||||
case futures.OrderTypeStopMarket:
|
||||
return types.OrderTypeStopMarket
|
||||
|
|
|
@ -139,7 +139,8 @@ func (e *Exchange) submitFuturesOrder(ctx context.Context, order types.SubmitOrd
|
|||
req := e.futuresClient.NewCreateOrderService().
|
||||
Symbol(order.Symbol).
|
||||
Type(orderType).
|
||||
Side(futures.SideType(order.Side))
|
||||
Side(futures.SideType(order.Side)).
|
||||
PositionSide(futures.PositionSideType(order.PositionSide))
|
||||
|
||||
if order.ReduceOnly {
|
||||
req.ReduceOnly(order.ReduceOnly)
|
||||
|
@ -178,7 +179,7 @@ func (e *Exchange) submitFuturesOrder(ctx context.Context, order types.SubmitOrd
|
|||
// set stop price
|
||||
switch order.Type {
|
||||
|
||||
case types.OrderTypeStopLimit, types.OrderTypeStopMarket:
|
||||
case types.OrderTypeStopLimit, types.OrderTypeStopMarket, types.OrderTypeTakeProfitMarket:
|
||||
if order.Market.Symbol != "" {
|
||||
req.StopPrice(order.Market.FormatPrice(order.StopPrice))
|
||||
} else {
|
||||
|
|
|
@ -84,6 +84,7 @@ const (
|
|||
OrderTypeMarket OrderType = "MARKET"
|
||||
OrderTypeStopLimit OrderType = "STOP_LIMIT"
|
||||
OrderTypeStopMarket OrderType = "STOP_MARKET"
|
||||
OrderTypeTakeProfitMarket OrderType = "TAKE_PROFIT_MARKET"
|
||||
)
|
||||
|
||||
/*
|
||||
|
@ -132,6 +133,7 @@ type SubmitOrder struct {
|
|||
|
||||
Symbol string `json:"symbol" db:"symbol"`
|
||||
Side SideType `json:"side" db:"side"`
|
||||
PositionSide PositionSideType `json:"positionSide" db:"positionSide"`
|
||||
Type OrderType `json:"orderType" db:"order_type"`
|
||||
|
||||
Quantity fixedpoint.Value `json:"quantity" db:"quantity"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user