Place TP/SL Order by Position
HTTP Request
- POST
/api/v1/private/stoporder/place
Required Permission: Order Placing
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| lossTrend | int | true | Stop-loss type: 1 latest price 2 fair price 3 index price |
| profitTrend | int | true | Take-profit type: 1 latest price 2 fair price 3 index price |
| positionId | long | true | Position id |
| vol | decimal | true | Order quantity; must be within the allowed range for the contract; the order quantity plus existing TP/SL order quantity must be less than the closable quantity; position quantity will not be frozen, but checks are required |
| stopLossPrice | decimal | false | Stop-loss price; at least one of stop-loss or take-profit must be non-empty and greater than 0 |
| takeProfitPrice | decimal | false | Take-profit price; at least one of stop-loss or take-profit must be non-empty and greater than 0 |
| priceProtect | int | false | Conditional order trigger protection: "1","0", default "0" disabled. Required only for plan orders/TP-SL orders |
| profitLossVolType | string | false | TP/SL quantity type (SAME: same quantity; SEPARATE: different quantities) |
| takeProfitVol | decimal | false | Take-profit quantity (when profitLossVolType == SEPARATE) |
| stopLossVol | decimal | false | Stop-loss quantity (when profitLossVolType == SEPARATE) |
| volType | int | false | Quantity type 1: partial TP/SL 2: position TP/SL |
| takeProfitReverse | int | false | Take-profit reverse: 1 yes 2 no |
| stopLossReverse | int | false | Stop-loss reverse: 1 yes 2 no |
| takeProfitType | int | false | Take-profit type 0 - market TP 1 - limit TP |
| takeProfitOrderPrice | decimal | true | Limit TP order price |
| stopLossType | long | true | Stop-loss type 0 - market SL 1 - limit SL |
| stopLossOrderPrice | decimal | true | Limit SL order price |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| id | int | Order id |
| symbol | string | Contract |
| leverage | decimal | Leverage |
| side | int | Order side, 1: open long, 2: close short, 3: open short, 4: close long |
| triggerPrice | decimal | Trigger price |
| price | decimal | Execution price |
| vol | decimal | Order quantity |
| openType | int | Open type,1: isolated,2: cross |
| triggerType | int | Trigger type,1: greater than or equal,2: less than or equal |
| state | int | Status |
| executeCycle | int | Execution cycle, unit: hours |
| trend | int | Trigger price type,1: latest price,2: fair price,3: index price |
| orderType | int | Order type,1: Limit,2: Post Only (maker only),3: Immediate-Or-Cancel,4: Fill-Or-Kill,5: Market |
| orderId | long | Order id, returned when execution succeeds |
| errorCode | int | Error code when execution fails, 0: normal |
| createTime | long | Created time |
| updateTime | long | Updated time |
Response
{
"success": false,
"code": 0,
"message": "",
"data": [
{
"id": 0,
"symbol": "",
"leverage": 0,
"side": 0,
"triggerPrice": 0.0,
"price": 0.0,
"vol": 0.0,
"openType": 0,
"triggerType": 0,
"state": 0,
"executeCycle": 0,
"trend": 0,
"orderType": 0,
"orderId": 0,
"errorCode": 0,
"createTime": "",
"updateTime": ""
}
]
}