Skip to content

Accounts

All of your trading activity is associated with your account which corresponds to an address. In dYdX, accounts are also composed by subaccounts. All trading is done through a subaccount. See more on the Accounts and Subaccounts page.

Account Data

An account can have multiple subaccounts. To fetch all known (with some activity) subaccounts associated with an account the account's address is required.

Python
response = await indexer.account.get_subaccounts(ADDRESS)

To fetch a specific subaccount, use the account's address the the subaccount number.

Python
# Fetch subaccount '0' information.
subaccount_resp = await indexer.account.get_subaccount(ADDRESS, 0)

Balance

The responses above will contain information such as the subaccount's equity, also known as the total account value. Your equity is a combination of the account's USDC balance and sum of the open positions values. A minimum amount of funds is required to trade, see more on Margin and Other Limits.

Python
subaccount = subaccount_resp["subaccount"]
print("Equity: ", subaccount["equity"])
print("Open positions: ", subaccount["openPerpetualPositions"])

Asset Transfers

Methods are available to transfer assets among accounts and subaccounts. See the table below for the different transfer paths. Links point to the API reference.

SourceDestinationMethod
AccountSubaccountDeposit
SubaccountAccountWithdraw
SubaccountSubaccountTransfer
AccountAccountSend Token