Show options position source (纯期权/永期/期期) on holdings cards.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4430,6 +4430,52 @@ html[data-theme="light"] .options-stats-pnl-summary .options-stat-item {
|
||||
font-size: 0.62rem;
|
||||
line-height: 1;
|
||||
}
|
||||
.opt-source-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
padding: 2px 7px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.opt-source-badge--plain {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: #9aa4b2;
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.opt-source-badge--po {
|
||||
background: rgba(100, 160, 255, 0.16);
|
||||
color: #8ec0ff;
|
||||
border-color: rgba(100, 160, 255, 0.35);
|
||||
}
|
||||
.opt-source-badge--oo {
|
||||
background: rgba(0, 212, 255, 0.14);
|
||||
color: #5ee4ff;
|
||||
border-color: rgba(0, 212, 255, 0.35);
|
||||
}
|
||||
.opt-pos-bar .opt-source-badge {
|
||||
padding: 2px 6px;
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
html[data-theme="light"] .opt-source-badge--plain {
|
||||
background: rgba(15, 23, 42, 0.06);
|
||||
color: #5a6578;
|
||||
border-color: rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
html[data-theme="light"] .opt-source-badge--po {
|
||||
background: rgba(37, 99, 235, 0.1);
|
||||
color: #1d4ed8;
|
||||
border-color: rgba(37, 99, 235, 0.25);
|
||||
}
|
||||
html[data-theme="light"] .opt-source-badge--oo {
|
||||
background: rgba(8, 145, 178, 0.1);
|
||||
color: #0e7490;
|
||||
border-color: rgba(8, 145, 178, 0.28);
|
||||
}
|
||||
.opt-pos-bar-meta {
|
||||
font-size: 0.66rem;
|
||||
color: #8b95b0;
|
||||
|
||||
@@ -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>" +
|
||||
|
||||
@@ -38,6 +38,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 pnlCls(upl, hub) {
|
||||
if (upl > 0) return hub ? "pnl-pos" : "pos-pnl-profit";
|
||||
if (upl < 0) return hub ? "pnl-neg" : "pos-pnl-loss";
|
||||
@@ -147,10 +169,13 @@
|
||||
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>" +
|
||||
headActions +
|
||||
"</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
|
||||
|
||||
Reference in New Issue
Block a user