An AI-powered cryptocurrency trading system that combines multi-agent strategy generation with live trading capabilities. Built on CrewAI, this system uses collaborative AI agents to research markets, generate trading strategies, backtest them, and execute live trades on testnet.
- Trending Coin Finder β Identifies promising cryptocurrencies from news, market reports, and social sentiment
- Coin Picker β Selects the best investment opportunity with detailed analysis
- Strategy Generator & Backtester β Creates and validates trading strategies using technical indicators (EMA, SMA, RSI, MACD, Bollinger Bands, ATR, VWAP)
- Real-time Data Management β Maintains rolling window of historical data with automatic updates
- Automated Strategy Execution β Executes trades based on generated strategies with position tracking
- Risk Management β Built-in stop-loss, take-profit, and allocation controls
- Testnet Integration β Safe testing environment with Binance testnet
- Professional Dashboard β Real-time monitoring interface with live charts and analytics
- Interactive Charts β Live price charts with technical indicators and trading signals
- Portfolio Monitoring β Real-time holdings, transactions, and P&L tracking
- Activity Logs β Comprehensive trading activity and system logs
- Responsive Design β Modern UI with Merriweather Sans typography
- Auto-refresh β Updates every 30 seconds for real-time data
- Generic Strategy Support β Works with any strategy without code changes
- Dynamic Signal Evaluation β Uses
eval()for flexible rule evaluation - Automated Pipeline β Complete workflow from strategy generation to execution
- Comprehensive Logging β Detailed trading logs and performance metrics
- Win Rate β Percentage of profitable trades
- Profit Factor β Ratio of gross profit to gross loss
- Sharpe Ratio β Risk-adjusted return measure
- Max Drawdown β Maximum peak-to-trough decline
- Total Return β Overall portfolio performance
- Trade Count β Number of trades executed
- Python >= 3.10 < 3.14
- UV package manager
- NTP Time Synchronization β System clock must be synchronized for accurate API timestamps
# Install UV
pip install uv
# Clone and navigate to project
git clone https://github.com/pushkqr/crypto-bot
cd crypto
# Install dependencies
uv sync
source .venv/bin/activate # Linux/WSL
# or
.venv\Scripts\Activate.ps1 # Windows PowerShell
# Enable NTP time synchronization
sudo timedatectl set-ntp true # Linux/WSL
# For Windows: Settings β Time & Language β Date & Time β Set time automaticallyCreate a .env file with your API keys:
# CrewAI & Research
GEMINI_API_KEY=your_gemini_key
SERPER_API_KEY=your_serper_key
# Binance API (Mainnet for data)
BINANCE_API_KEY=your_mainnet_key
BINANCE_API_SECRET=your_mainnet_secret
# Binance Testnet (for trading)
TESTNET_API_KEY=your_testnet_key
TESTNET_SECRET=your_testnet_secret
# Push Notifications (ntfy)
NTFY_SERVER=https://ntfy.sh
NTFY_TOPIC=crypto-bot-alerts-your-unique-id- Choose a unique topic name (e.g.,
crypto-bot-alerts-your-unique-id-12345) - Install ntfy app on your phone from App Store/Play Store
- Subscribe to your topic in the ntfy app
- Test notifications:
curl -d "Test message!" https://ntfy.sh/your-topic-name
uv run app.pyThis will:
- Check for existing strategies
- Ask if you want to execute them
- Generate new strategies if needed
- Launch the professional trading dashboard
This opens a real-time web interface with:
- Live price charts with technical indicators
- Portfolio monitoring and P&L tracking
- Current holdings and recent transactions
- Trading activity logs
- Real-time updates every 30 seconds
crypto/
βββ src/crypto/ # Core CrewAI system
β βββ main.py # Entry points
β βββ crew.py # Agent definitions
β βββ config/ # Agent and task configs
β βββ tools/ # Custom tools
βββ app.py # Main pipeline script
βββ gui.py # Gradio web interface
βββ trader.py # Complete trading system
βββ util.py # UI utilities and styling
βββ output/ # Generated strategies & results
βββ data/ # Historical data cache
- Define agent roles, goals, and capabilities
- Customize agent behavior and tools
- Define workflow tasks and dependencies
- Set output formats and validation rules
- Symbol and timeframe settings
- Risk management parameters
- Data buffer size configuration
- Binance (Testnet for safe testing)
- Mainnet data fetching for accurate indicators
- Position sizing based on portfolio allocation
- Stop-loss and take-profit levels
- Maximum position limits
output/backtest_results.jsonβ Strategy performance and rulesoutput/investment_decision.mdβ Detailed strategy analysisdata/β Cached historical data for faster access
If you encounter "Timestamp for this request is outside of the recvWindow" errors:
Linux/WSL:
# Check time sync status
timedatectl
# Enable NTP sync
sudo timedatectl set-ntp true
# Force immediate sync
sudo ntpdate -s time.google.comWindows:
- Open Settings β Time & Language β Date & Time
- Enable "Set time automatically"
- Click "Sync now"
Verify sync:
# Check time drift with Binance servers
python test.py # If you have the time drift test scriptContributions are welcome!
- CrewAI β Multi-agent framework for strategy generation
- python-binance β Binance API integration for live trading
- ta β Technical analysis indicators (EMA, SMA, RSI, MACD, etc.)
- pandas β Data manipulation and analysis
- numpy β Numerical computing
- pydantic β Data validation and serialization
- gradio β Web interface framework for dashboard
- plotly β Interactive charts and visualizations
- python-dotenv β Environment variable management
- requests β HTTP requests for API calls