Add hub TP profit field, 2-decimal options PnL, and exchange mark price display.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-08 17:22:26 +08:00
parent e3e53ff7f5
commit 279648de56
8 changed files with 58 additions and 7 deletions
+1 -1
View File
@@ -455,7 +455,7 @@
'<div class="pos-cell"><span class="pos-label">指数价</span><span class="pos-value">' + fmt(p.idx_px, 0) + "</span></div>" +
'<div class="pos-cell"><span class="pos-label">到期平衡</span><span class="pos-value">' + fmt(p.expiry_be_px, 0) + "</span></div>" +
'<div class="pos-cell"><span class="pos-label">平掉回本</span><span class="pos-value">' + fmt(p.close_be_px, 0) + "</span></div>" +
'<div class="pos-cell"><span class="pos-label">浮盈亏</span><span class="pos-value ' + uplCls + '">' + fmt(p.upl, 4) + "</span></div>" +
'<div class="pos-cell"><span class="pos-label">浮盈亏</span><span class="pos-value ' + uplCls + '">' + fmt(p.upl, 2) + "</span></div>" +
'<div class="pos-cell"><span class="pos-label">收益率</span><span class="pos-value ' + uplCls + '">' +
(p.upl_ratio_pct != null ? p.upl_ratio_pct + "%" : "—") + "</span></div>" +
"</div></div>"
@@ -920,6 +920,7 @@ function formatOrderMarkDisplay(o){
const hasMark = markRaw !== null && markRaw !== undefined && markRaw !== "" && Number.isFinite(markNum) && markNum > 0;
if(hasMark){
if(row.exchange_mark_price_display && row.exchange_mark_price_display !== "-") return row.exchange_mark_price_display;
if(row.price_display && row.price_display !== "-") return row.price_display;
return markNum.toFixed(6);
}
if(row.price_display && row.price_display !== "-") return row.price_display;
+1 -1
View File
@@ -137,4 +137,4 @@
</div>
</div>
<script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/options_panel.js?v=13"></script>
<script src="/static/options_panel.js?v=14"></script>
+6
View File
@@ -355,6 +355,12 @@ def apply_order_price_display_fields(
payload["take_profit_display"] = (
format_price_fn(symbol, disp_tp) if disp_tp is not None else ""
)
mark_raw = mark_price if mark_price is not None else None
if mark_raw is not None and format_price_fn is not None and symbol is not None:
try:
payload["exchange_mark_price_display"] = format_price_fn(symbol, float(mark_raw))
except (TypeError, ValueError):
payload["exchange_mark_price_display"] = None
return payload