Add trade move points; label option UPL price as bid not mark.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-31 15:44:52 +08:00
parent 8ceb521049
commit dffcd77837
5 changed files with 72 additions and 5 deletions
+1 -1
View File
@@ -645,7 +645,7 @@ export default function PlanPage() {
<span className="pos-value mono">{fmt(pos?.option_entry_px)}</span>
</div>
<div className="pos-cell">
<span className="pos-label">/</span>
<span className="pos-label"></span>
<span className="pos-value mono">{fmt(pos?.option_mark_px)}</span>
</div>
<div className="pos-cell">
+23
View File
@@ -44,6 +44,9 @@ type Group = {
hold_basis?: string | null;
strike?: number | null;
settle_index_px?: number | null;
entry_index_px?: number | null;
close_index_px?: number | null;
move_points?: number | null;
exec_mode?: string | null;
expiry_settle?: ExpirySettle | null;
pnl_summary?: PnlSummary;
@@ -102,6 +105,13 @@ function groupPnl(g: Group) {
return g.net_pnl ?? g.pnl_summary?.net_pnl ?? g.realized_pnl;
}
/** 开仓→平仓指数点数(带符号) */
function fmtMovePoints(n: number | null | undefined) {
if (n == null || Number.isNaN(n)) return "—";
const s = n > 0 ? `+${n.toFixed(1)}` : n.toFixed(1);
return s;
}
export default function TradesPage() {
const titleId = useId();
const [groups, setGroups] = useState<Group[]>([]);
@@ -196,6 +206,7 @@ export default function TradesPage() {
<span className="trade-row-times">
{fmtTime(openMs)} · {fmtTime(closeMs)} · {" "}
{fmtHold(g.hold_ms)}
{g.move_points != null ? ` · 波动 ${fmtMovePoints(g.move_points)}` : ""}
</span>
</div>
<div className={`trade-row-pnl mono ${pnlClass(listPnl)}`}>
@@ -244,6 +255,7 @@ export default function TradesPage() {
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
@@ -269,6 +281,7 @@ export default function TradesPage() {
<td className="mono">{fmtTime(openMs)}</td>
<td className="mono">{fmtTime(closeMs)}</td>
<td className="mono">{fmtHold(g.hold_ms)}</td>
<td className="mono">{fmtMovePoints(g.move_points)}</td>
<td className={`mono ${pnlClass(listPnl)}`}>
{fmt(listPnl)}
</td>
@@ -389,6 +402,16 @@ export default function TradesPage() {
{fmtHold(selectedGroup.hold_ms)}
</span>
</div>
<div className="kv">
<span></span>
<span className="mono">
{fmtMovePoints(selectedGroup.move_points)}
{selectedGroup.entry_index_px != null &&
selectedGroup.close_index_px != null
? `${fmt(selectedGroup.entry_index_px, 1)}${fmt(selectedGroup.close_index_px, 1)}`
: ""}
</span>
</div>
</div>
<p className="trade-detail-hint">