Skip to main content

private/advanced/create-order

REQUEST 

wss://stream.crypto.com/exchange/v1/user

private/advanced/create-orderPrivate
Creates a new BUY or SELL trigger order on the Exchange.

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_id to attach TP/SL to an existing limit order
  • DerivAttach attach-to-position: Use attach_isolation_id to 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_id nor attach_isolation_id is specified, isolation is resolved from isolation_id parameter (if provided) or defaults to cross-margin

Request

Body

required
    id int64required

    Request id (echoed in response)

    method stringrequired

    Must be "private/advanced/create-order"

    nonce int64required

    Current timestamp in milliseconds, e.g. "1771761038000".

    params objectrequired
    Base order parameters shared by all create-order variants.
    instrument_name stringrequired

    Instrument symbol, e.g. BTCUSD-PERP

    side WsOrderSide (string)required

    Possible values: [BUY, SELL]

    BUY or SELL

    quantity decimalrequired

    Order quantity. For MARKET BUY can use notional instead.

    client_oid string

    Client order ID (max 36 chars). Recommended for correlation.

    time_in_force WsTimeInForce (string)

    Possible values: [GOOD_TILL_CANCEL, IMMEDIATE_OR_CANCEL, FILL_OR_KILL]

    Time in force

    exec_inst WsExecInstCreateOrder (string)[]

    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_name string

    Fee instrument (e.g. CRO) for fee deduction

    stp_id string

    Self-trade prevention ID (0 to 32767)

    stp_inst WsStpInst (string)

    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.

    • ➖ M: Cancel Maker
    • ➖ T: Cancel Taker
    • ➖ B: Cancel Both Maker and Taker
    stp_scope WsStpScope (string)

    Possible values: [M, S, D]

    Self-trade prevention scope. Used in private/change-account-settings (params) and private/get-account-settings (result).

    • ➖ 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).
    type stringrequired

    Possible values: [STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT]

    Trigger order type

    price decimal

    Limit price (required for STOP_LIMIT and TAKE_PROFIT_LIMIT)

    ref_price decimal

    Trigger price (required for all trigger order types)

    ref_price_type WsRefPriceType (string)

    Possible values: [MARK_PRICE, INDEX_PRICE, LAST_PRICE]

    Reference price type for trigger orders

    attach_order_id int64

    The order ID this trigger order is attached to. Used to attach TP/SL to an existing limit order (SpotAttach / DerivAttach attach-to-order).

    attach_isolation_id string

    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.

WebSocket response
Schema
    id int64

    Echoed request id

    method string

    Method invoked

    code int32

    0 = success; non-zero indicates error (reason code).

    result object
    Present when code === 0. Contains order_id and client_oid.
    order_id int64

    Newly created order ID.

    client_oid string

    Newly created client order ID.

    message string

    Present when code !== 0.

    original string

    Present when code !== 0.