A comprehensive crypto trading bot system with multiple trading strategies, server-client architecture for managing multiple bot instances, web UI for monitoring and control, and full logging for tax compliance.
Warning
This is a AI spec driven project for testing purposes only, it is neither complete nor secure. This has completely and 100% been writen by AI. *** DO NOT USE WITH YOUR MONEY ***
- 7 Trading Strategies: DCA Accumulator, Adaptive Grid, Mean Reversion, Trend Following, Volatility Breakout, Dip Recovery, and Auto Mode (plus TWAP/VWAP execution algorithms)
- Multi-Bot Management: Run multiple bots simultaneously with different strategies and trading pairs
- Risk Management: Virtual wallets, stop losses, drawdown limits, consecutive loss detection, and kill switches
- Real-time Monitoring: WebSocket-based live updates for P&L, positions, and bot status
- Tax Compliance: Complete order logging with fiscal export functionality
- Dark Theme UI: Professional monitoring dashboard
- Python 3.11+
- FastAPI (async web framework)
- SQLAlchemy with SQLite
- ccxt (unified exchange API)
- asyncio for concurrent bot management
- React 18
- Tailwind CSS
- React Query for state management
- Recharts for P&L visualization
- WebSocket for real-time updates
- Python 3.11 or higher
- Node.js 18+
- MEXC exchange account with API key/secret
- (Optional) CoinMarketCap API key
- (Optional) CoinGecko API key
git clone https://github.com/mrjimmybob/tradingpot
cd tradingpot
chmod +x init.sh
./init.shExchange credentials are not needed for dry-run mode — dry-run bots use the exchange's public market data API (internet access required) with simulated balances and fills.
For live trading, set credentials via environment variables (preferred):
export MEXC_API_KEY="your-key"
export MEXC_API_SECRET="your-secret"or edit config/exchanges.yaml:
mexc:
api_key: "YOUR_API_KEY"
api_secret: "YOUR_API_SECRET"Environment variables override the YAML file. Placeholder values (anything
starting with YOUR_) are treated as unset — live bots refuse to start
without real credentials.
source venv/bin/activate # or venv/Scripts/activate on Windows
cd backend
uvicorn app.main:app --reloadcd frontend
npm run dev- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
The backend binds to
127.0.0.1(localhost-only) by default. -
To expose the API beyond localhost you must set an API token, or the server refuses to start:
export TRADINGBOT_API_TOKEN="a-long-random-token"
Clients must then send
Authorization: Bearer <token>on every API request and?token=<token>on the WebSocket. In the web UI, set the token on the Settings page (stored in browser localStorage). -
There is no TLS or multi-user support; for anything beyond a trusted LAN, put the API behind a reverse proxy with HTTPS.
- Dry-run with real data: create bots in dry-run mode. Prices come from the live exchange public API; balances and fills are simulated. If market data is unavailable, bots skip trading rather than using fake prices.
- Small live test: once dry-run behavior looks sane over a meaningful period, configure real credentials and start a live bot with a small budget to monitor real execution and performance.
tradingbot/
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI application
│ │ ├── models/ # SQLAlchemy models
│ │ ├── routers/ # API endpoints
│ │ ├── services/ # Business logic
│ │ ├── strategies/ # Trading strategies
│ │ └── exchange/ # Exchange integration
│ ├── requirements.txt
│ └── tests/
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom hooks
│ │ ├── services/ # API services
│ │ └── App.tsx
│ ├── package.json
│ └── tailwind.config.js
├── config/
│ ├── exchanges.yaml # Exchange API keys
│ ├── email.yaml # SMTP configuration
│ ├── data_sources.yaml # External data sources
│ └── defaults.yaml # Default parameters
├── logs/ # Bot log files
├── init.sh # Setup script
└── README.md
mexc:
api_key: "YOUR_API_KEY"
api_secret: "YOUR_API_SECRET"
sandbox: falsesmtp:
host: "smtp.gmail.com"
port: 587
username: "your-email@gmail.com"
password: "your-app-password"
use_tls: true
notifications:
enabled: true
recipient: "your-email@gmail.com"coinmarketcap:
api_key: "YOUR_CMC_API_KEY"
priority: 1
enabled: false
coingecko:
priority: 2
enabled: true
poll_frequency: 300 # 5 minutesAlpha strategies (single-symbol, long-biased spot):
| Strategy | Description |
|---|---|
| DCA Accumulator | Dollar-cost averaging with configurable intervals |
| Adaptive Grid | Dynamic grid trading with auto-rebalancing |
| Mean Reversion | Trade reversions to mean using Bollinger Bands |
| Trend Following | Conservative long-only momentum with EMA crossover and ATR-based stops |
| Volatility Breakout | Enters on price breakouts following low-volatility compression |
| Dip Recovery | Pullback reversal: buys confirmed reversals after significant declines, never buys a still-falling market |
| Auto Mode | Regime-based automatic strategy selection policy (detects market regimes and selects optimal strategy) |
Execution algorithms (how to fill an order, not when to trade): TWAP (time-weighted) and VWAP (volume-weighted). These are not selectable as alpha strategies.
- Virtual Wallet: Budget cap separate from actual exchange balance
- Stop Losses: Per-trade and per-bot drawdown limits
- Kill Switch: Per-bot and global emergency stop
- Consecutive Loss Protection: Automatic strategy rotation and pause
- Time-Based Limits: Daily and weekly loss limits
- Dry Run Mode: Test strategies with real market data, no real orders
GET /api/bots- List all botsPOST /api/bots- Create new botGET /api/bots/{id}- Get bot detailsPUT /api/bots/{id}- Update bot configDELETE /api/bots/{id}- Delete botPOST /api/bots/{id}/start- Start botPOST /api/bots/{id}/pause- Pause botPOST /api/bots/{id}/stop- Stop botPOST /api/bots/{id}/kill- Kill switch for bot
POST /api/kill-all- Global kill switchGET /api/stats- Global statisticsGET /api/pnl- P&L data for chart
GET /api/reports/pnl- P&L reportGET /api/reports/tax- Tax exportGET /api/reports/fees- Fee totals
WS /ws- Real-time updates
# Backend tests
cd backend
pytest
# Frontend tests
cd frontend
npm testThe application uses SQLite for simplicity. The database file is created at backend/tradingbot.db.
To reset the database:
rm backend/tradingbot.db
# Restart the backend server- Keep your
config/exchanges.yamlfile secure - it contains API keys - Never commit API keys to version control
- Use API keys with minimal permissions (trade-only, no withdrawal)
- Start with dry run mode to test strategies
- Use small budgets initially when going live
Personal use only.
For issues and feature requests, please use the project's issue tracker.