diff --git a/lib/common/static/options_panel.js b/lib/common/static/options_panel.js index b7cf16d..dc81d6a 100644 --- a/lib/common/static/options_panel.js +++ b/lib/common/static/options_panel.js @@ -455,7 +455,7 @@ '
指数价' + fmt(p.idx_px, 0) + "
" + '
到期平衡' + fmt(p.expiry_be_px, 0) + "
" + '
平掉回本' + fmt(p.close_be_px, 0) + "
" + - '
浮盈亏' + fmt(p.upl, 4) + "
" + + '
浮盈亏' + fmt(p.upl, 2) + "
" + '
收益率' + (p.upl_ratio_pct != null ? p.upl_ratio_pct + "%" : "—") + "
" + "" diff --git a/lib/instance/templates/embed_boot_scripts.html b/lib/instance/templates/embed_boot_scripts.html index 671f334..609ff47 100644 --- a/lib/instance/templates/embed_boot_scripts.html +++ b/lib/instance/templates/embed_boot_scripts.html @@ -920,6 +920,7 @@ function formatOrderMarkDisplay(o){ const hasMark = markRaw !== null && markRaw !== undefined && markRaw !== "" && Number.isFinite(markNum) && markNum > 0; if(hasMark){ if(row.exchange_mark_price_display && row.exchange_mark_price_display !== "-") return row.exchange_mark_price_display; + if(row.price_display && row.price_display !== "-") return row.price_display; return markNum.toFixed(6); } if(row.price_display && row.price_display !== "-") return row.price_display; diff --git a/lib/options/templates/options_panel.html b/lib/options/templates/options_panel.html index 9f8a775..97dd47e 100644 --- a/lib/options/templates/options_panel.html +++ b/lib/options/templates/options_panel.html @@ -137,4 +137,4 @@ - + diff --git a/lib/trade/order_monitor_display_lib.py b/lib/trade/order_monitor_display_lib.py index edc0c24..b4251b4 100644 --- a/lib/trade/order_monitor_display_lib.py +++ b/lib/trade/order_monitor_display_lib.py @@ -355,6 +355,12 @@ def apply_order_price_display_fields( payload["take_profit_display"] = ( format_price_fn(symbol, disp_tp) if disp_tp is not None else "—" ) + mark_raw = mark_price if mark_price is not None else None + if mark_raw is not None and format_price_fn is not None and symbol is not None: + try: + payload["exchange_mark_price_display"] = format_price_fn(symbol, float(mark_raw)) + except (TypeError, ValueError): + payload["exchange_mark_price_display"] = None return payload diff --git a/manual_trading_hub/hub.py b/manual_trading_hub/hub.py index d1238ff..5c842c0 100644 --- a/manual_trading_hub/hub.py +++ b/manual_trading_hub/hub.py @@ -1989,6 +1989,7 @@ _ORDER_PRICE_MERGE_KEYS = ( "display_rr_ratio", "latest_risk_amount", "contracts", + "reward_at_tp_usdt", "exchange_initial_margin", "plan_margin", "time_close_enabled", @@ -2120,6 +2121,17 @@ def _merge_flask_position_breakeven(agent_row: dict, snap: dict | None, hub_mon: break if isinstance(matched, dict): _apply_order_price_op_fields(p, matched) + disp = matched.get("exchange_mark_price_display") + if disp is not None and str(disp).strip() not in ("", "-"): + p["mark_price_fmt"] = str(disp) + mp = matched.get("exchange_mark_price") + if mp is not None: + try: + mpf = float(mp) + if mpf > 0: + p["mark_price"] = mpf + except (TypeError, ValueError): + pass def _agent_position_has_mark(p: dict) -> bool: diff --git a/manual_trading_hub/static/app.css b/manual_trading_hub/static/app.css index 9f7c8a9..2050c8c 100644 --- a/manual_trading_hub/static/app.css +++ b/manual_trading_hub/static/app.css @@ -1968,6 +1968,15 @@ body.market-chart-fs-open { font-weight: 600; } +.hub-pos-card .pos-tp-profit { + color: #4cd97f; + font-weight: 600; +} + +html[data-theme="light"] .hub-pos-card .pos-tp-profit { + color: #1a8f4a; +} + .hub-pos-card .pos-footer { display: flex; flex-wrap: wrap; diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 5caae99..c501626 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -116,7 +116,7 @@ function positionTableHeadHtml(compact) { const pnlTh = showAccountPnlPref() ? "浮盈" : ""; const cls = compact ? " data-table data-table-positions" : ""; - return `${pnlTh}`; + return `
合约方向开仓价标记价张数操作
${pnlTh}`; } let tpslPending = null; let lastMonitorRows = []; @@ -864,6 +864,26 @@ return null; } + function resolveTpProfitUsdt(mo, pos) { + const m = mo || {}; + const p = pos || {}; + const raw = + m.reward_at_tp_usdt != null && m.reward_at_tp_usdt !== "" + ? m.reward_at_tp_usdt + : p.reward_at_tp_usdt != null && p.reward_at_tp_usdt !== "" + ? p.reward_at_tp_usdt + : null; + if (raw == null || raw === "") return null; + const n = Number(raw); + return Number.isFinite(n) ? n : null; + } + + function formatTpProfitCell(mo, pos) { + const n = resolveTpProfitUsdt(mo, pos); + if (n == null) return "—"; + return `${fmt(n, 2)}U`; + } + function formatMonitorRiskMeta(mo, trendPlan) { const m = mo || {}; const t = trendPlan || {}; @@ -3155,7 +3175,8 @@
止损${sl != null && sl !== "" ? fmtSymbolPrice(sl, symbol, tickMap) : "—"}
止盈${formatTpCellValue(tp, tpMonitored, symbol, tickMap)}
盈亏比${rr != null ? fmt(rr, 2) + ":1" : "—"}
-
张数${fmt(pos.contracts, 4)}
+
张数${fmt(pos.contracts, 2)}
+
盈利金额${formatTpProfitCell(mo, pos)}
${ showAccountPnlPref() ? `
浮盈亏${pnlText}
` @@ -3308,12 +3329,14 @@ const pnlTd = showAccountPnlPref() ? `` : ""; + const tpProfitTd = ``; return ` - + + ${tpProfitTd} ${pnlTd} `; @@ -3499,7 +3522,7 @@ - + `; }); diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 343dd30..f1d3bc0 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -1152,6 +1152,6 @@ - +
合约方向开仓价标记价张数盈利金额操作
${fmt(x.unrealized_pnl, 2)}${formatTpProfitCell(monitorOrder, x)}
${tcBadge}${fcBadge}${symBeBadge} ${renderDirectionHtml(x.side)} ${fmtEntryPrice(x, tickMap)} ${fmtMarkPrice(x, tickMap)}${fmt(x.contracts, 4)}${fmt(x.contracts, 2)}${actionCell}
${p.idx_px != null ? fmt(p.idx_px, 0) : "—"} ${p.expiry_be_px != null ? fmt(p.expiry_be_px, 0) : "—"} ${p.close_be_px != null ? fmt(p.close_be_px, 0) : "—"}${fmt(p.upl, 4)}${fmt(p.upl, 2)} ${p.upl_ratio_pct != null ? esc(p.upl_ratio_pct) + "%" : "—"}