Skip to main content

New CM Conditional Order(TRADE)

API Description#

New CM Conditional Order

HTTP Request#

POST /papi/v1/cm/conditional/order

Request Weight#

1

Request Parameters#

NameTypeMandatoryDescription
symbolSTRINGYES
sideENUMYES
positionSideENUMNODefault BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode.
strategyTypeENUMYES"STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET", and "TRAILING_STOP_MARKET"
timeInForceENUMNO
quantityDECIMALNO
reduceOnlySTRINGNO"true" or "false". default "false". Cannot be sent in Hedge Mode
priceDECIMALNO
workingTypeENUMNOstopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE"
priceProtectSTRINGNO"TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders
newClientStrategyIdSTRINGNOA unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$
stopPriceDECIMALNOUsed with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
activationPriceDECIMALNOUsed with TRAILING_STOP_MARKET orders, default as the mark price
callbackRateDECIMALNOUsed with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1%
recvWindowLONGNO
timestampLONGYES

Additional mandatory parameters based on type:

TypeAdditional mandatory parameters
STOP/TAKE_PROFITquantity, price, stopPrice
STOP_MARKET/TAKE_PROFIT_MARKETstopPrice
TRAILING_STOP_MARKETcallbackRate
  • Order with type STOP/TAKE_PROFIT, parameter timeInForce can be sent ( default GTC).

  • Condition orders will be triggered when:

    • STOP, STOP_MARKET:
      • BUY: "MARK_PRICE" >= stopPrice
      • SELL: "MARK_PRICE" <= stopPrice
    • TAKE_PROFIT, TAKE_PROFIT_MARKET:
      • BUY: "MARK_PRICE" <= stopPrice
      • SELL: "MARK_PRICE" >= stopPrice
    • TRAILING_STOP_MARKET:
      • BUY: the lowest mark price after order placed <= activationPrice, and the latest mark price >= the lowest mark price * (1 + callbackRate)
      • SELL: the highest mark price after order placed >= activationPrice, and the latest mark price <= the highest mark price * (1 - callbackRate)
  • For TRAILING_STOP_MARKET, if you got such error code. {"code": -2021, "msg": "Order would immediately trigger."} means that the parameters you send do not meet the following requirements:

    • BUY: activationPrice should be smaller than latest mark price.
    • SELL: activationPrice should be larger than latest mark price.
  • Condition orders will be triggered when:

    • If parameterpriceProtectis sent as true:
      • when price reaches the stopPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol
      • "triggerProtect" of a symbol can be got from GET /fapi/v1/exchangeInfo
    • STOP, STOP_MARKET:
      • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice
      • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice
    • TAKE_PROFIT, TAKE_PROFIT_MARKET:
      • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice
      • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice

Response Example#

{    "newClientStrategyId": "testOrder",    "strategyId":123445,    "strategyStatus":"NEW",    "strategyType": "TRAILING_STOP_MARKET",     "origQty": "10",    "price": "0",    "reduceOnly": false,    "side": "BUY",    "positionSide": "SHORT",    "stopPrice": "9300",        // please ignore when order type is TRAILING_STOP_MARKET    "symbol": "BTCUSD_200925",    "pair": "BTCUSD",    "timeInForce": "GTC",    "activatePrice": "9020",    // activation price, only return with TRAILING_STOP_MARKET order    "priceRate": "0.3",         // callback rate, only return with TRAILING_STOP_MARKET order    "bookTime": 1566818724710,  // order place time    "updateTime": 1566818724722    "workingType":"CONTRACT_PRICE",    "priceProtect": false   }