From 5faedfbfb7ce40459a998be2fca831b6957690a5 Mon Sep 17 00:00:00 2001 From: dekun Date: Wed, 10 Jun 2026 17:23:54 +0800 Subject: [PATCH] feat: collapse fund overview help and bind start day to env Fold the stats description by default and render history_start_day and keep_days from the API so HUB_FUND_HISTORY_START_DAY in .env drives the UI. Co-authored-by: Cursor --- manual_trading_hub/.env.example | 5 +++-- manual_trading_hub/static/app.css | 29 ++++++++++++++++++++++++++++ manual_trading_hub/static/funds.js | 26 +++++++++++++++++++++++-- manual_trading_hub/static/index.html | 11 +++++++---- 4 files changed, 63 insertions(+), 8 deletions(-) diff --git a/manual_trading_hub/.env.example b/manual_trading_hub/.env.example index 03c56f6..9fc1231 100644 --- a/manual_trading_hub/.env.example +++ b/manual_trading_hub/.env.example @@ -99,5 +99,6 @@ AI_MODEL=huihui_ai/deepseek-r1-abliterated:latest TRADING_DAY_RESET_HOUR=8 # 资金概况 / AI 上下文:分户资金快照保留交易日数(默认 180) # HUB_FUND_HISTORY_DAYS=180 -# 资金曲线与回撤统计起始交易日(默认 2026-06-09,该日之前不记、不展示) -# HUB_FUND_HISTORY_START_DAY=2026-06-09 +# 资金概况:曲线与回撤统计起始交易日(页面说明与曲线均读取此项;该日之前不记、不展示) +# 修改后须重启 manual-trading-hub(pm2 restart manual-trading-hub) +HUB_FUND_HISTORY_START_DAY=2026-06-09 diff --git a/manual_trading_hub/static/app.css b/manual_trading_hub/static/app.css index fe510f5..0c4950c 100644 --- a/manual_trading_hub/static/app.css +++ b/manual_trading_hub/static/app.css @@ -4501,9 +4501,38 @@ html[data-theme="light"] .funds-stage { border-color: rgba(0, 212, 255, 0.45); box-shadow: 0 0 18px rgba(0, 212, 255, 0.2); } +.funds-desc-fold { + margin: 4px 0 0; + max-width: 100%; +} +.funds-desc-toggle { + display: inline-flex; + align-items: center; + gap: 6px; + font-size: 0.72rem; + color: var(--accent); + cursor: pointer; + list-style: none; + user-select: none; + letter-spacing: 0.04em; +} +.funds-desc-toggle::-webkit-details-marker { + display: none; +} +.funds-desc-toggle::before { + content: "▸"; + font-size: 0.68rem; + transition: transform 0.15s ease; +} +.funds-desc-fold[open] .funds-desc-toggle::before { + transform: rotate(90deg); +} .funds-desc { + margin: 8px 0 0; color: color-mix(in srgb, var(--muted) 88%, var(--accent)); letter-spacing: 0.02em; + line-height: 1.45; + font-size: 0.78rem; } .funds-live-pill { flex-shrink: 0; diff --git a/manual_trading_hub/static/funds.js b/manual_trading_hub/static/funds.js index 9c66f7a..68a9669 100644 --- a/manual_trading_hub/static/funds.js +++ b/manual_trading_hub/static/funds.js @@ -11,6 +11,8 @@ const elDdPct = document.getElementById("funds-total-dd-pct"); const elDelta = document.getElementById("funds-total-delta"); const elMeta = document.getElementById("funds-meta"); + const elDescBody = document.getElementById("funds-desc-body"); + const elChartSub = document.getElementById("funds-chart-sub"); const elChartHost = document.getElementById("funds-chart-total"); const elAccounts = document.getElementById("funds-accounts"); const elBtnRefresh = document.getElementById("funds-btn-refresh"); @@ -266,7 +268,7 @@ const parts = [ "资金户 + 交易户(不含浮盈)", "交易日 " + (meta.trading_day || "—"), - "自 " + (meta.history_start_day || "2026-06-09") + " 起", + "自 " + (meta.history_start_day || "—") + " 起", ]; elFsSub.textContent = parts.join(" · "); } @@ -319,8 +321,28 @@ } } + function renderDesc(data) { + const start = (data && data.history_start_day) || "—"; + const keep = (data && data.keep_days) || 180; + const hour = data && data.reset_hour != null ? data.reset_hour : 8; + if (elDescBody) { + elDescBody.textContent = + "总资金 = 各监控户(资金账户 + 交易账户);自 " + + start + + " 起按北京时间 " + + hour + + ":00 交易日切日快照,最多保留 " + + keep + + " 天。起算日由环境变量 HUB_FUND_HISTORY_START_DAY 配置。"; + } + if (elChartSub) { + elChartSub.textContent = keep + " TRADING DAYS"; + } + } + function renderOverview(data) { lastOverview = data; + renderDesc(data); const totals = data.totals || {}; const dd = totals.drawdown || {}; if (elTotal) { @@ -339,7 +361,7 @@ const parts = [ "交易日 " + (data.trading_day || "—"), "切日 " + (data.reset_hour != null ? data.reset_hour : 8) + ":00 北京", - "自 " + (data.history_start_day || "2026-06-09") + " 起", + "自 " + (data.history_start_day || "—") + " 起", "最多 " + (data.keep_days || 180) + " 交易日", ]; if (data.updated_at) parts.push("刷新 " + data.updated_at); diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 92b973f..857469e 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -15,7 +15,7 @@ - + @@ -339,7 +339,10 @@

CAP 资金概况

-

总资金 = 各监控户(资金账户 + 交易账户);自 2026-06-09 起按北京时间交易日切日快照,最多保留 180 天

+
+ 统计说明 +

加载配置中…

+