v1

latestOpenAPI 3.0.32026-07-2613529376.3 KB
Collateral Trading

Collateral Limit Order

The endpoint creates a limit order using collateral balance. The order executes at the specified price or better. Use buy to open or increase a long position and sell to open or increase a short position. To close a position, place an opposite-side order matching the position amount.

Order validation rules (per-market, from GET /api/v4/public/markets):

  • amount must have at most stockPrec decimal places
  • price must have at most moneyPrec decimal places
  • amount must be ≥ minAmount
  • amount × price must be ≥ minTotal
  • amount × price must be ≤ maxTotal (when maxTotal is not "0")
<Warning> Rate limit: 10000 requests/10 sec. </Warning> <Note> For open long position use **buy**, for short **sell**. To close current position, place opposite order with current position amount. </Note> <Note> - RPI orders are post-only by design and cannot be used with the IOC flag. The API returns error code `40` when both `rpi=true` and `ioc=true` are used. </Note> <Accordion title="Error Codes"> - `30` - default validation error code. Also returned when `reduceOnly=true` is combined with `stopLoss` or `takeProfit` - `31` - market validation failed - `32` - amount validation failed - `33` - price validation failed - `36` - clientOrderId validation failed - `37` - `ioc=true` cannot be combined with `postOnly=true` - `40` - `ioc=true` cannot be combined with `rpi=true` - `43` - `rpi=true` is not allowed for the account - `10` - insufficient balance to place the order - `111` - resulting position would exceed the market maximum - `112` - pending orders value would exceed the allowed maximum - `113` - position side cannot be changed while open positions or orders exist - `114` - hedge mode position side does not match (sent `BOTH` or omitted `positionSide` in hedge mode, or sent `LONG`/`SHORT` in one-way mode) - `115` - order would open a position in the opposite direction (one-way mode) - `116` - reduce-only validation failed (no position exists or order side matches position direction) </Accordion>
post/api/v4/order/collateral/limit

Request body

marketstring required

Available margin market. Example: BTC_USDT

side'buy' | 'sell' required

Order type. Variables: 'buy' / 'sell'. For open long position use buy, for short sell.

amountstring required

Amount of stock currency to buy or sell. Minimum and step values are market-dependent — query the market info endpoint for constraints.

pricestring required

Limit order price in money currency. Minimum price step is market-dependent — query the market info endpoint for constraints.

clientOrderIdstring

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.

stopLossstring

Stop loss price.

When provided, the system creates an OTO order with a stop loss condition.

takeProfitstring

Take profit price.

When provided, the system creates an OTO order with a take profit condition.

postOnlyboolean

When true, guarantees the order executes as a maker order. The system rejects the order if it would immediately match as taker. Default: false.

iocboolean

When true, the order executes all or part immediately and cancels any unfilled portion. Cannot be combined with postOnly=true or rpi=true.

rpiboolean

Enables Retail Price Improvement (RPI) mode.

RPI orders are post-only by design and cannot be used with ioc=true. The API returns error code 40 when both rpi=true and ioc=true are used.

positionSide'LONG' | 'SHORT' | 'BOTH'

Position direction. Optional at the request layer but functionally required when hedge mode is enabled. See positionSide.

  • One-way mode (default account mode): the field is ignored. Orders always use BOTH, and the response returns positionSide: "BOTH" 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).
reduceOnlyboolean

When true, the order can only reduce or close an existing position — the order cannot 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. Cannot be combined with stopLoss or takeProfit. The API returns error code 116 if no open position exists or the order side matches the position direction. See reduce-only.

stp'no' | 'cb' | 'cn' | 'co'

Self-trade prevention mode. 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.

requeststring required
nonceinteger required

Example request

{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.01",
  "price": "40000",
  "clientOrderId": "order1987111",
  "stopLoss": "50000",
  "takeProfit": "30000",
  "rpi": true,
  "positionSide": "LONG",
  "stp": "no",
  "request": "{{request}}",
  "nonce": 1594297865000
}

Response

Successful response - order created

orderIdinteger

Unique order identifier

clientOrderIdstring

Custom client order identifier. Empty string if not specified

marketstring

Market name

side'buy' | 'sell'

Order side

typestring

Order type

timestampnumber

Unix timestamp in seconds (UTC) of order creation, with microsecond precision.

dealMoneystring

Amount in money currency that is finished

dealStockstring

Amount in stock currency that is finished

amountstring

Order amount

leftstring

Remaining amount that must be finished

dealFeestring

Fee in money that is paid when order is finished

pricestring

Order price

postOnlyboolean

Post-only flag

iocboolean

Immediate or cancel flag

status'NEW' | 'FILLED' | 'PARTIALLY_FILLED' | 'CANCELLED'

Order status. NEW — accepted, not yet matched. FILLED — fully executed. PARTIALLY_FILLED — partially executed, remainder still active. CANCELLED — canceled before full execution.

stpstring

Self-trade prevention mode. Possible values: no, cb, cn, co. Always returned in abbreviated form, even when the request used a legacy value.

positionSide'LONG' | 'SHORT' | 'BOTH'

Position side

rpiboolean

Retail Price Improvement flag

reduceOnlyboolean

Reduce-only flag

Example response

{
  "orderId": 4180284841,
  "clientOrderId": "order1987111",
  "market": "BTC_USDT",
  "side": "buy",
  "type": "limit",
  "timestamp": 1595792396.165973,
  "dealMoney": "0",
  "dealStock": "0",
  "amount": "0.01",
  "left": "0.001",
  "dealFee": "0",
  "price": "40000",
  "status": "FILLED",
  "stp": "no",
  "oto": {
    "otoId": 29457221,
    "stopLoss": "30000",
    "takeProfit": "50000"
  },
  "positionSide": "LONG",
  "rpi": true
}