File size: 2,252 Bytes
590a501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 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)