Commit Graph

194 Commits

Author SHA1 Message Date
dekun b6b7bfb248 Add close price column to trade records for overnight position PnL review.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 21:51:53 +08:00
dekun 4552f4ef9c Default equity chain baseline to 100k when live_capital unset.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 21:44:15 +08:00
dekun 0b924fca87 Fix trade log equity_after to chain from initial capital by close time.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 21:41:37 +08:00
dekun 8d2d09396b Fix missing trade log after manual close when CTP is connected.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 21:23:44 +08:00
dekun e5f264b774 Increase trade calendar cell font sizes for readability. 2026-06-30 12:11:57 +08:00
dekun 726ed7adef Add standalone trade calendar page with solar and lunar dates.
Move calendar from stats to /calendar nav page; show Gregorian and lunar on cells, month title, and day detail.
2026-06-30 12:07:58 +08:00
dekun 8ebad6e8a2 Add stats trading calendar and fix CTP position avg/sync.
Calendar shows daily closed trade count and PnL with emotion-day highlighting; day click loads review-first trade list. Use exchange-only entry average and improve vnpy position sync after CTP reconnect.
2026-06-30 11:59:25 +08:00
dekun d07fc4b70d Prefer CTP PnL-consistent entry when vnpy avg differs from SimNow.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 10:51:16 +08:00
dekun e6208e403e Fix roll average entry: CTP trade-weighted avg, sync after fill, live entry for preview.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 10:42:56 +08:00
dekun 6e954da4e1 Lock CTP entry price from position PnL snapshot; match SimNow avg and float PnL.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 10:36:06 +08:00
dekun 6c68808318 Stop entry price jumping: use fixed CTP position avg, not tick-derived.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 10:10:54 +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 2f58159372 Fix slow positions and DB lock on fast live refresh by skipping writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 09:29:42 +08:00
dekun ec4199b82c Restore stop-loss and take-profit monitors after restart and CTP reconnect.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 09:24:37 +08:00
dekun 963ed141e5 Persist CTP average entry price to monitor DB on every position sync.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 09:22:10 +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 c8fef65de7 Fix float PnL to match displayed entry price and contract multiplier.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 09:14:13 +08:00
dekun 92c222584e Show tablet trade records as close-record table with action column.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 00:12:10 +08:00
dekun a6b3c4a657 Align tablet trade records with close-record layout and row actions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 00:05:33 +08:00
dekun 21d68f6269 Use compact single-row trade records on tablet with detail modal.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 23:59:02 +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 c6c6c3fe83 Replace K-line SMA with configurable EMA periods.
Default to EMA 21/55 with editable period inputs and localStorage persistence on the market chart.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 23:17:18 +08:00
dekun 2f5b5c4aae Fix dashboard mobile load issues and simplify card layout.
Reduce poll pressure on phone/tablet, cache key prices, and handle live API errors gracefully. Rework mobile position and close cards with inline direction, compact P/L line, and detail modal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 23:10:20 +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 8b4b1a875c Fix composite margin ratio cap at 50% and add risk guide page with nav toggle.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:29:13 +08:00
dekun 9a10ac8a51 Improve dashboard risk card styling, colors, and add risk control docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:14:11 +08:00
dekun d8c6428eb5 Enhance dashboard with exchange labels, split SL/TP columns, and daily risk limits.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:04:44 +08:00
dekun b460c6c4e5 Enhance dashboard with contract symbols and risk control overview.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 21:40:53 +08:00
dekun 28c54b1a3f Add real-time data dashboard with account, positions, keys, and closes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 21:30:33 +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 c5262a0a54 Add responsive mobile layout, records cards, and tablet settings fold fix.
Mobile gets compact trade/records UI with detail modals; static assets are cache-busted and settings cards fold correctly on tablet grid layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 16:42:38 +08:00
dekun 44bec23296 Add futures roll strategy with breakout monitoring and fixed-amount sizing.
Replace percent-based risk with system fixed amount, support market/breakout add modes only, allow pending submission outside trading hours, and fix short breakout geometry plus route registration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 12:05:21 +08:00
dekun 7ce59d2d71 Detect 10:15-10:30 morning break in trading session clock.
Split day session into 9:00-10:15 and 10:30-11:30; show 上午休盘 status and countdown to 10:30 reopen.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 10:27:21 +08:00
dekun 19676943d0 Align margin display with CTP counter rates and position margin.
Read margin ratios from CTP instrument query and margin-rate API instead of vnpy ContractData (which lacks ratios). Keep occupied margin on position UseMargin; use per-lot max rate for recommend table.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 10:21:44 +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 d366344b0f Fix trailing break-even stop loss not linked to CTP positions.
Match pending monitors to filled positions, reconcile pending on fast refresh, and refresh CTP before promote.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 09:26:54 +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 b02c9d6ca0 Fix empty recommend list and CTP premarket auto-connect.
Correct main_code order in product refresh, refresh on CTP connect, and limit reconnect to trading or premarket windows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 08:24:10 +08:00
dekun f8ff97f93d Add collapsible rule descriptions to trade, strategy, and key pages.
Shared module-rules styling; key monitor rules collapsed by default like other modules.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 07:46:58 +08:00
dekun 4d2463c9a9 Show Tonghuashun symbol meta inline after the variety label.
Move symbol-selected into the label row across all symbol pickers without shifting the input field.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 07:34:05 +08:00
dekun bfb1b95471 Improve key monitor form with bar period, box direction, and labeled fields.
Match order-monitor layout; persist bar_period and enforce upper-direction filter for box breakouts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 07:24:36 +08:00
dekun 169136dd4a Add modular docs with index, WeChat templates, and AI guide.
Document per-module order logic, risk rules, and WeChat message templates with a central INDEX for navigation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:49:10 +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 0109b59f27 Use 100k equity for recommend list when CTP is offline.
When SimNow or live CTP is disconnected, the tradable-products section shows four whitelisted symbols and calculates max lots from a fixed 100,000 capital instead of reference capital in settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 09:16:22 +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 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