- Updated `docker-compose.yml` to remove hardcoded passwords, relying on environment variables for PostgreSQL and Redis configurations. - Modified `env.template` to reflect new password settings and ensure secure handling of sensitive information. - Introduced a new `database/connection.py` file for improved database connection management, including connection pooling and session handling. - Updated `database/models.py` to align with the new schema in `schema_clean.sql`, utilizing JSONB for optimized data storage. - Enhanced `setup.md` documentation to clarify the initialization process and emphasize the importance of the `.env` file for configuration. - Added a new `scripts/init_database.py` script for automated database initialization and verification, ensuring all tables are created as expected.
Crypto Trading Bot Platform
A simplified crypto trading bot platform for strategy testing and development. Test multiple trading strategies in parallel using real OKX market data with virtual trading simulation.
Overview
This platform enables rapid strategy testing within 1-2 weeks of development. Built with a monolithic architecture for simplicity, it supports 5-10 concurrent trading bots with real-time monitoring and performance tracking.
Key Features
- Multi-Bot Management: Run 5-10 trading bots simultaneously with different strategies
- Real-time Monitoring: Live OHLCV charts with bot trading signals overlay
- Virtual Trading: Simulation-first approach with realistic fee modeling
- JSON Configuration: Easy strategy parameter testing without code changes
- Backtesting Engine: Test strategies on historical market data
- Crash Recovery: Automatic bot restart and state restoration
Tech Stack
- Framework: Python 3.10+ with Dash (unified frontend/backend)
- Database: PostgreSQL with optimized OHLCV data storage
- Real-time: Redis pub/sub for live updates
- Package Management: UV
- Development: Docker for consistent environment
Quick Start
Prerequisites
- Python 3.10+, Docker, UV package manager
Setup
📖 For detailed setup instructions, see docs/setup.md
Quick setup:
python scripts/dev.py setup # Setup environment
python scripts/dev.py start # Start services
python scripts/dev.py dev-server # Start with hot reload
Project Structure
├── app.py # Main Dash application
├── bot_manager.py # Bot lifecycle management
├── database/ # PostgreSQL models and connection
├── data/ # OKX API integration
├── components/ # Dashboard UI components
├── strategies/ # Trading strategy modules
├── config/bot_configs/ # JSON bot configurations
└── docs/ # Project documentation
Documentation
- Setup Guide - Complete setup instructions for new machines
- Product Requirements - Complete system specifications and requirements
- Technical Architecture - Implementation details and component design
- Platform Overview - Human-readable system overview
Configuration Example
Bot configurations use simple JSON files for rapid testing:
{
"bot_id": "ema_crossover_01",
"strategy_file": "ema_crossover.json",
"symbol": "BTC-USDT",
"virtual_balance": 10000,
"enabled": true
}
Development Timeline
Target: Functional system within 1-2 weeks
- Phase 1 (Days 1-5): Database, data collection, basic visualization
- Phase 2 (Days 6-10): Bot management, backtesting, trading logic
- Phase 3 (Days 11-14): Testing, optimization, deployment
Contributing
- Review architecture documentation for technical approach
- Check task list for available work
- Follow project coding standards and use UV for dependencies
- Update documentation when adding features
Description
Languages
Python
98.5%
PLpgSQL
1.4%