Force refresh wipes the series in hub_kline.db before pulling from the exchange; add a Linux clear script and rename the UI button to 清库重拉.
Co-authored-by: Cursor <cursoragent@cursor.com>
Trim gaps before deciding fetch need, always backfill short contiguous tails, and relax gap detection so tail polls do not block full history loads.
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep only the latest contiguous K-line segment, purge isolated stale rows, and backfill when the tail is still shorter than the initial limit.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sync active plans after hub position close, merge final close snapshots per plan, and backfill missing trade records when ending an already-stopped plan.
Co-authored-by: Cursor <cursoragent@cursor.com>
Finalize plans before writing snapshots, dedupe on startup and page load, and add a cleanup script for existing repeated rows.
Co-authored-by: Cursor <cursoragent@cursor.com>
Records were still in the database but CSS clipping hid row text; restore visible summary styling and symbol fallback from snapshots.
Co-authored-by: Cursor <cursoragent@cursor.com>
When auto-follow is off, refresh only updates the latest bars via series.update instead of setData so zoom and pan stay fixed during background polls.
Co-authored-by: Cursor <cursoragent@cursor.com>
On tail refresh, auto-on always snaps to latest candles while auto-off preserves the saved viewport with clamped range restore.
Co-authored-by: Cursor <cursoragent@cursor.com>
Tie the market auto toggle to both price scale and viewport: tail refresh updates data silently while preserving zoom/pan when auto is disabled.
Co-authored-by: Cursor <cursoragent@cursor.com>
Load 2000 bars for 1m/5m/15m, 1000 for 1h/2h/4h, and 500 for 1d/1w on first screen instead of 300-bar chunked defaults.
Co-authored-by: Cursor <cursoragent@cursor.com>
Remove pendingViewportEpoch, fetch only 30 tail bars on poll, restore wasViewingTail logic, and fix left-scroll range shift from actual merge delta.
Co-authored-by: Cursor <cursoragent@cursor.com>
Use pendingViewportEpoch so tail refresh applies default range on new timeframe instead of reusing the previous period's saved range.
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the user viewport when SSE updates candles so zooming out to see the full series is not reset to the recent 200-bar view.
Co-authored-by: Cursor <cursoragent@cursor.com>
Drop 12h from market chart options and storage, and avoid left-pan reload and tail refresh from resetting the viewport while zooming.
Co-authored-by: Cursor <cursoragent@cursor.com>
Reset visible range and block stale left-pan/tail refresh from applying the previous period logical range to new candles.
Co-authored-by: Cursor <cursoragent@cursor.com>
Store 1m/5m/1h/12h/1d/1w with per-timeframe policies, aggregate 15m and 2h/4h on read, and support left-pan history fetches via before_ms.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add 自动 toggle on archive chart; when on, load history span for all trades and plot numbered open/close arrows for each.
Co-authored-by: Cursor <cursoragent@cursor.com>
range=history serves archive seed through close (not now). Default view focuses hold period; user can scroll/zoom left to see global morphology before entry.
Co-authored-by: Cursor <cursoragent@cursor.com>
Span chart window across hold period, fill 5m gaps for smooth aggregation, and mark entry/exit with lightweight-charts arrows.
Co-authored-by: Cursor <cursoragent@cursor.com>
Include strategy_trade_snapshots when trade_records is empty, harden SQL for older schemas, and show per-exchange sync errors in the archive UI.
Co-authored-by: Cursor <cursoragent@cursor.com>
Gate_bot insert_trade_record lacked entry_reason, causing _finalize_plan to save strategy snapshots but fail trade insert. Filter kwargs by signature, insert before plan commit, and add backfill script.
Co-authored-by: Cursor <cursoragent@cursor.com>
Unify display on trend_leg_display_price: use recorded fills or grid triggers only; last done row avg comes from live entry, never back-solve trigger prices.
Co-authored-by: Cursor <cursoragent@cursor.com>
Unify gate_bot with shared enrich_trend_plan for strategy pages and hub monitor, reconcile DCA avg with live entry price, and fix missing fill price display.
Co-authored-by: Cursor <cursoragent@cursor.com>
Gate build_gate_order_params returns {} which is falsy; params or None broke trend_market_add with NoneType is not iterable while first-leg place_exchange_order worked.
Co-authored-by: Cursor <cursoragent@cursor.com>
Log poll exceptions, diagnose live-trading and mark-price blocks on the trend page, start background monitors on app import, and add /api/trend_poll_status for debugging.
Co-authored-by: Cursor <cursoragent@cursor.com>
Poll trend plans with mark price (same as UI) instead of ticker last, add get_symbol_mark_price to gate_bot, tolerate position API blips, and log DCA order failures.
Co-authored-by: Cursor <cursoragent@cursor.com>
Align running-plan header and DCA table with risk-budget RR, record actual fill prices after each leg, and save pre-close snapshots on stop/TP/handoff across hub and exchanges.
Co-authored-by: Cursor <cursoragent@cursor.com>
- Extract shared gate_transfer_lib and global transfer form on all pages
- Block auto-transfer when trend pullback plans have open positions
- Redirect manual transfer back to the current page after submit
Co-authored-by: Cursor <cursoragent@cursor.com>