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:
@@ -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 "期权平多";
|
||||
|
||||
@@ -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} · 手续费{" "}
|
||||
|
||||
Reference in New Issue
Block a user