Skip to main content

Place TP/SL Order by Position

HTTP Request

  • POST /api/v1/private/stoporder/place

Required Permission: Order Placing

Request Parameters

ParameterTypeRequiredDescription
lossTrendinttrueStop-loss type: 1 latest price 2 fair price 3 index price
profitTrendinttrueTake-profit type: 1 latest price 2 fair price 3 index price
positionIdlongtruePosition id
voldecimaltrueOrder 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
stopLossPricedecimalfalseStop-loss price; at least one of stop-loss or take-profit must be non-empty and greater than 0
takeProfitPricedecimalfalseTake-profit price; at least one of stop-loss or take-profit must be non-empty and greater than 0
priceProtectintfalseConditional order trigger protection: "1","0", default "0" disabled. Required only for plan orders/TP-SL orders
profitLossVolTypestringfalseTP/SL quantity type (SAME: same quantity; SEPARATE: different quantities)
takeProfitVoldecimalfalseTake-profit quantity (when profitLossVolType == SEPARATE)
stopLossVoldecimalfalseStop-loss quantity (when profitLossVolType == SEPARATE)
volTypeintfalseQuantity type 1: partial TP/SL 2: position TP/SL
takeProfitReverseintfalseTake-profit reverse: 1 yes 2 no
stopLossReverseintfalseStop-loss reverse: 1 yes 2 no
takeProfitTypeintfalseTake-profit type 0 - market TP 1 - limit TP
takeProfitOrderPricedecimaltrueLimit TP order price
stopLossTypelongtrueStop-loss type 0 - market SL 1 - limit SL
stopLossOrderPricedecimaltrueLimit SL order price

Response Parameters

ParameterTypeDescription
idintOrder id
symbolstringContract
leveragedecimalLeverage
sideintOrder side, 1: open long, 2: close short, 3: open short, 4: close long
triggerPricedecimalTrigger price
pricedecimalExecution price
voldecimalOrder quantity
openTypeintOpen type,1: isolated,2: cross
triggerTypeintTrigger type,1: greater than or equal,2: less than or equal
stateintStatus
executeCycleintExecution cycle, unit: hours
trendintTrigger price type,1: latest price,2: fair price,3: index price
orderTypeintOrder type,1: Limit,2: Post Only (maker only),3: Immediate-Or-Cancel,4: Fill-Or-Kill,5: Market
orderIdlongOrder id, returned when execution succeeds
errorCodeintError code when execution fails, 0: normal
createTimelongCreated time
updateTimelongUpdated 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": ""
}
]
}