fix(paper): 影子账户停止/恢复400——stop/resume原只放行mode=live,#10/#11影子账户点停止即400「仅实走账户支持停止」;放行live+shadow(置status=stopped后日终step与影子柜台都只选running自动跳过,语义成立);回放仍拒(一次性任务);API 128绿 [vps]
This commit is contained in:
@@ -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"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user