Show option bid as price/size and option leverage on plan and trades.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,6 +14,14 @@ function fmtTop(px: number | null | undefined, sz: number | null | undefined) {
|
||||
return `${fmt(px)}(${s})`;
|
||||
}
|
||||
|
||||
/** 持仓买一:价格/流动性张数,如 17.00/4000 */
|
||||
function fmtBidLiq(px: number | null | undefined, sz: number | null | undefined) {
|
||||
if (px == null || Number.isNaN(px)) return "—";
|
||||
if (sz == null || Number.isNaN(sz)) return fmt(px);
|
||||
const s = sz >= 100 ? sz.toFixed(0) : sz >= 10 ? sz.toFixed(1) : sz.toFixed(2);
|
||||
return `${fmt(px)}/${s}`;
|
||||
}
|
||||
|
||||
function pnlClass(n: number | null | undefined) {
|
||||
if (n == null || Number.isNaN(n) || n === 0) return "";
|
||||
return n > 0 ? "pos-pnl-profit" : "pos-pnl-loss";
|
||||
@@ -638,6 +646,9 @@ export default function PlanPage() {
|
||||
<span className="pos-meta-item mono">
|
||||
{fmt(pos?.option_qty_eth, 2)} ETH · {fmt(pos?.option_qty_contracts, 0)} 张
|
||||
</span>
|
||||
<span className="pos-meta-item mono" title="开仓指数÷开仓均价">
|
||||
杠杆 {fmt(pos?.option_leverage, 0)}x
|
||||
</span>
|
||||
</div>
|
||||
<div className="pos-grid">
|
||||
<div className="pos-cell">
|
||||
@@ -646,7 +657,9 @@ export default function PlanPage() {
|
||||
</div>
|
||||
<div className="pos-cell">
|
||||
<span className="pos-label">买一</span>
|
||||
<span className="pos-value mono">{fmt(pos?.option_mark_px)}</span>
|
||||
<span className="pos-value mono">
|
||||
{fmtBidLiq(pos?.option_mark_px, pos?.option_bid_sz)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="pos-cell">
|
||||
<span className="pos-label">
|
||||
|
||||
Reference in New Issue
Block a user