Commit Graph

61 Commits

Author SHA1 Message Date
dekun 7352d10254 Fix hub total floating PnL by excluding OKX options from swap agent.
Option legs were scored with linear swap math and then added again from the options snapshot, inflating 总浮盈亏 and 持有仓位.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 22:13:22 +08:00
dekun d89aff3ad6 Use absolute coin counts in perp-options points mode.
Treat 2:4 as 2 perp + 4 option coins instead of normalizing to 1:2, and disable embed page caching so hub iframe picks up trade UI updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 22:54:16 +08:00
dekun 9f3395de2f Add sideways max-loss to perpetual-options calculator.
Show premium wipeout plus flat round-trip perp fees as case C for both size and points modes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 22:38:20 +08:00
dekun 26bc19f047 Add two-day amplitude window to amp-stats.
For each settlement day, also compute H-L over start minus one day through 16:00 (e.g. 25 16:00 to 27 16:00).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 15:05:38 +08:00
dekun c81ba147cc Replace amp-stats straddle/perp overlays with move-points amplitude ratio.
Input points now drives amplitude hit share; table keeps both-side moves and amp达标.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 14:56:48 +08:00
dekun 90be23e845 Fix amp-stats perp PnL to exit at daily profit target.
Hit A/B via open-to-high/low; day PnL equals target when touched, otherwise settle at close.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 14:41:29 +08:00
dekun 2ce67da8e8 Use daily open as perp-hedge entry and toggle buy-straddle vs perp overlays.
Amp-stats now prices premium from each day's open, and the form switches mutually between straddle and perpetual-options对照.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 14:31:17 +08:00
dekun d049c5d317 Add perpetual-options hedge overlay to amp-stats with hit rates and daily PnL.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 14:20:42 +08:00
dekun a908dccaba Add ratio-to-move-points mode for hub perpetual-options calculator.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 12:47:17 +08:00
dekun 4bcf88b5cb Add hub perpetual-options hedge calculator tab and sizing formula.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 12:37:51 +08:00
dekun b43e33e24f Register instance_mobile_nav.js in shared static asset routes. 2026-07-27 07:13:20 +08:00
dekun 54f1857fa2 Sync OKX options closed trades into hub archive with a separate tab.
Mirror perpetual archive flow into archive_options_trade_cache for offline calendar and review.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 00:39:59 +08:00
dekun 6f1ae14b3d Add display toggles to hide monitor cards and strategy tabs.
Keep unused exchanges/docs out of the UI without disabling accounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 00:24:00 +08:00
dekun 29d59d6a53 Add playbook v2 without hedge as the primary strategy guide.
Wire hub strategy tabs and coach brief to 1H→space→structure→risk/reward→options/perp only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 00:09:40 +08:00
dekun ed3033d793 Add hub strategy compare page for perp vs options vs 7:3 hedge.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 14:39:59 +08:00
dekun 8a9dee267f Add open-trade three-check behavior guidelines.
Document signal/process/emotion firewall, expose it in hub strategy tabs, and brief the AI coach.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:15:47 +08:00
dekun 910c938d0a Throttle OKX amp-stats candle pagination and retry on 429.
Add page pauses, exponential backoff, and cooldown before swap fallback to avoid rate limits.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 02:57:24 +08:00
dekun 0a9e3aa95c Fix amp-stats long-range candles via OKX history endpoints.
Recent candles cap near 60d; continue with history-index/history candles and color profit green/red.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 02:53:36 +08:00
dekun b64c742fc9 Add weekend filter, take-profit, and profit column to amp stats.
Long-straddle effective move uses TP on path hit (>=) else abs change; mark Sat/Sun on settlement days.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 02:47:20 +08:00
dekun 789ab43dbe Add long-straddle premium overlay to hub amp stats.
Configurable bilateral premium with exceed counts/ratios and settlement PnL for buying volatility.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 02:33:23 +08:00
dekun 61e8da1e8b Add hub-only OKX amp stats for ETH/BTC session windows.
Read-only 1H index candles, point amplitude metrics, history save and CSV export; no order-path changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 02:06:21 +08:00
dekun e7f8e9201e Show trading playbook in hub strategy docs.
Add an 执行手册 tab that renders docs/交易执行手册-期权与Gate.md as the default strategy view.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 22:16:54 +08:00
dekun 4a3e6a2a1d Add global autofill guard for hub, env, and transfer inputs.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 10:18:56 +08:00
dekun 778a215ad7 Fix strategy checklist print closing too early.
Stop auto-closing the print tab on afterprint (short checklist pages were especially fragile), load print HTML via fetch into a blank window, and use CSS checkboxes instead of Unicode ballot boxes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 16:16:34 +08:00
dekun 8f4ae8ad31 Speed up journal save with AJAX and async K-line charts.
Defer exchange chart generation to a background thread and save via XHR so fill-from-trade no longer blocks on full page reload.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 15:15:24 +08:00
dekun 2269bc51ff Deduct round-trip taker fees from estimated perp PnL.
Unify hub/instance TP profit, calc_pnl, and push/accounting to net of 0.05% per side; leave exchange floating PnL unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 15:12:52 +08:00
dekun c4c8ad172a Label dashboard positions from monitor sources with priority.
Match hedge/roll/trend/order/key monitors for source badges, show option target monitors in green, and refresh the dashboard with the board 5s cycle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 14:25:36 +08:00
dekun 35117ba84e Polish dashboard tables: hub-style orders, options source/expiry, hedge status.
Show 进行中 in green for active hedges; options columns include source/target/expiry; merge live mark/contracts/pnl from price snapshot.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 12:23:25 +08:00
dekun c7aae67881 Add instance data dashboard (default off).
Read-only overview of live orders, key monitors, and strategy; show options/hedge only when present. Toggle via system settings nav prefs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 12:09:29 +08:00
dekun d9b8069906 Add shared records review pagination for all three exchanges.
Paginate trade records, journals, and AI history at 5 per page with soft in-card flips; hide the journal form until 填入复盘.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 11:52:02 +08:00
dekun 717a3d5694 Add cumulative P&L banner to fund overview for at-a-glance profit/loss.
Expose period delta from equity curve start and surface it in the toolbar and summary cards with green/red cues.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 00:19:43 +08:00
dekun 9f0a30a040 Add hub usage help page with settings nav toggle.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 10:02:07 +08:00
dekun edfe935fb4 Register instance_stats.js static route so period tabs work on all exchanges.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 14:02:24 +08:00
dekun d092f213a7 Fix hub system logs by resolving PM2 log paths from jlist and glob fallback.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 10:38:24 +08:00
dekun 5214794f95 Add hub system logs page with PM2 stdout/stderr tabs for all exchanges.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 10:33:14 +08:00
dekun 4abe8a6ca9 Fix instance settings prefs JS 404 on static route.
Register instance_settings_prefs.js (and options_panel.js) in install_instance_theme_static; add delegated click handlers for embed lazy tabs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 00:07:30 +08:00
dekun b733e551a0 Normalize fullwidth punctuation to ASCII across codebase.
Add scripts/normalize_ambiguous_unicode.py; fix corrupted patch_instance_theme_templates.py. Preserves curly quotes in string literals; removes Git homoglyph warnings on .env.example.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 23:42:26 +08:00
dekun e3e53ff7f5 Fix roll position display: live contracts, TP profit, and 2-decimal qty precision.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 17:06:33 +08:00
dekun 4a3afdfb48 Fix monitor board crash: avoid shadowing options_open_position_count helper.
Rename the imported counter function so aggregate_monitor_board_totals no longer overwrites it with an int accumulator.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 13:09:39 +08:00
dekun 3163912266 Hub funds and dashboard: include OKX options balances in USDT totals.
Merge options USDC/USDT at 1:1 into fund overview snapshots, dashboard aggregation, and monitor board totals while keeping a separate options breakdown in the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 13:06:01 +08:00
dekun 6cc3382526 Hub monitor: read-only OKX options positions aggregation (Phase B).
Expose /api/hub/options/snapshot from OKX instance and render options summary on hub monitor cards when the options capability is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 12:55:35 +08:00
dekun 3db84d07e3 feat: instance embed SSE live push and lighter tab revisit
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 11:01:10 +08:00
dekun d7fa596e68 feat: auto sick tag in archive from journal mood issues
内照明心同步时匹配实例复盘情绪标签,自动标注犯病并锁定标签;中控不再手动选犯病。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 01:12:47 +08:00
dekun f580e4542d feat: show entry type as category/subtype (反转/启动A)
Format持仓与交易记录开仓类型为两级展示;新平仓写入与旧短标签自动展开。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 00:27:53 +08:00
dekun 8e1492e4f0 Fix mark/PnL display fallback and intraday entry labels
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 22:19:42 +08:00
dekun d4a76f05d2 Fix Gate mark/PnL/TP-SL snapshot and intraday order UI
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 22:04:19 +08:00
dekun e62a3f3351 feat: market divergence scan tabs (4h/1d/1w) with Top20 MACD confluence colors
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 19:58:30 +08:00
dekun 22b2db34fc feat: MD-style popup print for strategy doc and checklist
Open clean white document in new tab with auto print dialog instead of printing the dark hub page.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 03:28:44 +08:00
dekun 7223b54ec4 feat: add hub strategy docs page with MD and checklists
Central /strategy page shows per-exchange strategy markdown and read-only entry checklists; nav toggle in settings, print and HTML export per tab.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 03:12:09 +08:00
dekun e526d6af76 fix: 注册 order_entry_model.js 静态路由,embed 内联联动逻辑
中控 iframe 下 JS 404 导致小分歧/杠杆不更新;boot 脚本内联兜底。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 00:34:26 +08:00