Skip to main content
Drift user accounts hold your positions, orders, and collateral. Before trading, you need to create a user account and deposit collateral.

User Account Structure

Each user account contains:
  • Positions: Up to 8 perpetual and 8 spot positions
  • Orders: Up to 32 active orders
  • Collateral: Spot balances used as margin
  • Sub-account ID: Support for multiple sub-accounts (0-9999)

Creating a User Account

1

Check if Account Exists

2

Initialize User Account

3

Deposit Collateral

Initialize and Deposit in One Transaction

For first-time users, combine account initialization and deposit:

Working with User Class

The User class provides a high-level interface for account data:

Sub-Accounts

Drift supports multiple sub-accounts per wallet for portfolio segregation:
Sub-accounts are useful for:
  • Separating strategies (e.g., hedging vs directional)
  • Risk isolation
  • Testing new strategies with limited capital
  • Different leverage profiles

Depositing Collateral

Deposit USDC

Deposit SOL

Deposit Other Tokens

Withdrawing Collateral

You can only withdraw excess collateral. The withdrawal will fail if it would put your account below the maintenance margin requirement.

Check Available Collateral

Account Status and Health

Deleting a User Account

You can only delete a user account if:
  • All positions are closed
  • All orders are cancelled
  • All collateral is withdrawn

Best Practices

Separate high-risk strategies into different sub-accounts to isolate risk and prevent cascading liquidations.

Next Steps

Place Orders

Start trading with your funded account

Manage Positions

Monitor and close positions

User API

Explore User class methods

Account Subscriptions

Real-time account updates