private/advanced/create-order
REQUESTCreates a new BUY or SELL trigger order on the Exchange.wss://stream.crypto.com/exchange/v1/user
private/advanced/create-orderPrivate
type must be STOP_LOSS, STOP_LIMIT, TAKE_PROFIT or TAKE_PROFIT_LIMIT.
This call is asynchronous, so the response is simply a confirmation of the request.
The user.advanced.order subscription can be used to check if the orders are successfully created.
Helpful information:
- STOP_LIMIT and TAKE_PROFIT_LIMIT will execute a LIMIT order when the ref_price is reached.
- STOP_LOSS and TAKE_PROFIT will execute a MARKET order when the ref_price is reached.
To create trigger orders based on ref_price vs. the reference price (ref_price_type):
- ref_price below ref_price_type price: SELL STOP_LOSS and STOP_LIMIT, BUY TAKE_PROFIT and TAKE_PROFIT_LIMIT
- ref_price above ref_price_type price: BUY STOP_LOSS and STOP_LIMIT, SELL TAKE_PROFIT and TAKE_PROFIT_LIMIT
SpotAttach / DerivAttach:
- Contingency type resolution: Automatically resolved from instrument type - spot instruments → SPOT_ATTACH, derivative instruments → DERIV_ATTACH
- DerivAttach attach-to-order: Use
attach_order_idto attach TP/SL to an existing limit order - DerivAttach attach-to-position: Use
attach_isolation_idto attach TP/SL directly to an existing position (> 0 for isolated position ID, 0 for cross-margin position). Requires REDUCE_ONLY in exec_inst. - Standalone TP/SL: For derivatives, if neither
attach_order_idnorattach_isolation_idis specified, isolation is resolved fromisolation_idparameter (if provided) or defaults to cross-margin
Request
Body
required
- ➖ M: Cancel Maker
- ➖ T: Cancel Taker
- ➖ B: Cancel Both Maker and Taker
- ➖ M: Matches Master or Sub a/c
- ➖ S: Matches Sub a/c only
- ➖ D: reset all STP fields to default (stp_inst and stp_id in same request are ignored).
Request id (echoed in response)
Must be "private/advanced/create-order"
Current timestamp in milliseconds, e.g. "1771761038000".
params objectrequired
Instrument symbol, e.g. BTCUSD-PERP
Possible values: [BUY, SELL]
BUY or SELL
Order quantity. For MARKET BUY can use notional instead.
Client order ID (max 36 chars). Recommended for correlation.
Possible values: [GOOD_TILL_CANCEL, IMMEDIATE_OR_CANCEL, FILL_OR_KILL]
Time in force
Possible values: [POST_ONLY, REDUCE_ONLY, SMART_POST_ONLY, ISOLATED_MARGIN, MARGIN_ORDER]
Optional array of execution instructions. POST_ONLY and SMART_POST_ONLY mutually exclusive.
Fee instrument (e.g. CRO) for fee deduction
Self-trade prevention ID (0 to 32767)
Possible values: [M, T, B]
Self-trade prevention instruction. Used in private/change-account-settings (params) and private/get-account-settings (result). Mandatory if stp_scope is set.
Possible values: [M, S, D]
Self-trade prevention scope. Used in private/change-account-settings (params) and private/get-account-settings (result).
Possible values: [STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT]
Trigger order type
Limit price (required for STOP_LIMIT and TAKE_PROFIT_LIMIT)
Trigger price (required for all trigger order types)
Possible values: [MARK_PRICE, INDEX_PRICE, LAST_PRICE]
Reference price type for trigger orders
The order ID this trigger order is attached to. Used to attach TP/SL to an existing limit order (SpotAttach / DerivAttach attach-to-order).
Position this trigger order is attached to (DerivAttach attach-to-position, derivatives only). > 0: attach to the isolated position whose isolation_id equals the value. 0: attach to the cross-margin position. Requires REDUCE_ONLY in exec_inst. Mutually exclusive with attach_order_id and isolation_id.
Schema
Echoed request id
Method invoked
0 = success; non-zero indicates error (reason code).
result object
Newly created order ID.
Newly created client order ID.
Present when code !== 0.
Present when code !== 0.