A comprehensive monitoring solution for cryptocurrency trading bots using Grafana, Prometheus, Freqtrade, and Supabase. This stack provides real-time visualization, metrics collection, and historical analysis for professional cryptocurrency trading operations.
- Real-time Bot Monitoring: Live dashboards showing trading performance, open trades, and system health
- Multi-Bot Support: Monitor multiple Freqtrade instances from a single dashboard
- Historical Analysis: Long-term data retention and trend analysis
- Alert Management: Configurable alerts for critical trading events
- Docker Containerized: Easy deployment with Docker Compose
- Mock Mode: Demo mode with simulated trading data for testing
- Bot Status: Real-time up/down status monitoring
- Open Trades: Current number of active positions
- Current Balance: Available trading capital
- Profit/Loss Tracking: Cumulative and period-based P&L
- Win Rate: Success percentage of completed trades
- API Response Times: Bot performance metrics
- Cache Statistics: Efficiency of data collection
- Log Activity: System activity and error tracking
- Lock Count: Trading restriction monitoring
- Docker Desktop installed and running
- At least 4GB RAM and 20GB disk space
- Basic understanding of Docker and cryptocurrency trading
git clone https://github.com/yourusername/freqtrade-monitoring-stack.git
cd freqtrade-monitoring-stack
# Start trading bot monitoring
./deploy.sh install
# Start with multiple bot support
./deploy.sh --profile multi-bot install
# Start with crypto market dashboard
./deploy.sh --profile crypto-tracker install
# Start all services (trading + crypto tracking)
./deploy.sh --profile multi-bot install
./deploy.sh --profile crypto-tracker start
docker-compose ps
### 3. Access Dashboards
#### Freqtrade Monitoring
- **Grafana Dashboard**: http://localhost:3000
- Username: `admin`
- Password: `freqtrade2024!`
- **Prometheus Metrics**: http://localhost:9090
- **Trading Dashboard**: http://localhost:3000/d/freqtrade-trading-overview
#### Cryptocurrency Market Tracking (if crypto-tracker profile is used)
- **Crypto Grafana**: http://localhost:3001
- Username: `admin`
- Password: `crypto2024!`
- **Crypto Dashboard**: http://localhost:3001/d/crypto-overview
- **Crypto Prometheus**: http://localhost:9091
- **CoinMarketCap Data**: http://localhost:9101/metrics
## ๐ Project Structure
freqtrade-monitoring-stack/ โโโ docker-compose.yml # Main orchestration file โโโ deploy.sh # Main deployment script โโโ scripts/ # Management scripts โ โโโ config-manager.sh # Configuration wizard โ โโโ maintenance.sh # System maintenance โโโ prometheus/ โ โโโ prometheus.yml # Metrics collection config โโโ grafana/ โ โโโ provisioning/ # Auto-provisioning configs โ โ โโโ datasources/ # Prometheus datasource โ โ โโโ dashboards/ # Dashboard provisioning โ โโโ dashboards/ # Dashboard JSON files โโโ crypto-tracker/ # Cryptocurrency monitoring stack โ โโโ prometheus/ # Crypto-specific Prometheus config โ โโโ grafana/ โ โ โโโ provisioning/ # Crypto dashboard provisioning โ โ โโโ dashboards/ # Crypto-specific dashboards โ โโโ README.md # Crypto tracker documentation โโโ freqtrade/ โ โโโ user_data/ # Bot configurations and strategies โ โโโ config_*.json # Trading bot configs โ โโโ strategies/ # Trading strategies โโโ supabase/ # Database migrations and functions โโโ mock-ftmetric.py # Demo metrics generator โโโ CLAUDE.md # AI assistant guidance โโโ implementation.md # Detailed setup guide
## ๐ณ Services
### Freqtrade Monitoring Stack (Default)
| Service | Port | Description |
|---------|------|-------------|
| **Grafana** | 3000 | Trading visualization dashboards |
| **Prometheus** | 9090 | Trading metrics collection and storage |
| **Freqtrade Bot** | 8081 | Trading bot API (localhost only) |
| **FTMetric Exporter** | 8091 | Metrics exporter for Prometheus |
### Cryptocurrency Tracker Stack (Optional)
| Service | Port | Description |
|---------|------|-------------|
| **Crypto Grafana** | 3001 | Cryptocurrency market dashboards |
| **Crypto Prometheus** | 9091 | Crypto metrics collection and storage |
| **CoinMarketCap Exporter** | 9101 | Real-time crypto price data exporter |
## ๐ง Configuration
### Environment Variables
Create a `.env` file for production deployments:
```bash
# Grafana
GF_SECURITY_ADMIN_PASSWORD=your-secure-password
# Freqtrade API
FREQTRADE_USERNAME=your-username
FREQTRADE_PASSWORD=your-password
# Supabase (optional)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# Exchange API (for live trading)
EXCHANGE_API_KEY=your-exchange-api-key
EXCHANGE_SECRET_KEY=your-exchange-secret-key
To monitor multiple bots, use the multi-bot profile:
# Start with multiple bot instances
docker-compose --profile multi-bot up -d
The main dashboard provides:
- Status Panels: Quick overview of bot health and performance
- Time Series Graphs: Historical trends and patterns
- Real-time Updates: Auto-refresh every 30 seconds
- Interactive Filters: Filter by bot, timeframe, and strategy
Add your own dashboards by:
- Creating JSON files in
grafana/dashboards/
- Restarting Grafana:
docker-compose restart grafana
- Dashboards auto-load via provisioning
- Bot Down: Triggered when bot is unreachable for >30 seconds
- High Loss: Activated when losses exceed 5% in 1 hour
- System Resources: Memory/CPU usage above 85%
- API Failures: High error rates from exchange APIs
Configure additional alerts in prometheus/rules/
directory.
The stack includes a mock metrics generator for testing:
- Simulates realistic trading data
- Randomized but consistent metrics
- No external dependencies required
- Perfect for demonstrations and development
- Change default passwords in
.env
file - Use HTTPS with reverse proxy (Traefik/Nginx)
- Implement API authentication
- Restrict network access to internal services
- Regular security updates for all components
- Monitoring Network: External access to dashboards
- Trading Network: Internal bot communication
- Isolated Services: Bots run on private network
- Implementation Guide - Step-by-step setup instructions
- Architecture Overview - System design and components
- API Reference - Prometheus metrics and endpoints
- Troubleshooting - Common issues and solutions
# Start development environment
docker-compose -f docker-compose.dev.yml up -d
# View logs
docker-compose logs -f
# Rebuild after changes
docker-compose up -d --build
- Extend
mock-ftmetric.py
for development - Add new panels to dashboard JSON
- Update Prometheus scrape configs
- Test with mock data before production
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
# Clone your fork
git clone https://github.com/yourusername/freqtrade-monitoring-stack.git
cd freqtrade-monitoring-stack
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Start development stack
docker-compose -f docker-compose.dev.yml up -d
Component | Minimum | Recommended |
---|---|---|
CPU | 2 cores | 4 cores |
RAM | 4GB | 8GB |
Storage | 20GB | 50GB |
Network | 10 Mbps | 100 Mbps |
- Single Bot: Default configuration
- 2-5 Bots: Add more Prometheus targets
- 5+ Bots: Consider Prometheus federation
- High Volume: Use VictoriaMetrics for better performance
# Check service status
docker-compose ps
# Verify metrics endpoint
curl http://localhost:8091/metrics
# Check Prometheus targets
curl http://localhost:9090/api/v1/targets
# Check bot logs
docker-compose logs freqtrade-bot1
# Verify API credentials
curl -u username:password http://localhost:8081/api/v1/status
# Monitor resource usage
docker stats
# Check Prometheus query performance
curl http://localhost:9090/api/v1/query?query=up
This project is licensed under the MIT License - see the LICENSE file for details.
- Freqtrade Community for the excellent trading bot framework
- Grafana Labs for the visualization platform
- Prometheus for metrics collection
- Supabase for the real-time database
- Documentation: Check the docs directory
- Issues: Report bugs via GitHub Issues
- Discussions: Join GitHub Discussions
- Community: Discord Server for real-time help
Made with โค๏ธ by the Freqtrade Monitoring Community