feat(web): 对账中心上线——恒等式B5只读端点+前端恒等式区块,双轨对账页升级为对账中心(issue#42-A) [nas]
- API: GET /paper/reconcile/identity?date&refresh——缺省读 supervisor 15:10/23:27
已存 identity_reconcile 行,无存行现算并落库(与 build/save 同套幂等);
路由置于 /paper/{aid} 前,与既有 reconcile 端点同组
- 前端: Reconcile.vue 顶部新增恒等式卡片(账户级红绿/未归因±/占比vs容忍0.5%/
可展开逐票缺口+实例市值拆分),页面与菜单更名为「对账中心」;
api/paper.ts 补 IdentityReport 类型族
- 测试: 绿线(50/10050=0.497%pass)+存行复用+refresh强制重算(200=1.96%红)+
snapshot_missing 如实标注,12/12 绿
- 附: docs/session_prompts/ 两份 session 移交提示词入库(fundamentals 18min→
数据session / 统一ex定寸→策略session,用户08-26拍板)
This commit is contained in:
@@ -308,6 +308,31 @@ def get_reconcile(live_id: int, shadow_id: int, date: str | None = None,
|
||||
return report
|
||||
|
||||
|
||||
@router.get("/paper/reconcile/identity", dependencies=[Depends(verify_token)])
|
||||
def get_identity_reconcile(date: str | None = None, refresh: bool = False):
|
||||
"""账户恒等式报告(B5):全账户市值 = Σ实例账本市值 + 未归因(容忍 ≤0.5%)。
|
||||
|
||||
缺省读 shadow_supervisor 15:10/23:27 已存行;无存行(当日未跑或 refresh=true)
|
||||
按当前库现算并落库——与 supervisor 同一套 build/save,同日幂等覆盖。
|
||||
"""
|
||||
from datetime import datetime as _dt
|
||||
|
||||
from sanguo_trader.shadow.reconcile_report import (
|
||||
build_identity_report, load_identity_report, save_identity_report,
|
||||
)
|
||||
|
||||
d = date or _dt.now().strftime("%Y-%m-%d")
|
||||
db = _db_path["path"]
|
||||
rows = [] if refresh else load_identity_report(db, d)
|
||||
if rows:
|
||||
passed = bool(rows) and all(
|
||||
r.get("status") in ("pass", "no_instances") for r in rows)
|
||||
return {"date": d, "rows": rows, "identity_passed": passed}
|
||||
report = build_identity_report(db, d)
|
||||
save_identity_report(db, report)
|
||||
return report
|
||||
|
||||
|
||||
@router.get("/paper/{aid}", dependencies=[Depends(verify_token)])
|
||||
def get_paper(aid: int):
|
||||
db = _db_path["path"]
|
||||
|
||||
Reference in New Issue
Block a user