Commit Graph

148 Commits

Author SHA1 Message Date
dekun e18d5feb72 Apply 200k scope when CTP offline; trailing breakeven order UX.
When SimNow or live CTP is disconnected, default to the four-product whitelist regardless of reference capital. Trailing breakeven defaults off; when enabled hide take-profit and risk-reward, monitor exits via trailing stop only. Document both behaviors in TRADING.md and FEATURES.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 23:57:11 +08:00
dekun 4f4c4bb9fc Fix missing recommend_payload import; raise small-account cap to 200k.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 23:27:19 +08:00
dekun 7bb80ba538 Limit tradable products to four varieties for accounts at or below 100k.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 23:18:27 +08:00
dekun 24190bf679 Add period selector and crypto-style trend plan preview table.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 22:52:47 +08:00
dekun d3b92de703 Fix trend strategy symbol input clearing on every keystroke.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 22:40:33 +08:00
dekun 69cf94d1df Fix symbol dropdown broken by JS syntax error in symbol.js.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 22:31:46 +08:00
dekun 7f8b4cfefd Label night-session products and hide day-only symbols at night.
Mark tradable varieties with a night tag; during 21:00-02:30 filter out index futures and other products without night sessions from symbol picker and recommend list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 22:27:47 +08:00
dekun f2940d41e9 Fix stale pending orders after CTP rejection or cancel.
When the exchange rejects or cancels an order, close local pending monitors once the order leaves CTP active list instead of waiting for the full timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 22:21:15 +08:00
dekun fd49b08c08 Disable turbo client navigation to fix broken page layouts.
Turbo swapping broke page CSS/JS across stats, settings, market, and trade. Restore full page loads; keep external base.css and link prefetch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 22:05:04 +08:00
dekun 9613fb0737 Fix turbo nav for settings and stats pages.
Extract settings.js, preserve inline scripts from raw HTML (DOMParser strips them), and load trade config via JSON script tag.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 21:26:15 +08:00
dekun 6d55a54946 Fix turbo nav layout flash and stats page not loading.
Wait for page CSS before swapping content, hoist inline styles to head, and boot page scripts immediately when DOM markers exist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 20:55:36 +08:00
dekun c79bb2ea4b Speed up top nav with turbo routing and external base CSS.
Remove view-transition lag, swap main content without full reload, prefetch pages, and tear down SSE timers on leave.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 20:47:22 +08:00
dekun ddfe2a52aa Merge orders and positions into one card and hide stale pending when CTP is off.
Stop showing DB pending orders while disconnected, invalidate session cache when CTP is down, and add a local DB clear script without embedded credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 19:27:02 +08:00
dekun 631aa2c0ab Add CTP auto-connect toggle to stop off-hours reconnect attempts.
When disabled, disconnect immediately and skip auto-reconnect, premarket connect, and TCP probes that fail outside SimNow trading hours.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 18:53:49 +08:00
dekun 3a150dd3d6 Implement CTP-authoritative trading UI with event-driven state.
Add in-memory order/position books fed by CTP events, split active orders above positions in the UI, tick-triggered local SL/TP, and 30-second full calibration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 18:12:11 +08:00
dekun 4ef33a367f Fix CTP exchange routing for non-SHFE contracts and duplicate trade closes.
Resolve CZCE/DCE symbols to the correct exchange for orders, dedupe stop-loss closes and trade logs, and rely on CTP sync for authoritative records.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 14:06:49 +08:00
dekun 382a9a0e14 Use Sina-only market K-lines and editable admin login synced to .env.
Market page uses Sina for quotes and bars with an auto-follow toggle and incremental chart updates while panning. Settings lets users change username and password, persisting to the database and .env.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 13:53:12 +08:00
dekun 6905373401 Make settings cards collapsible and tighten backup layout.
All settings sections fold by default with persisted state; backup and password sit in one compact row.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 13:10:43 +08:00
dekun 98239d29c1 Add automatic database backup with download and restore docs.
Back up futures.db and uploads to /root/qihuo_backup on a daily schedule, expose backup downloads in settings, and document cross-server restore.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 13:04:48 +08:00
dekun 508d85a282 Fix SQLite lock errors on /api/stats under concurrent writes.
Retry stats cache commits, serialize refresh, and fall back to read-only compute so the stats API does not return 500 when the database is briefly locked.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 12:23:33 +08:00
dekun d3955309d9 Persist CTP margin, ratio, and fees to DB; use exchange commission in trade logs.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 11:36:56 +08:00
dekun 9a55c61678 Align position margin with account balance and show deducted open commission only.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 11:26:41 +08:00
dekun 038eb9a403 Use CTP contract margin rates for position margin and ratio display.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 11:14:01 +08:00
dekun 7a4a3f08e5 Fix slow CTP position sync after restart and link positions to 15m K-line.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 11:05:13 +08:00
dekun deb9501cbe Show product name, main contract badge, and exchange on position cards.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 10:55:37 +08:00
dekun 42f2dad52a Remove contract profile from navigation and retire its routes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 03:32:30 +08:00
dekun cababd67f5 Reduce navigation flash with instant theme background and view transitions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 03:26:57 +08:00
dekun aaf69329cb Use English tagline and open daily K-line when jumping from tradable symbols.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 03:23:52 +08:00
dekun 4eb5709d71 Rebrand product and enhance tradable symbols table with spec columns and K-line links.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 03:18:42 +08:00
dekun ab9987e4c7 Add personal license agreement and rename product section to tradable symbols.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 02:52:45 +08:00
dekun 7b60f0dce5 Update documentation to match current product features.
Rewrite module docs for order monitor, CTP sync, and stats; remove obsolete simulated-position and UI descriptions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 02:08:01 +08:00
dekun bdfa21def8 Rename positions nav to order monitor and set as default landing page.
Remove stats recalculate button; login and home now open /positions without affecting refresh on other routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 01:51:22 +08:00
dekun 1cc0cd5f8d Flatten records visuals and show stats summary in one row.
Use transparent chart/table surfaces on records page; merge 14 stat metrics into a single compact card row.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 01:41:35 +08:00
dekun 64adce0e24 Flatten records page styling to match outer card background.
Use card-bg for equity curve and trade table instead of nested inner card colors.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 01:35:50 +08:00
dekun f457e7d6c9 Fix trade records table scroll with sticky header and themed background.
Use card CSS variables for 10-row viewport, sticky column headers, and dark/light theme sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 01:31:06 +08:00
dekun aad88a9e98 Add industry filter to recommendations and fix verify button width.
Show category, turnover, and per-industry counts; clarify volume is in lots. Prevent trade-save button from stretching full column width.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 01:21:53 +08:00
dekun e5f675c6ca Sync equity curve with card theme and keep trade actions on one row.
Use CSS variables for chart colors with dark/light auto-switch; prevent trade action buttons from wrapping.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 01:11:21 +08:00
dekun eb4414f741 Fix trade sync when get_all_trades returns a list.
Handle both dict and list from vnpy so records page CTP sync no longer warns.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 00:58:16 +08:00
dekun 7133a0e448 Fix CTP vnctptd segfault restart loop by serializing reconnect.
Skip duplicate auto-connect when TD is logged in, stop aggressive query_position hooks, and throttle position refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 00:49:17 +08:00
dekun 9f48f22d16 Gate order cancel to trading hours and sync trade logs from CTP.
Disable cancel UI outside sessions, query exchange fills for records, and label local vs counterparty rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 00:35:51 +08:00
dekun a23f2c80ca Track open orders as pending until CTP fill, with cancel and timeout.
Add configurable pending timeout in settings and clearer CTP password save feedback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 00:05:45 +08:00
dekun 7ea8fb6301 Remove pm2 300M memory restart limit for 8GB server
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 18:04:17 +08:00
dekun ca541d5fc3 Auto-reconnect CTP with new front-end addresses after saving settings
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:51:18 +08:00
dekun b641a4eaa0 Expand recommend table with gap, daily stats, and client-side sorting
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:36:31 +08:00
dekun a56370d2af Fix positions page hang by moving recommend refresh to background
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:29:10 +08:00
dekun 04b6f5e72d Add daily trend status to product recommendations with breakout priority
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:25:34 +08:00
dekun aba67a3d16 Compact CTP settings form into 3-row grid per card
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:16:52 +08:00
dekun 47dd946d66 fix: CTP 设置 SimNow/实盘卡片改为左右并列显示
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:11:54 +08:00
dekun 480000e195 feat: 系统设置 CTP 连接拆分为 SimNow/实盘可折叠卡片
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:09:56 +08:00
dekun 259d9e812d fix: CTP登录冷却持久化到数据库,取消页面自动连并刷新JS缓存
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:01:36 +08:00