view-policy
View the current Drift protocol policy.
allowlist-market
Add a market to the allowlist.
glam drift allowlist-market <market_type> <market_index> [options]
Market type: “spot” or “perp”
Spot or perp market index
Examples:
# Allowlist spot market
glam drift allowlist-market spot 0
# Allowlist perp market
glam drift allowlist-market perp 1 -y
remove-market
Remove a market from the allowlist.
glam drift remove-market <market_type> <market_index> [options]
Market type: “spot” or “perp”
Spot or perp market index
Examples:
# Remove spot market
glam drift remove-market spot 0
# Remove perp market
glam drift remove-market perp 1 -y
set-order-price-tolerance
Set max allowed deviation from oracle price for limit orders.
glam drift set-order-price-tolerance <tolerance_bps> [options]
Tolerance in basis points (0 to disable, e.g., 500 = 5%)
Examples:
# Set 5% tolerance
glam drift set-order-price-tolerance 500
# Disable tolerance check
glam drift set-order-price-tolerance 0 -y
allowlist-borrowable-asset
Add a borrowable asset to the allowlist.
glam drift allowlist-borrowable-asset <token_mint> [options]
Examples:
glam drift allowlist-borrowable-asset EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
remove-borrowable-asset
Remove a borrowable asset from the allowlist.
glam drift remove-borrowable-asset <token_mint> [options]
Examples:
glam drift remove-borrowable-asset EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v -y
init-user
Initialize a Drift user account (sub-account).
glam drift init-user [options]
Examples:
# Initialize default sub-account
glam drift init-user
# Initialize sub-account 1
glam drift init-user -s 1 -y
list-users
List Drift users (sub-accounts).
Example output:
2 Drift users found
[0]: Main Account (Pool ID: 0)
[1]: Sub Account 1 (Pool ID: 0)
list-positions
List Drift positions for a sub-account.
glam drift list-positions [options]
Examples:
# List positions for default sub-account
glam drift list-positions
# List positions for sub-account 1
glam drift list-positions -s 1
deposit
Deposit assets to Drift.
glam drift deposit <market_index> <amount> [options]
Examples:
# Deposit 100 USDC (market index 0)
glam drift deposit 0 100
# Deposit to sub-account 1
glam drift deposit 0 100 -s 1 -y
withdraw
Withdraw assets from Drift.
glam drift withdraw <market_index> <amount> [options]
Examples:
# Withdraw 50 USDC
glam drift withdraw 0 50
# Withdraw from sub-account 1
glam drift withdraw 0 50 -s 1 -y
spot
Place a limit spot order.
glam drift spot <direction> <market_index> <amount> <price_limit> [options]
Order direction: “long” or “short”
Examples:
# Place long order for 100 USDC at $1.00
glam drift spot long 0 100 1.00
# Place short order
glam drift spot short 0 100 1.00 -y
perp
Place a limit perpetual order.
glam drift perp <direction> <market_index> <amount> <price_limit> [options]
Order direction: “long” or “short”
Examples:
# Place long perp order
glam drift perp long 0 1 50000
# Place short perp order
glam drift perp short 0 1 45000 -y
list-orders
List open orders.
glam drift list-orders [options]
Examples:
# List orders for default sub-account
glam drift list-orders
# List orders for sub-account 1
glam drift list-orders -s 1
cancel
Cancel one or more orders.
glam drift cancel <order_ids...> [options]
Space-separated list of order IDs
Examples:
# Cancel single order
glam drift cancel 123
# Cancel multiple orders
glam drift cancel 123 124 125 -y
margin
Enable or disable margin trading.
glam drift margin <enabled> [options]
Enable (true) or disable (false) margin trading
Examples:
# Enable margin trading
glam drift margin true
# Disable margin trading
glam drift margin false -y
settle
Settle PnL for a perpetual market.
glam drift settle <market_index> [options]
Examples:
# Settle PnL for perp market 0
glam drift settle 0
# Settle for sub-account 1
glam drift settle 0 -s 1
delete-user
Delete a Drift user (sub-account).
glam drift delete-user <sub_account_id> [options]
Examples:
# Delete sub-account 1
glam drift delete-user 1
# Delete without confirmation
glam drift delete-user 1 -y
update-user-pool-id
Update a Drift user’s pool ID.
glam drift update-user-pool-id <sub_account_id> <pool_id> [options]
Examples:
# Update sub-account 1 to pool 2
glam drift update-user-pool-id 1 2
# Update without confirmation
glam drift update-user-pool-id 1 2 -y