Shrink instance dashboard header type and show options net PnL.

Header copy is smaller; options column uses bid-recycle net PnL like the options card.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 22:04:21 +08:00
parent 173f09300b
commit 217e752ee6
6 changed files with 23 additions and 18 deletions
+4 -5
View File
@@ -136,15 +136,14 @@ def _format_options_item(p: dict[str, Any], *, conn=None) -> dict[str, Any]:
inst = str(p.get("inst_id") or p.get("instId") or "-").strip() or "-"
opt_type = str(p.get("opt_type") or p.get("optType") or "").upper()
label = "Call" if opt_type == "C" else "Put" if opt_type == "P" else (opt_type or "OPT")
upl = _safe_float(p.get("upl"))
net = None
# 看板期权列固定用净盈亏(买一回收−权利金);残档买一则空.
pnl = None
try:
from lib.options.options_positions_lib import net_pnl_from_display_row
net = net_pnl_from_display_row(p)
pnl = net_pnl_from_display_row(p)
except Exception:
net = None
pnl = net if net is not None else upl
pnl = None
pos = _safe_float(p.get("pos"))
exp_ms = p.get("exp_time_ms")
if exp_ms is None:
+2 -2
View File
@@ -6,7 +6,7 @@
<script src="/static/instance_theme.js?v=50"></script>
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
<link rel="stylesheet" href="/static/instance_page.css?v=9">
<link rel="stylesheet" href="/static/instance_page.css?v=10">
<link rel="stylesheet" href="/static/instance_theme.css?v=97">
<script src="/static/account_risk_badge.js?v=4"></script>
<meta name="theme-color" content="#0b0d14">
@@ -111,7 +111,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
{% include 'embed_boot_scripts.html' %}
<script src="/static/records_review_page.js?v=2"></script>
<script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/instance_dashboard.js?v=4"></script>
<script src="/static/instance_dashboard.js?v=5"></script>
<script>
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
</script>
+2 -2
View File
@@ -16,7 +16,7 @@
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
<link rel="manifest" href="/static/icons/manifest.webmanifest">
<title>{{ pwa_app_name }}</title>
<link rel="stylesheet" href="/static/instance_page.css?v=9">
<link rel="stylesheet" href="/static/instance_page.css?v=10">
<link rel="stylesheet" href="/static/instance_theme.css?v=97">
</head>
@@ -2011,7 +2011,7 @@ setInterval(refreshPriceSnapshotConditional, {{ price_refresh_seconds * 1000 }})
</script>
<script src="/static/records_review_page.js?v=2"></script>
<script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/instance_dashboard.js?v=4"></script>
<script src="/static/instance_dashboard.js?v=5"></script>
<script>
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
{% if page == 'dashboard' %}