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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user