期期出场改盈亏比:达目标平盈利腿,亏损腿残值20%或到期平

将上/下破目标价替换为盈亏比(盈利金额/初始权利金,默认2);残值平需买一流动性且权利金≤初始20%。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-11 16:44:45 +08:00
parent e26a67176c
commit c5d3d9d6c1
17 changed files with 566 additions and 198 deletions
+34 -16
View File
@@ -1444,21 +1444,37 @@
function renderTargetDelegateRow(p) {
const inst = p.inst_id || "";
const hedgeTarget = p.hedge_plan_target || null;
if (hedgeTarget && Number(hedgeTarget.target_index) > 0) {
const side = (p.opt_type || hedgeTarget.opt_type || "").toUpperCase() === "P" ? "Put ≤" : "Call ≥";
return (
'<div class="opt-target-row opt-target-row--managed">' +
'<span class="opt-target-row-label">对冲计划</span>' +
'<span class="opt-target-armed">计划 #' +
hedgeTarget.plan_id +
" · " +
side +
" " +
fmt(hedgeTarget.target_index, 1) +
"</span>" +
'<span class="muted opt-target-row-hint">进行中 · 由对冲计划监控,到位后仅平盈利腿</span>' +
"</div>"
);
if (hedgeTarget) {
const rr = hedgeTarget.profit_rr != null ? Number(hedgeTarget.profit_rr) : null;
if (rr != null && rr > 0) {
return (
'<div class="opt-target-row opt-target-row--managed">' +
'<span class="opt-target-row-label">对冲计划</span>' +
'<span class="opt-target-armed">计划 #' +
hedgeTarget.plan_id +
" · 盈亏比 " +
fmt(rr, 2) +
"</span>" +
'<span class="muted opt-target-row-hint">进行中 · 达盈亏比仅平盈利腿;亏损腿残值平或到期平</span>' +
"</div>"
);
}
if (Number(hedgeTarget.target_index) > 0) {
const side = (p.opt_type || hedgeTarget.opt_type || "").toUpperCase() === "P" ? "Put ≤" : "Call ≥";
return (
'<div class="opt-target-row opt-target-row--managed">' +
'<span class="opt-target-row-label">对冲计划</span>' +
'<span class="opt-target-armed">计划 #' +
hedgeTarget.plan_id +
" · " +
side +
" " +
fmt(hedgeTarget.target_index, 1) +
"</span>" +
'<span class="muted opt-target-row-hint">进行中 · 由对冲计划监控,到位后仅平盈利腿</span>' +
"</div>"
);
}
}
const tgt = p.target_index != null && p.target_index !== "" ? Number(p.target_index) : null;
const armed = tgt != null && Number.isFinite(tgt) && tgt > 0;
@@ -1896,13 +1912,15 @@
});
}
const hedgeTarget = p.hedge_plan_target;
if (hedgeTarget && hedgeTarget.target_index != null) {
if (hedgeTarget && (hedgeTarget.target_index != null || hedgeTarget.profit_rr != null)) {
targets.push({
inst_id: p.inst_id,
opt_type: p.opt_type || hedgeTarget.opt_type,
target_index: hedgeTarget.target_index,
profit_rr: hedgeTarget.profit_rr,
plan_id: hedgeTarget.plan_id,
managed_by: hedgeTarget.managed_by,
exit_mode: hedgeTarget.exit_mode,
});
}
return targets;