A high-performance CLI trading bot and utility suite for the DeepDex protocol. Trade spot and perpetual markets, manage subaccounts, and run automated strategies on the DeepDex Testnet.
curl -fsSL https://raw.githubusercontent.com/deepdexfinance/deepdex-cli/refs/heads/main/install.sh | bashOr with wget:
wget -qO- https://raw.githubusercontent.com/deepdexfinance/deepdex-cli/refs/heads/main/install.sh | bashgit clone https://github.com/deepdexfinance/deepdex-cli.git ~/.deepdex
cd ~/.deepdex
bun install~/.deepdex/install.sh --uninstall# Initialize wallet
deepdex init
# Get testnet tokens
deepdex faucet
# Create a subaccount and deposit
deepdex account create
deepdex account deposit 1000 USDC
deepdex account deposit 50% ETH # Deposit 50% of wallet balance
# Start trading (supports % amounts)
deepdex spot buy ETH/USDC 0.5
deepdex spot buy ETH/USDC 50% # Buy with 50% of USDC balance
deepdex perp long ETH-USDC 1 --lev 10
deepdex perp long ETH-USDC 25% --lev 5 # Use 25% of margin at 5x
# Run automated bot (foreground)
deepdex bot start grid
# Or use process manager for multiple bots (background)
deepdex pm start eth-grid grid --config ./configs/grid.json
deepdex pm start btc-dca simple --config ./configs/dca.json
deepdex pm ps # List all running processesFor non-interactive use (CI/CD, scripts, multiple bots):
# Create wallets programmatically
DEEPDEX_NEW_WALLET_PASSWORD="mypassword" deepdex wallet create bot-1
# Or use --password flag
deepdex wallet create bot-2 --password mypassword
# Unlock wallet from env for transactions
export DEEPDEX_WALLET_PASSWORD="mypassword"
deepdex wallet transfer 100 USDC bot-1 --yes
deepdex account deposit 100% USDC --yes
# Start bot processes in background
deepdex pm start my-bot momentum --config ./config.json --yesEnvironment Variables:
| Variable | Description |
|---|---|
DEEPDEX_WALLET_PASSWORD |
Password for unlocking existing wallets |
DEEPDEX_NEW_WALLET_PASSWORD |
Password for creating/importing wallets |
DEEPDEX_NON_INTERACTIVE |
Set to "true" to fail instead of prompting |
The DeepDex CLI includes a built-in Model Context Protocol (MCP) server, enabling Large Language Models (LLMs) like Claude to interact directly with the DeepDex exchange.
Start the MCP server to expose trading tools to your AI agent:
# Set wallet password for non-interactive access
export DEEPDEX_WALLET_PASSWORD="your-wallet-password"
# Start the server
deepdex mcpAdd the following to your claude_desktop_config.json:
{
"mcpServers": {
"deepdex": {
"command": "deepdex",
"args": ["mcp"],
"env": {
"DEEPDEX_WALLET_PASSWORD": "your-password"
}
}
}
}-
Multi-Market Support
- Spot Trading: ETH/USDC, SOL/USDC with limit and market orders
- Perpetual Futures: Up to 50x leverage with TP/SL orders
-
Order Management
- Limit, Market, Post-Only, Reduce-Only orders
- Integrated Take-Profit and Stop-Loss
- Batch order cancellation
-
Account System
- Subaccount isolation for different strategies
- Hot wallet delegation for bot trading
- Margin trading support
-
Automated Trading
- Grid, Market Making, and Arbitrage strategies
- Real-time Oracle price feeds
- Backtesting support
-
Process Manager (
pm)- Run multiple bots simultaneously with unique names
- PM2/Docker Compose style management
- Per-process logs and monitoring
The bot comes with several built-in strategies that can be configured in .deepdex/config.json:
-
Simple DCA (
simple)- Executes dollar-cost averaging by buying a fixed amount of an asset at regular intervals.
- Good for long-term accumulation.
-
Grid Trading (
grid)- Places buy and sell orders at fixed price intervals within a configured range.
- Inventory Skewing: Automatically adjusts grid levels based on current inventory to manage risk (e.g., shifts levels down if holding too much inventory).
- Best for sideways/ranging markets.
-
Momentum (
momentum)- Trend-following strategy using Moving Averages (MA).
- Longs when price is above MA, shorts when below.
- Captures big trends but may suffer in choppy markets.
-
Funding Rate Arbitrage (
arbitrage)- Exploits positive funding rates by shorting the perpetual contract and buying the spot asset (Delta Neutral).
- Earns funding fees while hedging price risk.
- Automatically sells spot position when closing the arbitrage.
-
Automation & Scripting
- Non-interactive wallet creation with
--passwordflag - Environment variables for password handling
- Batch operations with
--yesflag - JSON output for scripting
- Non-interactive wallet creation with
-
Developer Experience
- Built with Bun for speed
- Type-safe with TypeScript + Zod
- JSON output mode for scripting
See GUIDE.md for complete CLI reference and command documentation.
| Component | Technology |
|---|---|
| Runtime | Bun |
| Language | TypeScript |
| Blockchain | viem |
| Validation | zod |
deepdex/
βββ src/
β βββ abis/ # Contract ABIs
β βββ config/ # Configuration
β βββ services/ # Business logic
β βββ types/ # TypeScript types
βββ index.ts # Entry point
βββ GUIDE.md # CLI documentation
βββ README.md
- Bun v1.0.0+
git clone https://github.com/deepdex/deepdex.git
cd deepdex
bun installbun run start| Property | Value |
|---|---|
| RPC URL | https://rpc-testnet.deepdex.finance |
| Network | DeepDex Testnet |
- Fork the project
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open a Pull Request
MIT
