Skip to main content
Create collateral OCO order

Authorizations

X-TXC-APIKEY
string
header
required

The public WhiteBIT API key.

X-TXC-PAYLOAD
string
header
required

Base64-encoded JSON request body.

X-TXC-SIGNATURE
string
header
required

HMAC-SHA512 signature of the payload, hex-encoded. Computed as hex(HMAC-SHA512(payload, api_secret)).

Body

application/json
market
string
required

Available margin market. Example: BTC_USDT

Example:

"BTC_USDT"

side
enum<string>
required

Order direction. Use buy to open or increase a long position and sell to open or increase a short position.

Available options:
buy,
sell
Example:

"buy"

amount
string
required

Amount of stock currency for both legs of the OCO order. Minimum and step values are market-dependent — query the market info endpoint for constraints.

Example:

"0.001"

price
string
required

Limit order price in money currency for the take-profit leg.

Example:

"40000"

activation_price
string
required

Trigger price in money currency for the stop-loss leg. The stop-limit order activates when the market price reaches the specified value.

Example:

"41000"

stop_limit_price
string
required

Execution price in money currency for the stop-loss leg. After activation, the stop-loss leg places a limit order at the specified price.

Example:

"42000"

request
string
required
Example:

"{{request}}"

nonce
integer
required
Example:

1594297865000

clientOrderId
string

Custom client order identifier. Uniqueness is enforced only among the account's open (pending) orders on the same market — once a previous order is filled or canceled, the same identifier can be reused, including on the same market. Contains only letters, numbers, dashes, dots, or underscores.

Example:

"order1987111"

reduceOnly
boolean
default:false

When true, both legs of the OCO order can only reduce or close an existing position — neither leg can increase the position or open a new one. If the order amount exceeds the current position size, the system reduces the order to match — the response returns the adjusted amount. The API returns error code 116 if no open position exists or the order side matches the position direction. See reduce-only.

Example:

false

positionSide
enum<string>

Position direction. Optional at the request layer but functionally required when hedge mode is enabled. See positionSide. Both legs of the OCO inherit the value.

  • One-way mode (default account mode): the field is ignored. Orders always use BOTH, and the response returns positionSide: "BOTH" on each leg whether the field is sent or omitted.
  • Hedge mode: the field MUST be LONG or SHORT. Sending BOTH, omitting the field, or sending a value that does not match the account's mode causes the trade service to reject the order with error code 114 (Hedge mode position side does not match).
Available options:
LONG,
SHORT,
BOTH
Example:

"LONG"

stp
enum<string>
default:no

Self-trade prevention mode. The value applies to both legs of the OCO order. Allowed values: no (self-trades allowed), cb (cancel both the new and the existing order), cn (cancel the new order, keep the existing), co (cancel the existing order, place the new one). Default: no.

Legacy values cancel_both, cancel_new, cancel_old are deprecated: the API accepts the legacy values with identical behavior until a deprecation deadline is announced, then rejects the legacy values. Responses always return the abbreviated form, regardless of which variant the request used.

See Self-Trade Prevention.

Available options:
no,
cb,
cn,
co
Example:

"no"

Response

Successful response - OCO order created

id
integer

OCO order identifier

Example:

117703764513

reduceOnly
boolean

Reduce-only flag

Example:

false

stop_loss
object

Stop loss order details

take_profit
object

Take profit order details