private/advanced/create-oto
POSTCreates a One-triggers-the-Other (OTO) execution strategy on the Exchange./private/advanced/create-oto
OTO execution strategy allows users to place a two-order strategy where one order automatically triggers the other when the first order is fully executed. Users are able to place a limit or market order with a trigger order, and only when the primary order is fully executed, the trigger order will take effect. The trigger order can either be a stop loss or take profit order.
SpotAttach / DerivAttach: This API creates SpotAttach (for spot instruments) or DerivAttach (for derivative instruments) order types. The contingency type is automatically resolved from the instrument type. With 2 legs (1 limit/market + 1 trigger), it follows OTO behavior.
- SpotAttach: Flexible - you can later attach additional TP/SL using
private/advanced/create-orderwithattach_order_id, effectively converting it to OTOCO behavior. You can also cancel individual legs usingprivate/advanced/cancel-orderand reattach new ones. - DerivAttach: For derivatives, the primary leg may specify
isolation_id,leverage,isolated_margin_amount, andexec_instmay include ISOLATED_MARGIN. Trigger legs inherit the isolation mode from the parent leg.
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.
For the content of each order in order_list, please refer to private/create-order for details. One order must be LIMIT or MARKET, and the other must be STOP_LOSS, STOP_LIMIT, TAKE_PROFIT_LIMIT or TAKE_PROFIT. The ref_price_type for the trigger order supports MARK_PRICE (default), INDEX_PRICE, and LAST_PRICE.
Request
Body
required
- Array [
- ➖ 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).
- ➖ LIMIT, MARKET
- ➖ STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT: Trigger orders
- ]
Request id (echoed in response)
Must be "private/advanced/create-oto"
Your API key (only required for private REST)
HMAC-SHA256 signature in hex (only required for private REST)
Current timestamp in milliseconds, e.g. "1771761038000".
params objectrequired
order_list object[]required
>= 2, <= 2 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: [LIMIT, MARKET, STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT]
Order type:
Limit price (required for LIMIT, STOP_LIMIT, TAKE_PROFIT_LIMIT)
Amount to spend; for MARKET/STOP_LOSS/TAKE_PROFIT BUY only
Trigger price for STOP_LOSS, STOP_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT
Possible values: [MARK_PRICE, INDEX_PRICE, LAST_PRICE]
Reference price type for trigger orders
Possible values: [SPOT, MARGIN]
SPOT or MARGIN (spot/margin mode).
Isolated margin amount
Isolation ID for isolated margin
Leverage for margin/derivatives
Order ID to attach this trigger order to. Used for SpotAttach / DerivAttach.
Schema
Echoed request id
Method invoked
0 = success; non-zero indicates error (reason code).
result object
List ID.
Present when code !== 0.
Present when code !== 0.