Commit Graph

274 Commits

Author SHA1 Message Date
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 a2075ba73e Cap options budget-full sizing at min(balance, trade budget) with UI hint.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 08:54:38 +08:00
dekun 890659f173 Add key monitor and live trade toggles to instance nav display prefs.
Defaults stay on; users can hide them like other top-bar tabs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 00:55:31 +08:00
dekun ca499c6104 Send WeChat alerts on OKX options open and close.
Cover manual, target, and exchange/expiry sync with idempotent sent flags.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 00:48:15 +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 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 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 58e9c8f85e Feed options positions and playbook brief into trading coach.
Coach context previously omitted options_snapshot details; also inject a short 执行手册 summary each turn.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 23:28:16 +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 301a464f29 Add daily loss-count freeze for account risk cooldown.
RISK_DAILY_LOSS_LIMIT (default 2, 0 disables) freezes new opens after N losing closes in the trading day.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 22:13:38 +08:00
dekun 60ff45f098 Fix hedge option PnL match by parsing opened_at as Asia/Shanghai.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 10:21:52 +08:00
dekun 7e7666adfb Align hedge plan option leg PnL with OKX exchange history.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 10:09:44 +08:00
dekun 6876515160 Align options review PnL with OKX positions-history realizedPnl.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 10:05:27 +08:00
dekun 1bc12a32c6 Sync exchange PnL when hub loads trade records API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 09:40:42 +08:00
dekun 5b346a5760 Hedge start: re-quote ask and resize OO sheets; add HEDGE_PLAN_BUDGET_BUFFER.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 10:09:32 +08:00
dekun a43cb35d9a Add end-plan action; never show unfilled option legs as open.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 09:36:46 +08:00
dekun 8597e47596 Hedge options open: require full fill (IOC + wait) before success.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 09:14:03 +08:00
dekun 72dddc5106 Fix options review screenshots missing after journal upload hijack.
Stop journal_upload_slots from binding options slots; resolve journal_* files from static/images root so existing reviews display again.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 16:23:37 +08:00
dekun 12574ae88a Fix options review empty lists when search box has symbol text.
Treat the filter as fuzzy q over underlying/inst/strategy (BTCUSDT->BTC) instead of exact strategy_tag, which always wiped pending rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 16:17:45 +08:00
dekun 38ac258497 Color 期期 preview PnL and show RR vs full premium loss.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 15:43:01 +08:00
dekun 7938628485 Fix 期期 sheets bias: split total 2n from same-sheets, not n.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 15:33:00 +08:00
dekun e3cd2a75de Replace 期期 equal-split with long/short bias sizing and env ratio controls.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 15:25:10 +08:00
dekun 5e0ce43415 Add instance system guide nav (default off) with overview/options/hedge manual.
EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 09:23:30 +08:00
dekun d74d0aeae0 Park partial hedge plans for manual leg complete instead of auto-close.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 09:06:22 +08:00
dekun e11c13747a Add mutual-exclusion gate between hedge plans and standalone options.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 08:51:46 +08:00
dekun 3119486105 Add 期期 close mode (全平/到期平) with scheme-C env toggle.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 08:06:27 +08:00
dekun b3548240cc Auto-fill 期期 sheets from trading balance with same-sheets default.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 00:56:35 +08:00
dekun f21e4d1166 Add env toggles to show/hide perp and options hedge plan tabs.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 00:43:04 +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 faf21da955 Show trade record prices at exchange tick precision.
API enriches entry/SL/TP with price_to_precision display strings; OKX formatter now uses the same path as Gate/Binance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 15:41:49 +08:00
dekun 0a14fe73c1 Add key auto-order toggle to instance env config UI.
Expose KEY_AUTO_ORDER_ENABLED and KEY_AUTO_MIN_PLANNED_RR under 交易执行 so the frontend matches the settings readout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 15:31:39 +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 813ecdd4ac Lighten hub options snapshot by skipping history stats.
Monitor board only needs positions, balances, and targets; drop the OKX positions-history pull each poll, and surface timeout errors via msg.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 15:00:55 +08:00
dekun 173f09300b Align instance dashboard with hub snapshot+SSE pattern.
Background poll builds a memory snapshot; the page reads snapshot and refreshes on SSE instead of hitting heavy exchange APIs on each load.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 22:00:30 +08:00
dekun aabbbef0a9 Turn position/margin/sizing/direction env fields into dropdown selects.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 19:41:47 +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 549d8a015c Show pure-option source and net PnL on dashboard.
Restore 纯期权 label for non-hedge option rows and use close-preview net PnL instead of exchange upl.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 14:32:43 +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 c2a40e3cc5 Fix empty AI review content from gemma reasoning token use.
Parse alternate reasoning fields, retry with a larger max_tokens budget, cap review images, and fall back to text-only when vision returns empty.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 13:21:06 +08:00
dekun f27b4bc1ec Fix OKX header trade stats stuck at zero after settings shell load.
Always SSR records summary on embed shell (including settings/risk/env), and refresh total/win-rate/PL ratio via account_snapshot so soft-nav cannot leave the strip blank.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 13:03:04 +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 f7ba7c2f7d Auto-fill journal direction from trade records.
Add a required direction field on the review form, persist it, and set long/short when clicking 填入复盘.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 12:00:09 +08:00