Fix position cards, breakeven badge, and tablet equal-height layout.

Stop clipping pos cards and match trailing-BE stop detection for the badge. On tablet, align order and live-trading panels to equal height with internal scroll; keep desktop positions scrollable after three cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-29 23:47:59 +08:00
parent c6c6c3fe83
commit 9dbf6b1f1e
6 changed files with 149 additions and 27 deletions
+6 -1
View File
@@ -186,8 +186,13 @@ def install_trading(app, *, login_required, require_nav, get_db, get_setting, se
if entry_f <= 0:
return False
tick = float(tick_size or 0) or max(abs(entry_f) * 1e-6, 0.01)
buf = tick * max(2, get_trailing_be_tick_buffer(get_setting))
be_mult = max(1, get_trailing_be_tick_buffer(get_setting))
d = (direction or "long").strip().lower()
expected_be = entry_f + be_mult * tick if d == "long" else entry_f - be_mult * tick
tol = be_mult * tick + tick * 0.05
if abs(sl_f - expected_be) <= tol:
return True
buf = tick * max(2, be_mult)
near = abs(sl_f - entry_f) <= buf + tick
if d == "long":
return near and sl_f >= entry_f - tick * 0.05