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