修复实盘顶栏误显示模拟盘会话资金:无交易所余额时显示 —,切模式清缓存。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-04 09:16:45 +08:00
parent e33d289e39
commit 131bb36930
5 changed files with 65 additions and 6 deletions
+6
View File
@@ -92,6 +92,12 @@ def install_sim_trading(app: Flask, repo_root: str, app_module: Any = None) -> N
saved = set_trading_mode(get_db, mode)
except ValueError as e:
return jsonify({"ok": False, "msg": str(e)}), 400
try:
from app import invalidate_account_balance_cache
invalidate_account_balance_cache()
except Exception:
pass
return jsonify({"ok": True, "mode": saved, **_status_payload()})
@app.route("/api/sim/reset", methods=["POST"])