New Order(TRADE)
#
API DescriptionSend in a new order.
#
Methodorder.place
#
Request#
Request Weight0
#
Request ParametersName | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
side | ENUM | YES | |
positionSide | ENUM | NO | Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode. |
type | ENUM | YES | |
timeInForce | ENUM | NO | |
quantity | DECIMAL | NO | Cannot be sent with closePosition =true (Close-All) |
reduceOnly | STRING | NO | "true" or "false". default "false". Cannot be sent in Hedge Mode; cannot be sent with closePosition =true |
price | DECIMAL | NO | |
newClientOrderId | STRING | NO | A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: ^[\.A-Z\:/a-z0-9_-]{1,36}$ |
stopPrice | DECIMAL | NO | Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. |
closePosition | STRING | NO | true , false ;Close-All,used with STOP_MARKET or TAKE_PROFIT_MARKET . |
activationPrice | DECIMAL | NO | Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType ) |
callbackRate | DECIMAL | NO | Used with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1% |
workingType | ENUM | NO | stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE" |
priceProtect | STRING | NO | "TRUE" or "FALSE", default "FALSE". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders. |
newOrderRespType | ENUM | NO | "ACK", "RESULT", default "ACK" |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Additional mandatory parameters based on type
:
Type | Additional mandatory parameters |
---|---|
LIMIT | timeInForce , quantity , price |
MARKET | quantity |
STOP/TAKE_PROFIT | quantity , price , stopPrice |
STOP_MARKET/TAKE_PROFIT_MARKET | stopPrice |
TRAILING_STOP_MARKET | callbackRate |
Order with type
STOP
, parametertimeInForce
can be sent ( defaultGTC
).Order with type
TAKE_PROFIT
, parametertimeInForce
can be sent ( defaultGTC
).Condition orders will be triggered when:
- If parameter
priceProtect
is 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
TRAILING_STOP_MARKET
:
- BUY: the lowest price after order placed
<=
activationPrice, and the latest price >
= the lowest price * (1 +callbackRate
)- SELL: the highest price after order placed >=
activationPrice
, and the latest price <= the highest 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 price.- SELL:
activationPrice
should be larger than latest price.If
newOrderRespType
is sent asRESULT
:
MARKET
order: the final FILLED result of the order will be return directly.LIMIT
order with specialtimeInForce
: the final status result of the order(FILLED or EXPIRED) will be returned directly.
STOP_MARKET
,TAKE_PROFIT_MARKET
withclosePosition
=true
:
- Follow the same rules for condition orders.
- If triggered,close all current long position( if
SELL
) or current short position( ifBUY
).- Cannot be used with
quantity
paremeter- Cannot be used with
reduceOnly
parameter- In Hedge Mode,cannot be used with
BUY
orders inLONG
position side. and cannot be used withSELL
orders inSHORT
position side