From 424463a6ace526da6dbcafea842a140954509b29 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Sun, 16 Aug 2026 11:00:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(paper):=20=E5=BD=B1=E5=AD=90=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E5=81=9C=E6=AD=A2/=E6=81=A2=E5=A4=8D400=E2=80=94?= =?UTF-8?q?=E2=80=94stop/resume=E5=8E=9F=E5=8F=AA=E6=94=BE=E8=A1=8Cmode=3D?= =?UTF-8?q?live,#10/#11=E5=BD=B1=E5=AD=90=E8=B4=A6=E6=88=B7=E7=82=B9?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E5=8D=B3400=E3=80=8C=E4=BB=85=E5=AE=9E?= =?UTF-8?q?=E8=B5=B0=E8=B4=A6=E6=88=B7=E6=94=AF=E6=8C=81=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E3=80=8D;=E6=94=BE=E8=A1=8Clive+shadow(=E7=BD=AEstatus=3Dstopp?= =?UTF-8?q?ed=E5=90=8E=E6=97=A5=E7=BB=88step=E4=B8=8E=E5=BD=B1=E5=AD=90?= =?UTF-8?q?=E6=9F=9C=E5=8F=B0=E9=83=BD=E5=8F=AA=E9=80=89running=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=B7=B3=E8=BF=87,=E8=AF=AD=E4=B9=89=E6=88=90?= =?UTF-8?q?=E7=AB=8B);=E5=9B=9E=E6=94=BE=E4=BB=8D=E6=8B=92(=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E6=80=A7=E4=BB=BB=E5=8A=A1);API=20128=E7=BB=BF=20[vps?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanguo_api/routes_paper.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sanguo_api/routes_paper.py b/sanguo_api/routes_paper.py index a5c4d1a..ab2393a 100644 --- a/sanguo_api/routes_paper.py +++ b/sanguo_api/routes_paper.py @@ -377,26 +377,26 @@ def _get_account_row(db, aid: int) -> dict: @router.post("/paper/{aid}/stop", dependencies=[Depends(verify_token)]) def stop_paper(aid: int): - """停止实走:置 status=stopped,每日 20:30 全局 step 只选 running → 自动跳过。""" + """停止实走/影子:置 status=stopped,日终 step 与影子柜台都只选 running → 自动跳过。""" from sanguo_trader.persistence import update_account_status db = _db_path["path"] acc = _get_account_row(db, aid) - if acc.get("mode") != "live": - raise HTTPException(400, "仅实走(live)账户支持停止;回放账户为一次性任务") + if acc.get("mode") not in ("live", "shadow"): + raise HTTPException(400, "仅实走/影子账户支持停止;回放账户为一次性任务") update_account_status(db, aid, "stopped") return {"account_id": aid, "status": "stopped"} @router.post("/paper/{aid}/resume", dependencies=[Depends(verify_token)]) def resume_paper(aid: int): - """恢复实走:次日 20:30 起继续 step。""" + """恢复实走/影子:次日 20:30 起继续 step / 影子柜台继续接管。""" from sanguo_trader.persistence import update_account_status db = _db_path["path"] acc = _get_account_row(db, aid) - if acc.get("mode") != "live": - raise HTTPException(400, "仅实走(live)账户支持恢复") + if acc.get("mode") not in ("live", "shadow"): + raise HTTPException(400, "仅实走/影子账户支持恢复") update_account_status(db, aid, "running") return {"account_id": aid, "status": "running"}