feat: hub setting to hide account balances and PnL in monitor

Persist show_account_pnl in hub_settings.json; refine key monitor panel layout with right-aligned live stats and scrollable history (max 8 rows).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-11 10:15:57 +08:00
parent b671c05b1b
commit a45a3b18e2
6 changed files with 134 additions and 20 deletions
+18 -1
View File
@@ -9,6 +9,10 @@ from pathlib import Path
DIR = Path(__file__).resolve().parent
SETTINGS_PATH = DIR / "hub_settings.json"
DEFAULT_DISPLAY = {
"show_account_pnl": True,
}
DEFAULT_EXCHANGES = [
{
"id": "0",
@@ -65,8 +69,20 @@ def env_force_disabled_ids() -> set[str]:
return _ids_from_csv(raw)
def normalize_display_prefs(raw: dict | None) -> dict:
out = dict(DEFAULT_DISPLAY)
if isinstance(raw, dict):
if "show_account_pnl" in raw:
out["show_account_pnl"] = bool(raw.get("show_account_pnl"))
return out
def load_settings() -> dict:
data = {"exchanges": [dict(x) for x in DEFAULT_EXCHANGES], "version": 1}
data = {
"exchanges": [dict(x) for x in DEFAULT_EXCHANGES],
"version": 1,
"display": dict(DEFAULT_DISPLAY),
}
if SETTINGS_PATH.is_file():
try:
loaded = json.loads(SETTINGS_PATH.read_text(encoding="utf-8"))
@@ -74,6 +90,7 @@ def load_settings() -> dict:
data = loaded
except Exception:
pass
data["display"] = normalize_display_prefs(data.get("display"))
force_off = env_force_disabled_ids()
for ex in data.get("exchanges") or []:
if str(ex.get("id")) in force_off: