Show residual bid as price/size and recovery percent from bid premium.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-03 07:43:27 +08:00
parent a10ecf7409
commit 09abb8d35b
3 changed files with 47 additions and 5 deletions
+28 -3
View File
@@ -85,11 +85,22 @@ type ResidualRow = {
option_qty_eth: number | null;
initial_premium: number | null;
bid_px: number | null;
bid_sz_eth: number | null;
current_premium: number | null;
recovery_pct: number | null;
liquidity_ok: boolean;
};
function fmtBidLiquidity(
bidPx: number | null,
bidSzEth: number | null,
): string {
if (bidPx == null && bidSzEth == null) return "—";
const px = bidPx == null ? "—" : fmtExPx("option", bidPx);
const sz = bidSzEth == null ? "—" : fmt(bidSzEth, 2);
return `${px} / ${sz}`;
}
function collectResiduals(nodes: NodeCard[]): ResidualRow[] {
const out: ResidualRow[] = [];
for (const n of nodes) {
@@ -115,6 +126,7 @@ function collectResiduals(nodes: NodeCard[]): ResidualRow[] {
option_qty_eth: numOrNull(r.option_qty_eth),
initial_premium: numOrNull(r.initial_premium),
bid_px: numOrNull(r.bid_px),
bid_sz_eth: numOrNull(r.bid_sz_eth),
current_premium: numOrNull(r.current_premium),
recovery_pct: numOrNull(r.recovery_pct),
liquidity_ok: r.liquidity_ok === true,
@@ -838,8 +850,9 @@ export default function MonitorPage() {
<th></th>
<th></th>
<th></th>
<th></th>
<th>%</th>
<th title="最新买一价格 / 买一数量(ETH)"></th>
<th title="买一价 × 持仓数量"></th>
<th title="买一权利金 ÷ 开仓权利金"></th>
<th></th>
</tr>
</thead>
@@ -851,9 +864,21 @@ export default function MonitorPage() {
<td className="mono">{r.option_inst_id}</td>
<td className="mono">{fmt(r.option_qty_eth, 4)}</td>
<td className="mono">{fmt(r.initial_premium, 2)}</td>
<td
className="mono"
title={
r.liquidity_ok
? "买一深度可覆盖持仓"
: "买一不足或盘口不可用"
}
>
{fmtBidLiquidity(r.bid_px, r.bid_sz_eth)}
</td>
<td className="mono">{fmt(r.current_premium, 2)}</td>
<td className="mono">
{r.recovery_pct == null ? "—" : fmt(r.recovery_pct, 1)}
{r.recovery_pct == null
? "—"
: `${fmt(r.recovery_pct, 1)}%`}
</td>
<td className="col-actions">
<button