Loading...
Loading...
Drift Protocol perpetual futures trading on Solana (direct SDK)
npx skill4agent add alsk1992/cloddsbot drift-sdk# Set credentials
export DRIFT_PRIVATE_KEY="your-solana-private-key"
export SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"
# Check balance
/drift balance
# Open a position
/drift long BTC 0.1
/drift short ETH 1 2500
# Close position
/drift close BTC| Command | Description |
|---|---|
| Open long position |
| Open short position |
| Close position at market |
| Close all positions |
| Set leverage |
/drift long BTC 0.1 # Market buy 0.1 BTC
/drift short ETH 1 2500 # Limit sell 1 ETH at $2500
/drift leverage SOL 5 # Set SOL leverage to 5x| Command | Description |
|---|---|
| List open orders |
| Cancel order by ID |
| Cancel all orders for coin |
| Cancel all orders |
| Modify order |
| Command | Description |
|---|---|
| Collateral, margin, health factor |
| Open positions with PnL |
# Required
export DRIFT_PRIVATE_KEY="base58_or_json_array"
# Optional
export SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"
export DRY_RUN=true # Test mode| Market | Index | Max Leverage |
|---|---|---|
| BTC-PERP | 0 | 20x |
| ETH-PERP | 1 | 20x |
| SOL-PERP | 2 | 20x |
| ... | ... | ... |