TCPDashboard/README.md
2025-05-29 23:04:08 +08:00

121 lines
3.6 KiB
Markdown

# Crypto Trading Bot Dashboard
A simple control dashboard for managing and monitoring multiple cryptocurrency trading bots simultaneously. Test different trading strategies in parallel using real OKX market data and virtual trading simulation.
## Features
- **Multi-Bot Management**: Run up to 5 trading bots simultaneously with different strategies
- **Real-time Monitoring**: Live price charts with bot buy/sell decision markers
- **Performance Tracking**: Monitor virtual balance, P&L, trade count, and timing for each bot
- **Backtesting**: Test strategies on historical data with accelerated execution
- **Simple Configuration**: JSON-based bot configuration files
- **Hot Reloading**: System remembers active bots and restores state on restart
## Tech Stack
- **Backend**: Python with existing OKX, strategy, and trader modules
- **Frontend**: Plotly Dash for rapid development
- **Database**: PostgreSQL with SQLAlchemy ORM
- **Package Management**: UV
- **Development**: Docker for consistent environment
## Quick Start
### Prerequisites
- Python 3.10+
- Docker and Docker Compose
- UV package manager
### Development Setup
1. **Clone the repository**
```bash
git clone <repository-url>
cd Dashboard
```
2. **Install dependencies**
```bash
uv sync
```
3. **Start development environment**
```bash
docker-compose up -d # Start PostgreSQL
```
4. **Run the application**
```bash
uv run python main.py
```
5. **Access the dashboard**
Open your browser to `http://localhost:8050`
## Project Structure
```
Dashboard/
├── app.py # Main Dash application
├── bot_manager.py # Bot lifecycle management
├── database/
│ ├── models.py # SQLAlchemy models
│ └── connection.py # Database connection
├── data/
│ └── okx_integration.py # OKX API integration
├── components/
│ ├── dashboard.py # Dashboard components
│ └── charts.py # Chart components
├── backtesting/
│ └── engine.py # Backtesting framework
├── config/
│ └── bot_configs/ # Bot configuration files
├── strategies/ # Trading strategy modules
├── trader/ # Virtual trading logic
└── docs/ # Project documentation
```
## Documentation
- **[Product Requirements](tasks/prd-crypto-bot-dashboard.md)** - Detailed project requirements and specifications
- **[Implementation Tasks](tasks/tasks-prd-crypto-bot-dashboard.md)** - Step-by-step development task list
- **[API Documentation](docs/)** - Module and API documentation
## Bot Configuration
Create bot configuration files in `config/bot_configs/`:
```json
{
"bot_id": "ema_crossover_01",
"strategy": "EMA_Crossover",
"parameters": {
"fast_period": 12,
"slow_period": 26,
"symbol": "BTC-USDT"
},
"virtual_balance": 10000
}
```
## Development Status
This project is in active development. See the [task list](tasks/tasks-prd-crypto-bot-dashboard.md) for current implementation progress.
### Current Phase: Setup and Infrastructure
- [ ] Development environment setup
- [ ] Database schema design
- [ ] Basic bot management system
- [ ] OKX integration
- [ ] Dashboard UI implementation
- [ ] Backtesting framework
## Contributing
1. Check the [task list](tasks/tasks-prd-crypto-bot-dashboard.md) for available tasks
2. Follow the project's coding standards and architectural patterns
3. Use UV for package management
4. Write tests for new functionality
5. Update documentation when adding features