fix(gate-bot): format mark price with exchange symbol precision

Use price_to_precision in price_snapshot so live mark price matches entry/SL display instead of fixed 8 decimals.
This commit is contained in:
dekun
2026-06-04 16:33:09 +08:00
parent 88fc21e278
commit 3d55aa0975
3 changed files with 36 additions and 1 deletions
+8
View File
@@ -52,6 +52,7 @@ from key_monitor_full_margin_lib import (
from auto_transfer_daily_lib import run_auto_transfer_once_per_day
from form_submit_lib import check_duplicate_submit, submit_scope_add_key, submit_scope_add_order
from order_monitor_display_lib import (
apply_order_live_price_display,
apply_order_price_display_fields,
enrich_order_display_fields,
stop_is_profit_protecting,
@@ -5926,6 +5927,13 @@ def api_price_snapshot():
payload["float_pct"] = (
round((payload["float_pnl"] / float(denom)) * 100, 4) if denom and float(denom) > 0 else pnl_pct
)
apply_order_live_price_display(
payload,
r["symbol"],
price,
payload.get("exchange_mark_price"),
format_price_for_symbol,
)
if exchange_private_api_configured():
try:
exchange_tpsl = fetch_exchange_tpsl_slots(
+1 -1
View File
@@ -1867,7 +1867,7 @@ function refreshPriceSnapshotConditional(){
else if(o.price_display) disp = o.price_display;
else {
const px = hasMark ? Number(o.exchange_mark_price) : Number(o.price);
disp = Number.isFinite(px) ? px.toFixed(hasMark ? 8 : 6) : "-";
disp = Number.isFinite(px) ? String(px) : "-";
}
pEl.innerText = disp;
const pxNum = hasMark ? Number(o.exchange_mark_price) : Number(o.price);