diff --git a/manual_trading_hub/static/dashboard.js b/manual_trading_hub/static/dashboard.js index 6e23f7d..b42b108 100644 --- a/manual_trading_hub/static/dashboard.js +++ b/manual_trading_hub/static/dashboard.js @@ -159,15 +159,27 @@ return { perp: perp, options: options }; } + function sourceBadgeClass(source) { + const s = String(source || ""); + if (s.indexOf("对冲") >= 0) return "is-hedge"; + if (s.indexOf("纯期权") >= 0 || s === "期权") return "is-opt"; + if (s.indexOf("顺势") >= 0) return "is-roll"; + if (s.indexOf("趋势") >= 0) return "is-trend"; + if (s.indexOf("关键位") >= 0) return "is-key"; + if (s.indexOf("下单") >= 0) return "is-order"; + return "is-none"; + } + + function sourceTypeCell(source) { + const s = String(source || "—"); + return `${esc(s)}`; + } + function renderUnifiedPerpTable(rows) { - if (!rows.length) { - return `
-
永续持仓
-
当前无永续持仓
-
`; - } + if (!rows.length) return ""; const body = rows .map(({ ac, ln }) => { + const source = String((ln && ln.source) || "—"); const symbol = esc((ln && (ln.symbol || ln.text)) || "—"); const side = esc((ln && ln.side) || "—"); const contracts = @@ -176,6 +188,7 @@ const pct = floatPctText(pnl, ln && ln.notional_usdt); return ` ${exchangeLinkCell(ac)} + ${sourceTypeCell(source)} ${symbol} ${side} ${priceCell(ln && ln.entry_price_fmt, ln && ln.entry_price)} @@ -191,7 +204,7 @@
- + ${body}
交易所合约方向开仓价标记价张数盈利金额浮盈交易所类型合约方向开仓价标记价张数盈利金额浮盈
@@ -214,12 +227,7 @@ } function renderUnifiedOptionsTable(rows) { - if (!rows.length) { - return `
- -
当前无期权持仓
-
`; - } + if (!rows.length) return ""; const body = rows .map(({ ac, p }) => { const optType = @@ -228,11 +236,13 @@ : (p.opt_type || "").toUpperCase() === "P" ? "Put" : p.opt_type || "—"; + const source = String(p.source_label || p.source || "纯期权"); const target = String(p.target_monitor_text || "—"); const targetCls = target && target !== "—" ? "dash-target-monitor is-on" : "dash-target-monitor"; const net = optionsNetPnl(p); return ` ${exchangeLinkCell(ac)} + ${sourceTypeCell(source)} ${esc(shortDashInst(p.inst_id))} ${esc(optType)} ${dashOptionsExpiryCd(p.exp_time_ms != null ? p.exp_time_ms : p.exp_time)} @@ -247,7 +257,7 @@
- + ${body}
交易所合约类型到期倒计时指数目标监控净盈亏交易所类型合约Call/Put到期倒计时指数目标监控净盈亏
@@ -269,7 +279,9 @@ function renderAccounts(accounts, threshold) { const unified = collectUnifiedPositions(accounts); - if (!unified.perp.length && !unified.options.length) { + const perpHtml = renderUnifiedPerpTable(unified.perp); + const optionsHtml = renderUnifiedOptionsTable(unified.options); + if (!perpHtml && !optionsHtml) { elAccounts.innerHTML = '
当前无持仓账户
'; return; } @@ -281,8 +293,8 @@ : ""; elAccounts.innerHTML = `
- ${renderUnifiedPerpTable(unified.perp)} - ${renderUnifiedOptionsTable(unified.options)} + ${perpHtml} + ${optionsHtml} ${alertNote}
`; diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 400868b..efdeb15 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -20,7 +20,7 @@ - + @@ -1385,7 +1385,7 @@ - +