[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:
|
// case types.OrderTypeStopMarket:
|
||||||
// return futures.OrderTypeStopLoss, nil //TODO
|
// return futures.OrderTypeStopLoss, nil //TODO
|
||||||
|
|
||||||
|
case types.OrderTypeStopMarket:
|
||||||
|
return futures.OrderTypeStopMarket, nil //TODO
|
||||||
|
|
||||||
|
case types.OrderTypeTakeProfitMarket:
|
||||||
|
return futures.OrderTypeTakeProfitMarket, nil
|
||||||
|
|
||||||
case types.OrderTypeMarket:
|
case types.OrderTypeMarket:
|
||||||
return futures.OrderTypeMarket, nil
|
return futures.OrderTypeMarket, nil
|
||||||
}
|
}
|
||||||
|
@ -211,7 +217,7 @@ func toGlobalFuturesOrderType(orderType futures.OrderType) types.OrderType {
|
||||||
return types.OrderTypeStopLimit
|
return types.OrderTypeStopLimit
|
||||||
|
|
||||||
case futures.OrderTypeTakeProfitMarket:
|
case futures.OrderTypeTakeProfitMarket:
|
||||||
return types.OrderTypeStopMarket
|
return types.OrderTypeTakeProfitMarket
|
||||||
|
|
||||||
case futures.OrderTypeStopMarket:
|
case futures.OrderTypeStopMarket:
|
||||||
return types.OrderTypeStopMarket
|
return types.OrderTypeStopMarket
|
||||||
|
|
|
@ -139,7 +139,8 @@ func (e *Exchange) submitFuturesOrder(ctx context.Context, order types.SubmitOrd
|
||||||
req := e.futuresClient.NewCreateOrderService().
|
req := e.futuresClient.NewCreateOrderService().
|
||||||
Symbol(order.Symbol).
|
Symbol(order.Symbol).
|
||||||
Type(orderType).
|
Type(orderType).
|
||||||
Side(futures.SideType(order.Side))
|
Side(futures.SideType(order.Side)).
|
||||||
|
PositionSide(futures.PositionSideType(order.PositionSide))
|
||||||
|
|
||||||
if order.ReduceOnly {
|
if order.ReduceOnly {
|
||||||
req.ReduceOnly(order.ReduceOnly)
|
req.ReduceOnly(order.ReduceOnly)
|
||||||
|
@ -178,7 +179,7 @@ func (e *Exchange) submitFuturesOrder(ctx context.Context, order types.SubmitOrd
|
||||||
// set stop price
|
// set stop price
|
||||||
switch order.Type {
|
switch order.Type {
|
||||||
|
|
||||||
case types.OrderTypeStopLimit, types.OrderTypeStopMarket:
|
case types.OrderTypeStopLimit, types.OrderTypeStopMarket, types.OrderTypeTakeProfitMarket:
|
||||||
if order.Market.Symbol != "" {
|
if order.Market.Symbol != "" {
|
||||||
req.StopPrice(order.Market.FormatPrice(order.StopPrice))
|
req.StopPrice(order.Market.FormatPrice(order.StopPrice))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -84,6 +84,7 @@ const (
|
||||||
OrderTypeMarket OrderType = "MARKET"
|
OrderTypeMarket OrderType = "MARKET"
|
||||||
OrderTypeStopLimit OrderType = "STOP_LIMIT"
|
OrderTypeStopLimit OrderType = "STOP_LIMIT"
|
||||||
OrderTypeStopMarket OrderType = "STOP_MARKET"
|
OrderTypeStopMarket OrderType = "STOP_MARKET"
|
||||||
|
OrderTypeTakeProfitMarket OrderType = "TAKE_PROFIT_MARKET"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -132,6 +133,7 @@ type SubmitOrder struct {
|
||||||
|
|
||||||
Symbol string `json:"symbol" db:"symbol"`
|
Symbol string `json:"symbol" db:"symbol"`
|
||||||
Side SideType `json:"side" db:"side"`
|
Side SideType `json:"side" db:"side"`
|
||||||
|
PositionSide PositionSideType `json:"positionSide" db:"positionSide"`
|
||||||
Type OrderType `json:"orderType" db:"order_type"`
|
Type OrderType `json:"orderType" db:"order_type"`
|
||||||
|
|
||||||
Quantity fixedpoint.Value `json:"quantity" db:"quantity"`
|
Quantity fixedpoint.Value `json:"quantity" db:"quantity"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user