Linux-only automated trading system for Solana blockchain with arbitrage detection, liquidation monitoring, and risk management.
⚠️ Important: This bot is designed and tested for Linux environments only. It may not work properly on macOS or Windows.
MEV (Maximal Extractable Value) is a trading strategy that exploits price differences across multiple DEXes on Solana testnet. The bot executes multi-hop trades like:
SOL → Coin1 → Coin2 → Coin3 → SOL
This creates arbitrage opportunities by taking advantage of price inefficiencies between different decentralized exchanges.
- MEV Trading: Multi-hop arbitrage (SOL → Coin1 → Coin2 → Coin3 → SOL)
- AI Trading: OpenAI integration for market analysis
- Arbitrage Bot: Multi-DEX support with path discovery
- Liquidation Bot: Solend protocol integration
- Risk Management: Built-in risk assessment and limits
- Testnet Only: Safe testing environment on Solana testnet
- Real-time Monitoring: Continuous price monitoring and opportunity detection
bot/
├── src/
│ ├── arbitrage-bot/ # Arbitrage detection
│ ├── liquidation-bot/ # Liquidation monitoring
│ └── utils/ # Utility functions
├── models/ # AI models
├── config.toml # Configuration
└── package.json # Dependencies
- Operating System: Linux (Ubuntu 18.04+, CentOS 7+, or similar)
- Node.js (v16+)
- Solana CLI tools
- Anchor Framework
- Clone and install:
git clone https://github.com/xodn348/AI_automated_trading.git
cd AI_automated_trading
npm install
- Configure environment:
# Create .env file in src/arbitrage-bot/
OPENAI_API_KEY=your_openai_api_key
SOLANA_PRIVATE_KEY=your_solana_private_key
SOLANA_RPC_URL=https://api.devnet.solana.com
- Important: Fix wallet path issue
# Copy wallet.json to src/ directory (required for bot to start)
cp wallet.json src/wallet.json
# Or modify config.toml to use correct path
# Comment out: private_key_path = "/home/jnnj92/bot/wallet.json"
# Make deployment script executable
chmod +x deploy-linux.sh
# Run deployment script
./deploy-linux.sh
# Build and run with Docker
docker-compose up -d
# Or build manually
docker build -t ai-trading-bot .
docker run -d --name ai-trading-bot ai-trading-bot
# Start as system service
sudo systemctl start ai-trading-bot
# Enable auto-start
sudo systemctl enable ai-trading-bot
# Check status
sudo systemctl status ai-trading-bot
# View logs
sudo journalctl -u ai-trading-bot -f
# Main bot (requires wallet.json in src/ directory)
npm start
# AI-enhanced version
node src/arbitrage-bot/index2_ai.js
# Test bot startup (recommended first)
node -e "try { require('./src/arbitrage-bot/index.js'); console.log('Bot loaded successfully!'); } catch(e) { console.error('Error:', e.message); }"
- Wallet Setup: Ensure
wallet.json
exists insrc/
directory - Devnet Only: Bot currently works only on Solana devnet for safety
- Test Mode: Bot runs in monitoring mode without executing real trades
- API Keys: OpenAI API key required for AI features to work
# Liquidation monitoring
node src/liquidation-bot/liquidation-bot.js
# Create test positions
node src/liquidation-bot/create-test-position.js
cd test-liquidation
npm test
Edit config.toml
for:
- Network settings (RPC endpoints)
- Trading parameters (slippage, position sizes)
- AI settings (OpenAI configuration)
- Risk management (stop-loss, take-profit)
- Network: Solana testnet only (
https://api.testnet.solana.com
) - Trading: Test mode (no real transactions executed)
- MEV Strategy: Multi-hop arbitrage across multiple DEXes
- Monitoring: 30-second intervals for arbitrage opportunities
- Safety: 1% minimum profit threshold before execution
- API keys stored in
.env
(not committed to Git) - Configurable trading limits
- Oracle price validation
- Slippage protection
Automatically collects:
- Historical price data
- Trading performance metrics
- Market volatility data
- Arbitrage opportunity logs
MIT License - see LICENSE file for details.
For educational and research purposes only. Cryptocurrency trading involves significant risk. Use at your own risk.