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 <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-10 17:23:54 +08:00
parent 4f5a982b63
commit 5faedfbfb7
4 changed files with 63 additions and 8 deletions
+24 -2
View File
@@ -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);