| # Personal Trading System V1 |
|
|
| A personal futures trading system with quantitative strategy support, built with Python (FastAPI) backend and Vue 3 frontend. |
|
|
| ## Features |
|
|
| - **Market Data Simulation**: 12 futures contracts with realistic price movements |
| - **Order Management**: Market / Limit / Stop orders |
| - **Position Tracking**: Real-time P&L and margin calculation |
| - **Quantitative Strategies**: MA Crossover, Bollinger Bands, Dual Thrust |
| - **Risk Management**: Position limits, risk usage monitoring |
| - **Real-time Updates**: WebSocket streaming for live market data |
| - **Dark Theme UI**: Modern dashboard with ECharts candlestick charts |
|
|
| ## Quick Start |
|
|
| ### Backend |
|
|
| ```bash |
| cd backend |
| pip install -r requirements.txt |
| uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload |
| ``` |
|
|
| ### Frontend |
|
|
| ```bash |
| cd frontend |
| npm install |
| npm run dev |
| ``` |
|
|
| Open http://localhost:5173 in your browser. |
|
|
| ## Unified Platform (with ML-Alpha-Research-System) |
|
|
| This folder is integrated into the parent repo as the **web visualization + online launcher** layer. |
|
|
| ### One-command launch (from repo root) |
|
|
| ```bash |
| python scripts/launch_platform.py --enable-research |
| # or start all embedded modules after backend is up: |
| python scripts/launch_platform.py --start-all-modules |
| ``` |
|
|
| ### Service control panel |
|
|
| - **Web UI**: http://localhost:5173/services — start/stop modules by feature |
| - **API**: `GET/POST /api/platform/services/*` |
|
|
| | Module ID | Description | |
| |-----------|-------------| |
| | `trading_api` | FastAPI backend (always running with uvicorn) | |
| | `market_data` | Simulated futures WebSocket + K-lines | |
| | `futures_strategies` | MA / Bollinger / DualThrust engine | |
| | `qlib_research` | Factor registry, operator builder, A-share strategies | |
| | `frontend_ui` | Vue dev server (optional subprocess launch) | |
|
|
| ### Factor research bridge |
|
|
| After starting `qlib_research`, use: |
|
|
| - **Web UI**: http://localhost:5173/research |
| - **API**: `/api/research/factors`, `/operators`, `/strategies` |
|
|
|
|
| ```bash |
| cd backend |
| python3 -m pytest tests/ -v # 17 tests |
| ruff check app/ tests/ # linter |
| ``` |
|
|
| ## Tech Stack |
|
|
| - **Backend**: Python 3.12, FastAPI, SQLAlchemy, NumPy, Pandas |
| - **Frontend**: Vue 3, Element Plus, ECharts, Pinia, Vue Router |
| - **Database**: SQLite (async) |
|
|