Show options position source (纯期权/永期/期期) on holdings cards.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -473,6 +473,28 @@
|
||||
return (t || "").toUpperCase() === "P" ? "看跌 Put" : "看涨 Call";
|
||||
}
|
||||
|
||||
function sourceText(p) {
|
||||
const lab = (p && p.source_label) || "纯期权";
|
||||
const src = (p && p.source) || "option";
|
||||
let pid = p && p.source_plan_id;
|
||||
if (pid == null && p && p.hedge_plan_target && p.hedge_plan_target.plan_id != null) {
|
||||
pid = p.hedge_plan_target.plan_id;
|
||||
}
|
||||
if (src !== "option" && pid != null && pid !== "") return lab + " #" + pid;
|
||||
return lab;
|
||||
}
|
||||
|
||||
function sourceBadgeHtml(p) {
|
||||
const src = (p && p.source) || "option";
|
||||
const cls =
|
||||
src === "options_options"
|
||||
? "opt-source-badge opt-source-badge--oo"
|
||||
: src === "perp_options"
|
||||
? "opt-source-badge opt-source-badge--po"
|
||||
: "opt-source-badge opt-source-badge--plain";
|
||||
return '<span class="' + cls + '" title="持仓来源">' + sourceText(p) + "</span>";
|
||||
}
|
||||
|
||||
function expLabel(ms) {
|
||||
try {
|
||||
const dt = new Date(Number(ms));
|
||||
@@ -1158,11 +1180,14 @@
|
||||
return (
|
||||
'<div class="pos-card-head">' +
|
||||
'<div class="pos-card-symbol"><strong>' + (p.inst_id || "") + '</strong>' +
|
||||
'<span class="pos-side-badge ' + sideCls + '">' + optTypeLabel(p.opt_type) + "</span></div>" +
|
||||
'<span class="pos-side-badge ' + sideCls + '">' + optTypeLabel(p.opt_type) + "</span>" +
|
||||
sourceBadgeHtml(p) +
|
||||
"</div>" +
|
||||
'<div class="pos-head-actions">' +
|
||||
'<button type="button" class="btn-primary opt-close-btn" data-inst="' + p.inst_id + '" data-sheets="' + closeSheets + '">买一平仓</button>' +
|
||||
"</div></div>" +
|
||||
'<div class="pos-meta">' +
|
||||
'<span class="pos-meta-item">持仓来源: ' + sourceText(p) + "</span>" +
|
||||
'<span class="pos-meta-item">行权价: ' + fmt(p.strike, 0) + "</span>" +
|
||||
'<span class="pos-meta-item">张数: ' + fmt(p.pos, 0) + " · 币量 " + fmt(p.eth_amount, 4) + "</span>" +
|
||||
(expAttr
|
||||
@@ -1320,6 +1345,7 @@
|
||||
'<span class="opt-pos-bar-id-group">' +
|
||||
'<strong class="opt-pos-bar-title" title="' + inst + '">' + inst + "</strong>" +
|
||||
'<span class="pos-side-badge ' + sideCls + '">' + optTypeLabel(p.opt_type) + "</span>" +
|
||||
sourceBadgeHtml(p) +
|
||||
"</span>" +
|
||||
'<span class="opt-pos-bar-meta">行权 ' + fmt(p.strike, 0) + " · " + fmt(p.pos, 0) + "张</span>" +
|
||||
"</span>" +
|
||||
|
||||
Reference in New Issue
Block a user