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>
Force exchange_key on archive sync; add contract column and tag select styles on inner-light-mind; serve time_close_ui.js on instances so order/key time-close duration can be selected.
Co-authored-by: Cursor <cursoragent@cursor.com>
Program monitors open positions and market-closes at deadline; UI shows label and countdown on instance and hub boards.
Co-authored-by: Cursor <cursoragent@cursor.com>
Show period stats in a table; limit trades to 10 rows when chart is open and fill viewport when collapsed.
Co-authored-by: Cursor <cursoragent@cursor.com>
Support today/week/month/custom range selection with sick count, PnL, and per-exchange breakdown; update docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
Preserve exchange_key from archive cache, fix chart resize in details panel, move filters above quotes, align panel heights, and style sick trades with red/cyan.
Rename archive to 内照明心 with daily trade records by default, review quotes sidebar, on-demand chart, sick-row highlighting, and new daily-trades/quotes APIs.
Fix mobile AI to scroll only in the chat area. Dashboard cards show monitor item counts with expand-to-fullscreen and color-coded position floating P&L.
Mobile AI coach uses four top tabs (trading, general, history, new) with single-panel view and wider desktop history. Dashboard account cards show key levels and positions one per line with colored float PnL.
Co-authored-by: Cursor <cursoragent@cursor.com>
Move new-chat button to top toolbar to prevent overlap, compact chrome, hide chrome when keyboard opens, and soften mobile tab styling.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add show_nav_funds and show_nav_dashboard in hub_settings display prefs to hide top nav entries and redirect direct URL access.
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace dashboard polling with backend SSE and snapshot refresh. Restyle for light/dark theme with soft card glow instead of neon. Remove Today's Summary from AI page; keep trading and general chat only. Update hub documentation.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add /dashboard with daily PnL overview and loss alerts. Extend AI coach chat with history sidebar, delete/switch sessions, message copy, and trading vs general bot modes.
Co-authored-by: Cursor <cursoragent@cursor.com>