Accounts

Account Balances

Get account balances

GET /api/balances/

Get token balances and positions in your configured accounts. Identity is inferred by API token.

Path Parameters

Name
Type
Description

account_names

list of strings

Optional. If specified, only balances for the accounts in this parameter are retrieved.

Refer to MarketType and AssetType in Type Reference for more details on these balance attributes.

notional_pct_total - calculated as the ratio of notional against total notional for all assets within the same market_type

{
    "AccountABC": {
        "exchange": "Bybit",
        "assets": [
            {
                "symbol": "ETH:PERP-USDT",
                "size": 1.69,
                "notional": 3051.5284,
                "market_type": "perp",
                "asset_type": "position",
                "unrealized_profit": 24.6772,
                "initial_margin": 306.80066534,
                "maint_margin": 16.90546734,
                "margin_balance": 298.90609459,
                "leverage": 10.0,
                "notional_pct_total": 0.994565
            },
            {
                "symbol": "USDT",
                "size": 275.56989474,
                "notional": 275.569895,
                "market_type": "unified",
                "asset_type": "token",
                "unrealized_profit": 23.33619985,
                "initial_margin": 308.47710954,
                "maint_margin": 17.08121552,
                "margin_balance": 298.90609459,
                "leverage": null,
                "notional_pct_total": 0.817474
            },
            ...
        ]
    },
    "Account123": {
        "exchange": "Binance",
        "assets": [
            {
                "symbol": "USDT",
                "size": 1414.06039641,
                "notional": 1414.060396,
                "market_type": "perp",
                "asset_type": "token",
                "unrealized_profit": 11.02638782,
                "initial_margin": 155.72429442,
                "maint_margin": 3.32015061,
                "margin_balance": 1425.08678423,
                "leverage": null,
                "notional_pct_total": 0.6449
            },
            {
                "symbol": "BTC:PERP-USDT",
                "size": 0.021,
                "notional": 572.956735,
                "market_type": "perp",
                "asset_type": "position",
                "unrealized_profit": 7.87343483,
                "initial_margin": 114.59134696,
                "maint_margin": 2.29182693,
                "margin_balance": null,
                "leverage": 5.0,
                "notional_pct_total": 0.261304
            },
            ...
        ]
    }
}

Get all user accounts

GET /api/accounts/

Path Parameters

Name
Type
Description

include_archived

string

include archived accounts if field is "true"

Response Body

Field Name
Type
Description

id

string

Unique identifier for the account

name

string

Name of the account

user

integer

User ID associated with the account

username

string

Username for the account

exchange

string

Name of the exchange

margin_mode

string

Margin mode of the account

created_at

string

Timestamp of when the account was created

credential_options

object

Options for account credentials

vcefi_enabled

boolean

Indicates if VCEFI is enabled

archived

boolean

Indicates if the account is archived

wallet_type

string

Type of the wallet, if applicable

wallet_provider

string

Provider of the wallet, if applicable

vault_address

string

Vault address, if applicable

egress_ip

string

Egress IP address, if applicable

api_key

string

API key for the account

api_secret

string

API secret for the account, masked for security reasons

password

string

Password for the account, masked for security reasons

Create an account for an exchange

POST /api/accounts/

Name must be unique under each user.

Request Body

Name
Type
Description

name*

name of account

api_key*

String

API key for exchange

api_secret*

String

API secret for exchange

password

String

password for exchange if required

exchange*

String

valid name of Exchange

Archive account

DELETE /api/accounts/

Soft delete the account. It will no longer be usable but reference to orders will be maintained. It will also be renamed to indicate it is archived: ex. {account_name}_archived_{uuid}

Request Body

Name
Type
Description

name*

string

name of account

Update account

PUT /api/accounts/

Update some subset of fields

Request Body

Name
Type
Description

id*

string

uuid of primary key

margin_mode

string

one of ISOLATED, CROSS, CASH

Set Leverage

POST /api/set_leverage/

Request Body

Name
Type
Description

leverage*

string

new leverage

pair

string

pair name

account_ids

list of strings

list of account ids

Get cached account balances

GET /api/sor/get_cached_account_balance

Query Paramers:

Field Name
Type
Description

account_names

string

Comma-separated list of account display names to filtert by. If not provided, return balances of all accounts owned by user.

Response Body:

Top-Level Response Fields

Field Name
Type
Nullable
Purpose

balances

array (object)

No

Array of account balance objects, one per exchange account

errors

array (object)

No

Array of error objects for accounts that failed to fetch (empty if no errors)


Balance Object Fields

Field Name
Type
Nullable
Purpose

exchange_name

string

No

Name of the exchange (e.g., "Bybit", "OKXDEX", "Binance")

account_name

string

No

Display name of the account/credential

user_id

number (integer)

No

User ID who owns this account

account_id

string (UUID)

No

Unique identifier for the exchange credential

username

string

No

Username of the account owner

equity

string (decimal)

Yes

Total account equity across all market types (decimal as string)

assets

array (object)

No

Array of asset objects (tokens and positions) held in this account

equities

array (object)

No

Array of equity objects, grouped by market type (spot, perp, etc.)

transfers

array (object)

No

Array of transfer history objects (deposits/withdrawals)

timestamp_millis

number (integer)

No

Timestamp when the balance data was retrieved, in milliseconds since epoch (UTC)

created_at

string (ISO 8601)

No

Timestamp when the account credential was created

vcefi_enabled

boolean

No

Whether vCEFI (virtual CEX) is enabled for this account


Asset Object Fields

Each asset represents either a token balance or a position (for perpetual futures).

Field Name
Type
Nullable
Purpose

symbol

string

No

Asset symbol (e.g., "BTC", "ETH", "LINK:PERP-USDT" for positions)

amount

string (decimal)

No

Quantity/amount of the asset (decimal as string). For positions, this is the position size (can be negative for short positions)

margin_balance

string (decimal)

Yes

Margin balance for this asset (decimal as string, nullable). For unified margin accounts, this may represent the total margin balance

unrealized_profit

string (decimal)

Yes

Unrealized profit/loss for positions (decimal as string, nullable). Zero or null for tokens

notional

string (decimal)

Yes

Notional value of the asset (decimal as string, nullable). For positions, this is position value

wallet_type

string

No

Wallet type (e.g., "unified", "spot", "margin", "futures")

asset_type

string

No

Type of asset: "token" for token balances, "position" for perpetual futures positions

funding_fee

number (float) or null

Yes

Funding fee for perpetual positions (number or null). Only present for positions with asset_type: "position"

borrowed

string (decimal)

Yes

Amount borrowed (decimal as string, nullable). Used for margin trading

initial_margin

string (decimal)

Yes

Initial margin requirement (decimal as string, nullable). Only relevant for leveraged positions

maint_margin

string (decimal)

Yes

Maintenance margin requirement (decimal as string, nullable). Only relevant for leveraged positions

leverage

string (decimal)

Yes

Leverage used for this position (decimal as string, nullable). Only relevant for leveraged positions

margin_mode

string

Yes

Margin mode (e.g., "CROSS", "ISOLATED", "SPOT_ISOLATED", nullable). Only relevant for certain exchanges and margin types

Note: For token assets (asset_type: "token"), fields like funding_fee, borrowed, initial_margin, maint_margin, leverage, and margin_mode are typically null. For position assets (asset_type: "position"), these fields may have values.


Equity Object Fields

Equity objects represent total equity grouped by market type.

Field Name
Type
Nullable
Purpose

total_equity

string (decimal)

No

Total equity for this market type (decimal as string)

market_type

string

No

Market type (e.g., "spot", "perp", "futures")

Last updated

Was this helpful?