[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 {
|
||||||
|
|
|
@ -79,11 +79,12 @@ func (t *MarginOrderSideEffectType) UnmarshalJSON(data []byte) error {
|
||||||
type OrderType string
|
type OrderType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
OrderTypeLimit OrderType = "LIMIT"
|
OrderTypeLimit OrderType = "LIMIT"
|
||||||
OrderTypeLimitMaker OrderType = "LIMIT_MAKER"
|
OrderTypeLimitMaker OrderType = "LIMIT_MAKER"
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -130,9 +131,10 @@ func (o OrderStatus) Closed() bool {
|
||||||
type SubmitOrder struct {
|
type SubmitOrder struct {
|
||||||
ClientOrderID string `json:"clientOrderID,omitempty" db:"client_order_id"`
|
ClientOrderID string `json:"clientOrderID,omitempty" db:"client_order_id"`
|
||||||
|
|
||||||
Symbol string `json:"symbol" db:"symbol"`
|
Symbol string `json:"symbol" db:"symbol"`
|
||||||
Side SideType `json:"side" db:"side"`
|
Side SideType `json:"side" db:"side"`
|
||||||
Type OrderType `json:"orderType" db:"order_type"`
|
PositionSide PositionSideType `json:"positionSide" db:"positionSide"`
|
||||||
|
Type OrderType `json:"orderType" db:"order_type"`
|
||||||
|
|
||||||
Quantity fixedpoint.Value `json:"quantity" db:"quantity"`
|
Quantity fixedpoint.Value `json:"quantity" db:"quantity"`
|
||||||
Price fixedpoint.Value `json:"price" db:"price"`
|
Price fixedpoint.Value `json:"price" db:"price"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user