Commit Graph

64 Commits

Author SHA1 Message Date
dekun 1b3a7f1bdc Fix position flicker, drop futures cooloff, prioritize startup display.
Preserve trading state when CTP memory is empty, bootstrap equity/positions on page load, stabilize risk status from DB monitors, and remove app-layer manual close cooling periods.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 23:17:18 +08:00
dekun fb23ee891c Resolve position average entry from CTP trades and PnL instead of stale monitor cache.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 09:59:02 +08:00
dekun f41276806e Sync displayed entry price from CTP exchange position average.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 09:19:27 +08:00
dekun 9dbf6b1f1e 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>
2026-06-29 23:47:59 +08:00
dekun d1ad0f9253 Improve dashboard responsive layout, collapsible risk section, and breakeven badge.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:50:48 +08:00
dekun df79017b30 Stream real-time position quotes via tick-driven SSE with incremental UI updates.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 21:14:41 +08:00
dekun 94c566fbe5 Allow scheduled CTP connect when auto-connect setting is off.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 20:38:30 +08:00
dekun 71c480a587 Deduct open position margin from recommend max lots.
Recalculate tradable symbol budgets from remaining margin after CTP usage and refresh the table on position updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 09:39:42 +08:00
dekun fd2dba22fd Add trailing BE to SL/TP dialog and speed up position refresh.
Use modal for monitor upsert with trailing checkbox, refresh CTP tick every second, and push full snapshot after orders.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 09:32:56 +08:00
dekun 45ae57ed43 Fix lot preview crash and improve key monitor WeChat alerts.
Unpack margin_one_lot correctly for fixed-amount sizing, use exchange klines for breakout detection, and notify on pending auto orders.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 09:21:27 +08:00
dekun 840e88daad Add key-level auto trade, AI analysis, and trading UX improvements.
Key monitors use 5m close triggers with WeChat alerts and box/convergence auto orders; add pending-order worker, structured WeChat notify, AI settings/messages, session clock, CTP margin sizing, and dual-layer position limits.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:36:56 +08:00
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 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 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 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 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 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 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 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 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 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 259d9e812d fix: CTP登录冷却持久化到数据库,取消页面自动连并刷新JS缓存
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:01:36 +08:00
dekun 9c8b92d2bd fix: 登录冷却期间不再显示 CTP 连接中,优化前端状态同步
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 16:57:06 +08:00
dekun 4aebc2df49 fix: SimNow 登录封禁(错误75)时冷却退避,停止自动重连
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 16:50:09 +08:00
dekun 72361233a0 fix: CTP重连前探测前置可达性,失败时关闭网关并明确报错
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 16:30:35 +08:00
dekun 649c064c2f feat: 期货下单写入DB来源与开仓时间,CTP同步均价保证金现价
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 15:59:15 +08:00
dekun 0741997818 fix: 持仓手数均价分列、止损止盈显示金额、CTP开仓时间含OpenTime
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 15:48:52 +08:00
dekun de74ffe5b9 fix: 持仓卡片布局优化、闭盘禁用平仓、固定金额step修复
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 15:41:35 +08:00
dekun 9772f3d986 feat: 计仓改为固定手数/固定金额,推荐过滤与CTP保证金,下单与持仓UI优化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 15:31:34 +08:00
dekun 7daed9bd3a fix: 重启后立即读库展示持仓,CTP异步重连不再阻塞
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 14:57:39 +08:00
dekun 01de8dfb69 feat: 持仓委托改止盈止损,保证金改读CTP柜台UseMargin
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 14:50:45 +08:00
dekun 63beda3c71 feat: 盈亏比与亏损额度展示,市价FAK报单,修复止盈止损保存失败
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 14:33:05 +08:00
dekun 367f32dd82 fix: 持仓接口实时拉取并回写本地监控,修复有仓不显示
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 14:14:21 +08:00
dekun 040436e9cc feat: 持仓监控数据库优先显示,修复开仓重复与同步前空白
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 14:06:19 +08:00
dekun bbcc5607ad feat: 持仓监控后台 SSE 推送与浏览器缓存,刷新不再阻塞读柜台。
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 13:49:44 +08:00
dekun f31164076f feat: 非交易时段禁开仓、移动保本与交易结果分类。
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 13:33:17 +08:00
dekun 598a1407e1 feat: 止盈止损秒级监控市价平仓记交易记录,并加手数超限提醒。
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 13:16:19 +08:00
dekun 074551490f fix: 品种推荐改为最大手数并补算旧缓存。
- 最大手数 = floor(权益×保证金上限%÷1手保证金)
- 加载与 SSE 推送时实时补算,旧缓存缺字段时自动刷新

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 12:24:10 +08:00
dekun 9875ee6d44 本地监控止盈止损、盘前自动连CTP,并完善保证金与推荐手数。
- 止盈止损改为程序本地监控,触发后市价平仓(含跳空)
- 交易前30分钟后台自动连接 CTP
- 保证金占用上限默认30%,可在系统设置修改
- K线标准蜡烛图红跌绿涨,费率表全宽固定表头
- 品种推荐按保证金比例×总资金计算推荐手数

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 12:18:18 +08:00
dekun fe1b651900 fix: 止盈止损委托校验现价并在平仓后撤余单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 14:35:20 +08:00