Fix options mark price float junk and target index input rollback.

Skip full card redraw while the monitor target field is focused, and format mark/avg without relying on dusty server strings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-15 22:24:52 +08:00
parent 6f934ecbbf
commit a21b962bf1
5 changed files with 36 additions and 25 deletions
+3 -1
View File
@@ -115,7 +115,9 @@ def round_option_px(px: float, tick_sz: Any, side: str) -> float:
def format_option_px(px: float, tick_sz: Any) -> str:
tick = _safe_float(tick_sz)
if tick is None or tick <= 0:
return str(px)
# 无 tick 时裁到 4 位并去尾零,避免 482.4881990066513 这类浮点毛刺
s = f"{float(px):.4f}".rstrip("0").rstrip(".")
return s or "0"
if tick < 1:
decimals = max(0, -int(round(math.log10(tick))))
return f"{px:.{decimals}f}".rstrip("0").rstrip(".") or "0"