Clamp future last_close anchors, cap remaining time server-side, prefer freeze_remaining_sec in the badge JS, and auto-repair stale DB rows on read.
Co-authored-by: Cursor <cursoragent@cursor.com>
Anchor last_close on journal save, ignore leftover stored until when 1h window ended, and clear expired cooloff on trading-day rollover.
Co-authored-by: Cursor <cursoragent@cursor.com>
Treat naive app datetimes as local time, normalize legacy UTC-ms rows, and resolve cooloff end from stored until or last_close+duration.
Co-authored-by: Cursor <cursoragent@cursor.com>
Allow 1h reduction for any active 4h-tier cooloff, hook trade record review updates, and fix freeze label thresholds.
Co-authored-by: Cursor <cursoragent@cursor.com>
Hub closes and late journal saves now shorten active manual cooloffs when exit trigger and note are filled in.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sync review-mode checkbox with disabled state after form restore; repair initHubEmbedInFrameNav regression in instance_theme.js.
Co-authored-by: Cursor <cursoragent@cursor.com>
Use soft in-frame navigation and loading overlay in hub instance shell; pass embed=1 for iframe SSO opens.
Co-authored-by: Cursor <cursoragent@cursor.com>
Remove username_hint from hub auth status API and disable autocomplete on hub and instance login forms.
Co-authored-by: Cursor <cursoragent@cursor.com>
Remove external-close risk hooks; register user_instance, user_hub, and user_trend_stop via hub API and trend stop; update docs and tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
Implements shared account_risk_lib with 4h/1h cooloff and daily freeze rules, wires hooks into all four exchange apps and hub monitor UI, with tests and docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
manual_order_rr_preview.js was not routed from repo static/, so hide logic never ran. Add Flask routes on four exchanges, default hidden in HTML, and toggleSltpMode visibility.
Co-authored-by: Cursor <cursoragent@cursor.com>
False external-close sync could match historical closing trades before opened_at, producing stop-loss results with closed_at earlier than opened_at. Only use fills at or after open time.
Co-authored-by: Cursor <cursoragent@cursor.com>
Trade tab uses refreshPriceSnapshotConditional, not refreshPriceSnapshot; render recover banner there and on server when live exchange position lacks active monitor.
Co-authored-by: Cursor <cursoragent@cursor.com>
Detect exchange positions without active order_monitors, show a recover banner on the trade page, and reactivate stopped monitors with optional TP/SL restore via API.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add startup grace and consecutive flat polls before external-close reconcile, matching Gate, to avoid stopping monitors and canceling TP/SL when positions API is not ready after restart.
Co-authored-by: Cursor <cursoragent@cursor.com>
Only price and percentage modes show estimated profit-loss ratio before open; fixed RR mode keeps the existing estimated take-profit display.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add shared manual_order_rr_preview.js to fetch order_defaults after symbol and TP/SL inputs complete, display estimated profit-loss ratio before submit in price and percentage modes (and fixed RR), unified for risk and full-margin sizing.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sort inner-archive daily trades by closed_at_ms; add open time and live hold duration to instance and hub position cards, with exchange margin on hub footer.
Co-authored-by: Cursor <cursoragent@cursor.com>
Drop redeclared AI_CHAT_MAX_ATTACHMENTS and aiChatPendingFiles in app.js that broke script parsing after the chat perf update.
Co-authored-by: Cursor <cursoragent@cursor.com>
Cache chat context, parallelize exchange fetches, skip fund history writes, defer rolling summary to a background thread, and cache markdown rendering on the client.
Co-authored-by: Cursor <cursoragent@cursor.com>
Let users paste images into AI chat with removable pending attachments, and feed exchange/monitor stop-loss and take-profit into trading coach snapshots so replies reflect actual protection on open positions.
Co-authored-by: Cursor <cursoragent@cursor.com>
Move timed-close badge next to contract name on hub board and instance position cards; refresh countdown on board render.
Co-authored-by: Cursor <cursoragent@cursor.com>
When the K-line panel is open, clicking a trade row switches selection and chart markers without re-fetching candles for the same symbol.
Co-authored-by: Cursor <cursoragent@cursor.com>
Use composite trade key so Gate accounts with duplicate trade IDs no longer highlight two rows at once.
Co-authored-by: Cursor <cursoragent@cursor.com>
Label archive K-lines as USDT swap in title and API; highlight the full trade row when opening its chart.
Co-authored-by: Cursor <cursoragent@cursor.com>