翻倍出场监控中按钮改为取消;中控目标监控列显示倍数如1倍。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-12 10:37:31 +08:00
parent cd23ea74a6
commit 8605efa2ed
6 changed files with 121 additions and 18 deletions
+34 -7
View File
@@ -3928,9 +3928,15 @@
);
}
function renderOptionsTargetCell(target) {
if (!target) return "<td>—</td>";
if (target.managed_by === "hedge_plan") {
function formatProfitExitMultLabel(mult) {
const n = Number(mult);
if (!Number.isFinite(n) || n <= 0) return "1倍";
if (Math.abs(n - Math.round(n)) < 1e-9) return String(Math.round(n)) + "倍";
return fmt(n, 2) + "倍";
}
function renderOptionsTargetCell(target, pos) {
if (target && target.managed_by === "hedge_plan") {
const rr = target.profit_rr != null ? Number(target.profit_rr) : null;
if (rr != null && rr > 0) {
return `<td class="hub-opt-target-cell is-on is-hedge" title="由对冲计划监控">对冲#${esc(target.plan_id)} 盈亏比 ${esc(fmt(rr, 2))}</td>`;
@@ -3939,9 +3945,30 @@
const px = target.target_index != null ? fmt(target.target_index, 1) : "—";
return `<td class="hub-opt-target-cell is-on is-hedge" title="由对冲计划监控">对冲#${esc(target.plan_id)} ${esc(side)} ${esc(px)}</td>`;
}
const side = String(target.opt_type || "").toUpperCase() === "P" ? "Put≤" : "Call≥";
const px = target.target_index != null ? fmt(target.target_index, 1) : "—";
return `<td class="hub-opt-target-cell is-on" title="目标监控">${esc(side)} ${esc(px)}</td>`;
const parts = [];
const hasIndex =
target &&
target.exit_mode !== "profit_exit" &&
target.target_index != null &&
Number(target.target_index) > 0;
if (hasIndex) {
const side = String(target.opt_type || (pos && pos.opt_type) || "").toUpperCase() === "P" ? "Put≤" : "Call≥";
parts.push(side + " " + fmt(target.target_index, 1));
}
const peOn =
!!(pos && pos.profit_exit_enabled) ||
!!(target && (target.exit_mode === "profit_exit" || target.profit_exit_enabled));
if (peOn) {
const mult =
pos && pos.profit_exit_mult != null
? pos.profit_exit_mult
: target && target.profit_exit_mult != null
? target.profit_exit_mult
: 1;
parts.push(formatProfitExitMultLabel(mult));
}
if (!parts.length) return "<td>—</td>";
return `<td class="hub-opt-target-cell is-on" title="目标监控">${esc(parts.join(" · "))}</td>`;
}
function renderOptionsPositionsTable(pos, targets) {
@@ -3970,7 +3997,7 @@
<td>${esc(optType)}</td>
<td>${esc(p.pos)}</td>
<td>${optionsExpiryCdHtml(p.exp_time_ms != null ? p.exp_time_ms : p.exp_time)}</td>
${renderOptionsTargetCell(target)}`;
${renderOptionsTargetCell(target, p)}`;
if (showPnl) {
html += `<td class="${pnlCls(net)}">${net == null ? "—" : fmt(net, 2)}</td>
<td class="${pnlCls(net)}">${roi == null ? "—" : esc(Number(roi).toFixed(2)) + "%"}</td>`;
+1 -1
View File
@@ -1767,6 +1767,6 @@
<script src="/assets/options_expiry_countdown.js?v=1"></script>
<script src="/assets/options_position_cards.js?v=4"></script>
<script src="/assets/backup.js?v=1"></script>
<script src="/assets/app.js?v=20260807-opt-float"></script>
<script src="/assets/app.js?v=20260812-profit-exit"></script>
</body>
</html>