For the complete documentation index, see llms.txt. This page is also available as Markdown.

Sub-account

Manage sub-accounts and view combined account balances and positions.

Sub-account

These operations let the main account create and manage sub-accounts, inspect aggregated positions and balances, and settle sub-account PnL. Only the main account can call the listing, creation, update, and aggregate endpoints. The main account's API key can control its sub-accounts.

Authentication headers

Private operations use orderly-timestamp (string, signed-request time in milliseconds), orderly-account-id (string, authenticated account ID), orderly-key (string, public signing key), and orderly-signature (string, request signature), except where an endpoint below specifies an account-header constraint.

Add Sub-account

POST /v1/client/add_sub_account Mainnet: POST https://api.orderly.org/v1/client/add_sub_account Testnet: POST https://testnet-api.orderly.org/v1/client/add_sub_account Rate limit: 10 requests per second.

Only the main account may call this endpoint. Submit application/json with optional description (string) as a user-defined label. The main account's key can manage the sub-account.

HTTP 200 returns success, required data.sub_account_id (number) and data.description (string), plus server timestamp.

Get Sub-account List

GET /v1/client/sub_account Mainnet: GET https://api.orderly.org/v1/client/sub_account Testnet: GET https://testnet-api.orderly.org/v1/client/sub_account Rate limit: 10 requests per second.

Only the main account may call this endpoint. No query or path parameters. HTTP 200 returns required data.main_account_id (string) and required data.rows array. Each row contains sub_account_id (string account ID) and description (string label). The envelope also includes success and server timestamp.

{"success":true,"data":{"main_account_id":"0x7ecc7eb7dc60d7fb5c5ea9cc637da1a46e265a744efda327b9914d7a21725bbf","rows":[{"sub_account_id":"0x86987799a1433266cacd80c817b670336d6779468f69defd6f8dc384a07b6457","description":"abc"}]},"timestamp":1702989203989}

Update Sub-account

POST /v1/client/update_sub_account Mainnet: POST https://api.orderly.org/v1/client/update_sub_account Testnet: POST https://testnet-api.orderly.org/v1/client/update_sub_account Rate limit: 10 requests per second.

Only the main account may call this endpoint. Submit application/json with sub_account_id (string, required) and description (string, optional).

HTTP 200 returns success (boolean) and server timestamp (integer, milliseconds).

Get Aggregate Positions

GET /v1/client/aggregate/positions Mainnet: GET https://api.orderly.org/v1/client/aggregate/positions Testnet: GET https://testnet-api.orderly.org/v1/client/aggregate/positions Rate limit: 1 request per 60 seconds.

Only the main account may call this endpoint. No query or path parameters. HTTP 200 returns success, timestamp, and data.rows, an array aggregating the main account and sub-account positions. Each row may include: account_id (string); numeric IMR_withdraw_orders, MMR_with_orders, average_open_price, cost_position, est_liq_price, fee_24_h, imr, last_sum_unitary_funding, mark_price, mmr, pending_long_qty, pending_short_qty, pnl_24_h, position_qty, settle_price, seq, timestamp, updated_time, unsettled_pnl, margin, and accrued_funding_fee; symbol and margin_mode are strings; leverage is an integer.

Get Aggregate Holding

GET /v1/client/aggregate/holding Mainnet: GET https://api.orderly.org/v1/client/aggregate/holding Testnet: GET https://testnet-api.orderly.org/v1/client/aggregate/holding Rate limit: 1 request per 60 seconds.

Only the main account may call this endpoint. No query or path parameters. HTTP 200 returns success, server timestamp, and data.rows, an array of balances for the main account and its sub-accounts. Each record includes account_id (string), updated_time (number, milliseconds), token (string), and numeric balances holding, frozen, pending_short, isolated_margin, and isolated_order_frozen.

Settle Sub-account PnL

POST /v1/sub_account_settle_pnl Mainnet: POST https://api.orderly.org/v1/sub_account_settle_pnl Testnet: POST https://testnet-api.orderly.org/v1/sub_account_settle_pnl Rate limit: 10 requests per second.

The main account's key can control sub-accounts. Include orderly-timestamp, orderly-key, and orderly-signature; the required account header is orderly_account_id (with an underscore), and it must contain the sub-account ID. Submit application/json with required settle_nonce (number).

HTTP 200 returns success, required data.settle_pnl_id (integer), and server timestamp (integer, milliseconds).

Last updated