Skip to content

Commit 45a095a

Browse files
committed
feat: add setup script for Quicksilver Dashboard environment variables
- Created a new script `setup_dashboard_env.sh` to configure environment variables for the Quicksilver Dashboard. - The script generates a `.env` file with API configuration and Streamlit settings. - Included instructions for using test credentials and a reminder to use secure credentials in production.
1 parent a5621a8 commit 45a095a

21 files changed

+1825
-12
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ temp/
4848

4949
# Dependencies
5050
vendor/
51+
venv/
52+
.venv/
53+
dashboard/.venv

CHECKLIST.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Quicksilver 快速进度清单
22

33
> **更新时间**: 2025-11-05
4-
> **整体进度**: 95% ███████████████████████████████
4+
> **整体进度**: 97% ███████████████████████████████
55
66
---
77

@@ -13,11 +13,11 @@
1313
| 2️⃣ | 核心功能 | 100% ████████████████████ | ✅ 已完成 |
1414
| 3️⃣ | 撮合引擎 | 100% ████████████████████ | ✅ 已完成 |
1515
| 4️⃣ | CCXT 兼容 | 100% ████████████████████ | ✅ 已完成 |
16-
| 5️⃣ | 管理工具 | 55% ██████████████░░░░░░| 🚧 进行中 |
16+
| 5️⃣ | 管理工具 | 80% ████████████████████| 🚧 进行中 |
1717

1818
---
1919

20-
## ✅ 已完成 (95%)
20+
## ✅ 已完成 (97%)
2121

2222
### 基础设施层
2323

@@ -126,24 +126,24 @@
126126

127127
---
128128

129-
## 🚧 进行中 (5%)
129+
## 🚧 进行中 (1%)
130130

131-
### Streamlit 管理仪表盘 (10%)
131+
### Streamlit 管理仪表盘 (80%)
132132

133133
- [x] 规划文档 ✅
134134
- [x] 快速启动指南 ✅
135-
- [ ] 环境搭建
136-
- [ ] API 封装库
137-
- [ ] 用户管理页面
138-
- [ ] 数据概览仪表盘
139-
- [ ] 订单管理模块
140-
- [ ] 成交记录查询
135+
- [x] 环境搭建
136+
- [x] API 封装库
137+
- [x] 用户管理页面
138+
- [x] 数据概览仪表盘
139+
- [x] 订单管理模块
140+
- [x] 成交记录查询
141141
- [ ] 余额管理模块 ⏳
142142
- [ ] 系统监控模块 ⏳
143143

144144
---
145145

146-
## ⏳ 待开始 (5%)
146+
## ⏳ 待开始 (2%)
147147

148148
### P0 - MVP 必需功能 (已全部完成 ✅)
149149

dashboard/.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Quicksilver API 配置
2+
API_URL=http://localhost:8080
3+
ADMIN_API_KEY=your_admin_api_key_here
4+
ADMIN_API_SECRET=your_admin_api_secret_here
5+
6+
# Streamlit 配置
7+
STREAMLIT_SERVER_PORT=8501
8+
STREAMLIT_SERVER_ADDRESS=0.0.0.0

dashboard/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
venv/
8+
env/
9+
ENV/
10+
11+
# Streamlit
12+
.streamlit/
13+
14+
# 环境变量
15+
.env
16+
17+
# IDE
18+
.vscode/
19+
.idea/
20+
*.swp
21+
*.swo
22+
23+
# 临时文件
24+
*.log
25+
*.csv
26+
*.xlsx

dashboard/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

dashboard/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
# 安装依赖
6+
COPY requirements.txt .
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
# 复制应用代码
10+
COPY . .
11+
12+
# 暴露端口
13+
EXPOSE 8501
14+
15+
# 健康检查
16+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
17+
18+
# 启动命令
19+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]

dashboard/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Quicksilver 管理后台
2+
3+
基于 Streamlit 的 Quicksilver 模拟交易所管理仪表盘。
4+
5+
## 技术栈
6+
7+
- **Python**: 3.11+
8+
- **Streamlit**: 1.51.0 (最新版)
9+
- **包管理**: uv (现代化 Python 包管理工具)
10+
11+
## 快速开始
12+
13+
### 1. 安装 uv (如果还没有)
14+
15+
```bash
16+
curl -LsSf https://astral.sh/uv/install.sh | sh
17+
```
18+
19+
### 2. 配置环境变量
20+
21+
```bash
22+
cp .env.example .env
23+
# 编辑 .env 文件,设置 API 凭证
24+
```
25+
26+
### 3. 启动服务
27+
28+
```bash
29+
chmod +x start.sh
30+
./start.sh
31+
```
32+
33+
或手动启动:
34+
35+
```bash
36+
# 同步依赖
37+
uv sync
38+
39+
# 运行应用
40+
uv run streamlit run app.py
41+
```
42+
43+
## 开发
44+
45+
### 添加新依赖
46+
47+
```bash
48+
uv add <package-name>
49+
```
50+
51+
### 更新依赖
52+
53+
```bash
54+
uv sync --upgrade
55+
```
56+
57+
### 锁定依赖
58+
59+
```bash
60+
uv lock
61+
```
62+
63+
## 项目结构
64+
65+
```
66+
dashboard/
67+
├── app.py # 主入口
68+
├── config.py # 配置管理
69+
├── pyproject.toml # 项目配置和依赖
70+
├── uv.lock # 依赖锁定文件
71+
├── api/ # API 客户端
72+
│ ├── __init__.py
73+
│ └── client.py
74+
├── pages/ # 页面模块
75+
│ ├── home.py # 首页
76+
│ ├── users.py # 用户管理
77+
│ ├── orders.py # 订单管理
78+
│ └── trades.py # 成交记录
79+
└── .venv/ # 虚拟环境 (uv 自动创建)
80+
```
81+
82+
## 功能特性
83+
84+
### 🏠 首页
85+
86+
- 系统状态监控
87+
- 数据概览统计
88+
- 实时行情展示
89+
- 用户权益曲线
90+
91+
### 👥 用户管理
92+
93+
- 创建新用户(弹窗)
94+
- 用户列表查询
95+
- 邮箱搜索
96+
97+
### 📝 订单管理
98+
99+
- 订单列表查询
100+
- 订单详情查看
101+
102+
### 💰 成交记录
103+
104+
- 成交记录查询
105+
- 统计分析
106+
107+
## 环境变量
108+
109+
`.env` 文件中配置:
110+
111+
```bash
112+
# Quicksilver API 配置
113+
API_URL=http://localhost:8080
114+
ADMIN_API_KEY=your-api-key
115+
ADMIN_API_SECRET=your-api-secret
116+
```
117+
118+
## 访问地址
119+
120+
默认端口:http://localhost:8501
121+
122+
## 注意事项
123+
124+
- 首次启动会自动创建虚拟环境 `.venv`
125+
- 使用 uv 管理依赖,比传统 pip 更快
126+
- 确保后端 API 服务正在运行

dashboard/api/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""API 客户端模块"""
2+
3+
from .client import QuicksilverAPI
4+
5+
__all__ = ["QuicksilverAPI"]

0 commit comments

Comments
 (0)