feat(frontend): P2全平台聚宽级复刻—模拟盘/因子/回测表单页重做+模拟盘列表页

模拟盘模块:
- 新增模拟盘列表页(List.vue):统计行+富表格(名称/模式/频率/收益/最新净值/状态/操作)+搜索筛选
- 后端加 GET /paper 列表端点(类比 GET /task,带最新净值+收益率)
- paper/New 分区富表单(卡式模式选择+频率+撮合时点说明)
- paper/Result 重做(收益/年化/回撤/夏普/波动指标卡+净值曲线+归因表+成交明细,净值客户端算指标)

因子模块:
- factor/Result 重做(最优ICIR/平均IC/显著数指标卡+彩色IC表+tears报告tab化)
- factor/New 重做(因子按类分组多选+标的批量+实时计数)

回测模块:
- backtest/Progress 重做(步骤时间线+进度条+实时日志尾3s刷新)
- backtest/New 重做(策略/参数/标的区间/基准分区富表单)
- backtest/Optimize 重做(结果列头可排序+Top1高亮+按收益默认降序)
- History 迁移scoped chip→全局chips.css(DRY清理)

全局:深色主题统一,复用 tokens.css + chips.css
This commit is contained in:
2026-07-11 21:10:27 +08:00
parent e0d32c0d1a
commit 41a788c431
14 changed files with 963 additions and 296 deletions
+28
View File
@@ -80,6 +80,34 @@ def create_paper(req: PaperCreateRequest):
return {"account_id": aid, "status": status}
@router.get("/paper", dependencies=[Depends(verify_token)])
def list_papers():
"""模拟盘列表(启用聚宽级模拟交易列表页)。每行带最新净值 + 收益率。"""
from sanguo_trader.persistence import load_last_balance
db = _db_path["path"]
with sqlite3.connect(db) as conn:
conn.row_factory = sqlite3.Row
rows = conn.execute(
"SELECT * FROM paper_accounts ORDER BY id DESC"
).fetchall()
out = []
for r in rows:
item = dict(r)
cap = item.get("initial_capital") or 0
last = load_last_balance(db, item["id"])
if last and cap:
item["latest_equity"] = last.get("total_equity")
item["latest_date"] = last.get("date")
item["total_return"] = (last.get("total_equity", 0) - cap) / cap
else:
item["latest_equity"] = None
item["latest_date"] = None
item["total_return"] = None
out.append(item)
return {"accounts": out}
@router.get("/paper/{aid}", dependencies=[Depends(verify_token)])
def get_paper(aid: int):
db = _db_path["path"]