4.4 KiB
4.4 KiB
Relevant Files
app.py- Main Dash application entry point and layout definitionbot_manager.py- Core bot lifecycle management and orchestrationdatabase/models.py- SQLAlchemy models for bots, trades, and market datadatabase/connection.py- Database connection and session managementdata/okx_integration.py- OKX API connection and real-time data feedstrategies/- Directory containing strategy modules (existing, may need refactoring)trader/- Directory containing virtual trading logic (existing, may need refactoring)components/dashboard.py- Dash dashboard components and layoutcomponents/charts.py- Plotly chart components for price and performance visualizationbacktesting/engine.py- Backtesting execution engineconfig/bot_configs/- Directory for JSON bot configuration filesutils/logging.py- Logging configuration and utilitiesrequirements.txt- Python dependencies using UV package manager
Notes
- Use docker for development and database
- Use UV for package management as specified in project requirements
- PostgreSQL with SQLAlchemy for database persistence
- Plotly Dash for rapid UI development
- Bot configurations stored as JSON files in config directory
- System should support hot-reloading of bot states
Tasks
-
0.0 Dev environment and Docker setup
- 0.1 Create Docker Compose file with PostgreSQL service
- 0.2 Set up UV package management with pyproject.toml dependencies
- 0.3 Create .env file template for database and API configuration
- 0.4 Add development scripts for starting/stopping services
- 0.5 Test database connection and basic container orchestration
-
1.0 Database Infrastructure Setup
- 1.1 Design PostgreSQL schema for bots, trades, market_data, and bot_states tables
- 1.2 Create SQLAlchemy models in
database/models.pyfor all entities - 1.3 Implement database connection management in
database/connection.py - 1.4 Create Alembic migration scripts for initial schema
- 1.5 Add database utility functions for common queries
- 1.6 Implement bot state persistence for hot-reloading capability
-
2.0 Bot Management System Development
- 2.1 Create
bot_manager.pywith BotManager class for lifecycle control - 2.2 Implement bot configuration loading from JSON files in
config/bot_configs/ - 2.3 Add start/stop functionality for individual bots using threading/multiprocessing
- 2.4 Create bot status tracking and monitoring system
- 2.5 Implement error handling and automatic bot restart on crash
- 2.6 Add bot state persistence to database for system restart recovery
- 2.7 Create unified signal processing interface for strategy integration
- 2.1 Create
-
3.0 OKX Integration and Data Pipeline
- 3.1 Create
data/okx_integration.pywith OKX API client - 3.2 Implement real-time WebSocket connection for market data
- 3.3 Add market data normalization and validation
- 3.4 Create data storage pipeline to PostgreSQL with proper indexing
- 3.5 Implement data feed monitoring and reconnection logic
- 3.6 Add historical data retrieval for backtesting
- 3.7 Test data pipeline with multiple cryptocurrency pairs
- 3.1 Create
-
4.0 Dashboard UI and Visualization
- 4.1 Set up basic Dash application structure in
app.py - 4.2 Create dashboard layout with bot controls and chart areas
- 4.3 Implement bot control panel in
components/dashboard.py - 4.4 Build candlestick charts with buy/sell markers in
components/charts.py - 4.5 Add performance metrics display for each bot (balance, P&L, trade count, trade time)
- 4.6 Implement bot switching functionality for chart views
- 4.7 Add real-time data updates with 2-second refresh cycle
- 4.8 Create responsive layout that works on different screen sizes
- 4.1 Set up basic Dash application structure in
-
5.0 Backtesting System Implementation
- 5.1 Create
backtesting/engine.pywith backtesting framework - 5.2 Implement historical data loading and time range selection
- 5.3 Add accelerated testing capability (faster than real-time)
- 5.4 Create backtesting results storage and comparison system
- 5.5 Integrate backtesting with dashboard for result visualization
- 5.6 Add date range picker component for backtest periods
- 5.7 Test backtesting with sample strategies on 1+ week datasets
- 5.1 Create