Trading
Check, place, change and close orders and positions. Every tool here previews unless dry_run is false.
check_order
Preflight an order without placing it: amount/contracts, min notional, free margin, leverage cap, liquidation vs stop, protection plan (native|worker), equity-guard state. Same checks place_order runs. Requires analytics or trade capability (Pro and above).
Capability: analytics or trade · read-only · REST: POST /v1/tools/check_order
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | yes | — | |
side | buy | sell | long | short | yes | — | |
type | market | limit | stop_market | stop_limit | yes | — | |
size_usdt | number | yes | — | |
price | number | no | — | |
trigger_price | number | no | — | |
trigger_price_type | mark | last | index | no | — | |
stop_loss | number | no | — | |
take_profit | number | no | — | |
trailing | object | no | — | |
ratchet | object | no | — | |
expires_at | string | no | — | |
leverage | number | no | — | |
margin_mode | isolated | cross | no | — | |
post_only | boolean | no | — | |
reduce_only | boolean | no | — | |
position_side | long | short | no | — | |
comment | string | no | — | |
lease_token | string | no | — | |
dry_run | boolean | no | — |
Example request:
{
"symbol": "BTC/USDT:USDT",
"side": "buy",
"type": "market",
"size_usdt": 0
}place_order
Place an order sized in USDT (size_usdt) with optional stop_loss/take_profit/trailing/ratchet, expires_at, leverage, margin_mode, post_only, reduce_only, position_side. Per-call notional is capped. Never flips or widens implicitly. Response reports protection modes. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/place_order
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | yes | — | |
side | buy | sell | long | short | yes | — | |
type | market | limit | stop_market | stop_limit | yes | — | |
size_usdt | number | yes | — | |
price | number | no | — | |
trigger_price | number | no | — | |
trigger_price_type | mark | last | index | no | — | |
stop_loss | number | no | — | |
take_profit | number | no | — | |
trailing | object | no | — | |
ratchet | object | no | — | |
expires_at | string | no | — | |
leverage | number | no | — | |
margin_mode | isolated | cross | no | — | |
post_only | boolean | no | — | |
reduce_only | boolean | no | — | |
position_side | long | short | no | — | |
comment | string | no | — | |
lease_token | string | no | — | |
idempotency_key | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"symbol": "BTC/USDT:USDT",
"side": "buy",
"type": "market",
"size_usdt": 0,
"dry_run": true
}close_position
Close a position by position_uid with a reduce-only market order. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/close_position
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
position_uid | string | yes | — | |
lease_token | string | no | — | |
lease_override | object | no | — | |
expect_stop_loss | number | no | — | |
expect_take_profit | number | no | — | |
expect_amount_base | number | no | — | |
expect_tolerance | number | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"position_uid": "<position_uid>",
"dry_run": true
}partial_close
Reduce a position by size_usdt or fraction (exactly one); position_uid is unchanged. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/partial_close
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
position_uid | string | yes | — | |
size_usdt | number | no | — | |
fraction | number | no | — | |
lease_token | string | no | — | |
expect_stop_loss | number | no | — | |
expect_take_profit | number | no | — | |
expect_amount_base | number | no | — | |
expect_tolerance | number | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"position_uid": "<position_uid>",
"dry_run": true
}close_all_positions
Flatten all (or symbol/market_type-filtered) positions with reduce-only markets and cancel their protection orders. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/close_all_positions
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | no | — | |
market_type | spot | swap | no | — | |
lease_token | string | no | — | |
lease_override | object | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"dry_run": true
}reverse_position
Close and open the opposite side as one explicit operation (never implicit). Returns REVERSE_PARTIAL if the close succeeded but the opposite leg did not. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/reverse_position
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
position_uid | string | yes | — | |
size_usdt | number | no | — | |
stop_loss | number | no | — | |
take_profit | number | no | — | |
ratchet | object | no | — | |
lease_token | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"position_uid": "<position_uid>",
"dry_run": true
}cancel_order
Cancel an open order by order_id. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/cancel_order
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
order_id | string | yes | — | |
lease_token | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"order_id": "<order_id>",
"dry_run": true
}modify_pending_order
Change price/trigger/SL/TP/expiry of a pending order; retrofitting expiry works (worker-enforced where not native). dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/modify_pending_order
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
order_id | string | yes | — | |
price | number | no | — | |
trigger_price | number | no | — | |
stop_loss | number | no | — | |
take_profit | number | no | — | |
expires_at | string | no | — | |
lease_token | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"order_id": "<order_id>",
"dry_run": true
}set_leverage
Set leverage for a symbol (capped by connection/tier/exchange). Increases are blocked while the equity guard is breached. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/set_leverage
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | yes | — | |
leverage | number | yes | — | |
lease_token | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"symbol": "BTC/USDT:USDT",
"leverage": 1,
"dry_run": true
}set_margin_mode
Set isolated/cross margin for a symbol; rejected while a position is open on it. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/set_margin_mode
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | yes | — | |
margin_mode | isolated | cross | yes | — | |
lease_token | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"symbol": "BTC/USDT:USDT",
"margin_mode": "isolated",
"dry_run": true
}set_position_mode
Switch one-way/hedge mode; rejected while any position or order is open. dry_run defaults to true: nothing is sent to the exchange until dry_run:false is passed explicitly. Responses on a simulated connection carry mode:"simulated". Requires the trade capability (Pro and above; simulated connections may trade on every tier).
Changes your exchange account or platform state. It previews by default: pass dry_run: false to execute. Paper mode forces a preview.
Capability: trade · mutating · REST: POST /v1/tools/set_position_mode
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
mode | oneway | hedge | yes | — | |
lease_token | string | no | — | |
dry_run | boolean | yes | true | Default true: validate and preview only. Set false to execute. |
Example request:
{
"mode": "oneway",
"dry_run": true
}