75 Commits

Author SHA1 Message Date
dekun 3520fc0214 Fix OO expiry Put PnL: overlay wrong near-zero settlement fills with intrinsic.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 17:02:44 +08:00
dekun 77d2effb6d Backfill OO expiry settle display via public ETHUSDT and intrinsic overlay.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 16:58:02 +08:00
dekun 3264dd4381 Fix OO expiry settle index: persist spot and never invent strike from OTM fill.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 16:44:56 +08:00
dekun 4a5d19e30f Fix OO trade records: include Put PnL and show dual-leg detail clearly.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 09:34:35 +08:00
dekun 3491681c28 Mirror option expiry settlements from exchange bills; debit OO LIVE open premiums.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 16:02:16 +08:00
dekun 8d67f3fc6c Fix LIVE SoT P0/P1: closing state machine, OO exchange fills, BN balances.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 15:54:45 +08:00
dekun 99e58910d3 Treat exchange as LIVE SoT: expiry closes perp only, no invented option settles.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 15:44:15 +08:00
dekun 626c9c1323 Fix semi strike-target test not tripping net lock early.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 15:00:02 +08:00
dekun 4f56eff40c Anchor semi exit to strike +/- move points; side-by-side semi cards.
Forward target is K+/-N not spot+/-N; UI shows option target and perp net lock.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 14:59:48 +08:00
dekun 6f983ed2ab Try all OTM strikes in offset when nearest fails leverage.
Closest Call@1920 at 152x no longer blocks 1930/1940 that already clear 200x.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 14:52:26 +08:00
dekun f1e3d5527a Fix semi open stalls: one-leg asks, OTM realign, clearer pick errors.
Monitor no longer shows ATM Put bias while semi-auto is authorized for Call.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 14:43:00 +08:00
dekun b09d1b0886 Show semi risk-based open size from ask and unit ratio.
Semi sizing uses market ask with semi units; Plan panel previews option/perp qty under the form.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 14:27:19 +08:00
dekun 457838ef64 Extend semi-auto with ITM/ATM/OTM, offset, and 1:4 sizing.
Moneyness and perp:option units are plan-only; OTM enforces leverage >=180.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 11:42:57 +08:00
dekun 4585dba3c3 Add 永期半自动: human arm, machine open/close, then stop.
Settings toggle, Plan panel, Fleet monitor, exit locks and armed TOCTOU gates; docs and dual audits.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 11:20:11 +08:00
dekun bf3441537e Fix target-exit mismatch: correct close reason and executable PnL gate.
Locked premium exits no longer label as fixed_usdt; mark/book optimism no longer triggers close into a realized loss.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 22:05:34 +08:00
dekun a88d708ea3 Add amplitude filter as first open gate for 永期 hedge.
Reuse OO amplitude settings (default off); Plan shows index/HL when filtering.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 21:41:51 +08:00
dekun ab612df818 Move settings hints into rules; add OO amplitude filter toggle default off.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 17:58:50 +08:00
dekun 0daac05ef5 Reject OO strikes more than 1% from amplitude high/low.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 17:50:12 +08:00
dekun 24a860ad3f Split OO budget per leg and size Call/Put independently.
Each half of the risk budget buys its own qty from ask; equal qty no longer forced.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 17:08:05 +08:00
dekun 24943adf13 Fix option-option exit preview to use budget times reward ratio.
Plan no longer shows perp exit_unit*k as the OO target.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 16:41:51 +08:00
dekun eaf94448a2 Treat option-option amplitude as a maximum cap.
Reject opens when range exceeds the setting; update UI and docs labels.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 16:35:39 +08:00
dekun 42e56d940c Add delete for closed trade records.
Only closed groups can be removed from local history; equity is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 16:06:36 +08:00
dekun ec244c63c6 Add option-option hedge mode with SIM/LIVE parity.
Mutual hedge_mode, amplitude OTM selection, 1:1 risk sizing, win-leg/full close, dual audits and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 16:01:16 +08:00
dekun 04e5c11027 Count expiry settlements as martingale losses.
Even small-profit expiry closes count toward consecutive loss days; only non-expiry profitable days break the streak.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 15:08:44 +08:00
dekun 930e6c26c5 Clear trade history when resetting sim equity.
Deleting groups/fills/residuals and resetting strategy counters keeps funds reset a clean slate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 14:49:51 +08:00
dekun 0f552eb50e Add martingale mode for risk-based percent sizing.
Enable in settings (default off): after N consecutive loss days, double the effective risk_loss_pct up to a configurable max; blocked when base pct > 3%.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 09:55:29 +08:00
dekun 09abb8d35b Show residual bid as price/size and recovery percent from bid premium.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 07:43:27 +08:00
dekun a10ecf7409 Gate one-open-per-expiry by historical expiry_ymd across days.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 07:35:44 +08:00
dekun 5c334a4d89 Use all-time closed groups for funds bar trade stats.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 17:07:47 +08:00
dekun d97f7d20e5 Fix funds bar day stats: align trades, win rate, and PL ratio.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 17:05:11 +08:00
dekun a7aee8f425 Add control residual options table with liquidity-only manual close.
Fleet status exposes enriched residuals; manual close skips the premium recovery gate while auto mid-close remains unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 15:13:29 +08:00
dekun 469e7a258a Harden residual mid-close: IOC partial fills, exchange reconcile, atomic book.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 14:41:00 +08:00
dekun 62c91d4bd0 Close residual options when premium recovers above configurable threshold.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 14:19:21 +08:00
dekun 8745d8e6d1 Add fleet stats table with funds, fees, loss streak, and totals.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 12:25:30 +08:00
dekun 9427d9c429 Skip used/residual expiries so ATM monitors the next day.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 10:31:07 +08:00
dekun 0e3b9e53ac Enrich WeCom open/close notifies with Chinese qty, margin, and PnL.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 08:58:49 +08:00
dekun 9c515644a3 Add risk leverage basis option: actual ask vs selection leverage.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 17:01:18 +08:00
dekun f1da2778ef Add one-expiry-per-day open rhythm gate (default on).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 16:39:32 +08:00
dekun 22c42a19a0 Count exit fees in live/SIM net PnL as entry fee x2.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 09:27:41 +08:00
dekun 021b0d0a22 Align emergency option close to OKX: use bid only, never mark.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 17:15:38 +08:00
dekun da5eb4c18c Add Fleet control plane and split manage.sh deploy menu.
Strategy nodes gain fleet token APIs; control/ app for local ops; manage.sh offers strategy vs control one-click deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 10:46:40 +08:00
dekun 200702d066 Harden strategy SoT: fail-closed funds gate, shared open pipeline, LIVE switch guards.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 01:06:32 +08:00
dekun 4c537e7520 Reset auto USDC cooldown in unit tests for stable assertions.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 00:34:36 +08:00
dekun 0837982714 Add OKX trading-account USDC auto-swap and lock exit target while in position.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 00:16:47 +08:00
dekun a47a9b6377 Polish risk sizing: 2dp money preview, editable ratio/exit, plan badge.
Exit unit and perp/option units scale with k; plan page shows 以损定仓.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 23:48:34 +08:00
dekun 3a4c8d639c Add risk-based position sizing (以损定仓) with per-open k resize.
Manual vs risk modes are exclusive; each open floors k to 1 decimal so estimated premium+fees stay within the loss budget.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 23:32:42 +08:00
dekun 0ee1d8be5d Add fixed-direction switch for perp/option open side.
When enabled, lock perp long→buy Put or short→buy Call with ITM/ATM only; off keeps ATM/ask rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 19:18:12 +08:00
dekun 55109e82d3 Hide SIM label in WeCom; count completed rounds from closed groups.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 18:15:09 +08:00
dekun 70a294c948 Restore hold_timing open-position unit test.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 15:42:10 +08:00
dekun 3d7c453bd1 Fix trades API 500 by supporting sqlite Row in hold timing.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 15:41:27 +08:00