Skip to main content
Commands for interacting with Drift Protocol (spot and perp trading) and Drift Vaults.
The Drift integration must be enabled before using these commands:

Drift Protocol

User Management

Initialize User

Initialize a Drift user account (sub-account) for the vault.
  • --sub-account-id, -s: Sub-account ID (default: 0)
  • --pool-id, -p: Isolated pool ID (default: 0)

List Users

List all Drift user sub-accounts for the vault.

Delete User

Delete a Drift user sub-account.

Update User Pool ID

Update a Drift user’s pool ID.

Deposits & Withdrawals

Deposit

Deposit to a Drift spot market.
  • market_index: Spot market index (e.g., 0 for USDC, 1 for SOL)
  • amount: Amount to deposit
  • --sub-account-id, -s: Sub-account ID (default: 0)

Withdraw

Withdraw from a Drift spot market. If withdrawing more than your balance with sufficient collateral, this becomes a borrow.

Trading

Enable/Disable Margin

Enable or disable margin trading for a sub-account.

Spot Order

Place a limit spot order.
  • direction: long or short
  • market_index: Spot market index
  • amount: Order size
  • price_limit: Limit price in USD
Example: Buy 0.5 SOL at $100:

Perp Order

Place a limit perpetual order.

List Orders

List open orders.

Cancel Orders

Cancel one or more orders by ID.

Positions

List Positions

List all Drift positions (spot and perp).

Settle PnL

Settle PnL for a perp market.

Policy Management

View Policy

Allowlist Market

Remove Market

Allowlist Borrowable Asset

Remove Borrowable Asset


Drift Vaults

List Depositors

List Drift vault depositor accounts owned by the GLAM vault.

Deposit

Deposit to a Drift vault.

Request Withdraw

Request to withdraw from a Drift vault.
  • amount: Amount in vault shares

Cancel Withdraw

Cancel a pending withdrawal request.

Withdraw

Claim a withdrawal after the request period has passed.

Policy Management

View Policy

Allowlist Vault

Remove Vault