Show expiry settlement as index vs strike intrinsic.

Persist settle_index_px and surface formula in trade detail so expiry closes are not mistaken for book fills.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-29 16:15:22 +08:00
parent 3df64aeb2d
commit 8518a207a7
6 changed files with 130 additions and 7 deletions
+9 -1
View File
@@ -52,10 +52,18 @@ export function positionSidesZh(
return `${sideZh(perp)}/${sideZh(option)}`;
}
export function fillDescZh(leg: string, action: string, side: string): string {
export function fillDescZh(
leg: string,
action: string,
side: string,
closeReason?: string | null,
): string {
const l = LEG_ZH[leg] || leg;
const a = ACTION_ZH[action] || action;
const s = SIDE_ZH[side] || side;
if (leg === "option" && action === "close" && closeReason === "expiry") {
return "期权到期结算";
}
// 期权买入开仓:「期权开多」;永续:「永续开多/开空」
if (leg === "option" && action === "open") return "期权开多";
if (leg === "option" && action === "close") return "期权平多";
+46 -3
View File
@@ -15,6 +15,14 @@ type PnlSummary = {
net_pnl: number | null;
};
type ExpirySettle = {
settle_index_px: number | null;
strike: number | null;
intrinsic: number | null;
formula: string;
perp_note: string;
};
type Group = {
group_id: string;
status: string;
@@ -31,6 +39,9 @@ type Group = {
hold_close_at_ms?: number | null;
hold_ms?: number | null;
hold_basis?: string | null;
strike?: number | null;
settle_index_px?: number | null;
expiry_settle?: ExpirySettle | null;
pnl_summary?: PnlSummary;
};
@@ -276,14 +287,46 @@ export default function TradesPage() {
</div>
<p className="trade-detail-hint">
= +
{selectedGroup.close_reason === "expiry"
? "到期结算:期权按「指数 vs 行权价」的内在价值入账(非盘口);永续仍按市价平。净盈亏 = 期权盈亏 + 永续盈亏 − 全部手续费。"
: "成交价为成交均价(未预先扣费);手续费单独列出。净盈亏 = 期权盈亏 + 永续盈亏 − 全部手续费。"}
</p>
{selectedGroup.expiry_settle ? (
<div className="trade-hold-summary" style={{ marginBottom: 10 }}>
<div className="kv">
<span></span>
<span className="mono">
{fmt(selectedGroup.expiry_settle.settle_index_px)}
</span>
</div>
<div className="kv">
<span></span>
<span className="mono">
{fmt(selectedGroup.expiry_settle.strike, 0)}
</span>
</div>
<div className="kv">
<span></span>
<span className="mono">
{fmt(selectedGroup.expiry_settle.intrinsic)}
{selectedGroup.expiry_settle.formula
? ` · ${selectedGroup.expiry_settle.formula}`
: ""}
</span>
</div>
</div>
) : null}
{fills.map((f) => (
<div key={f.id} className="trade-fill kv">
<span className="mono">
{fillDescZh(f.leg, f.action, f.side)}
{fillDescZh(
f.leg,
f.action,
f.side,
selectedGroup.close_reason,
)}
</span>
<span className="mono">
{f.fill_px.toFixed(4)} · {f.qty_eth} · {" "}