Commit Graph

41 Commits

Author SHA1 Message Date
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
dekun 14c6ba51a8 Show trade open/close times and hold period by target exit.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 15:37:37 +08:00
dekun 56a4007130 Add WeCom markdown alerts and keep target exits while strategy is paused.
Notify open/close/start/pause/fault with SIM vs LIVE venue labels; configure webhook in Settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 23:19:39 +08:00
dekun 2b348854fe Add DB+.env auto backup with download and upload restore in Settings.
Backups land under /root/eth_hedge_backups; restore accepts zip body for new-server migration and restarts the process.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 23:05:58 +08:00
dekun 9d3b36826c Include LIVE close-fee estimate in target PnL; rest after manual and emergency close.
Align docs so LIVE exit matches SIM fee buffer; manual full close now enters rest_seconds like auto/emergency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:58:10 +08:00
dekun 16efa44ffb Hide manual trade by default, block open while running, auto-refresh auth token.
Also fix flat-side reconcile to check both long and short residuals; document in 更新说明.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:43:38 +08:00
dekun 0cf3756b09 Harden LIVE opens with slot claim and exchange reconcile.
Prevent duplicate opens by atomically claiming an opening slot, verifying exchange perp is flat before live orders, setting leverage from ledger, and preferring exchange position size when closing perps.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:39:27 +08:00
dekun f48ea5bbcc Audit fixes: LIVE symbols/fills/expiry/pending, security harden, add 更新说明.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:28:03 +08:00
dekun ca66c494e7 Use exchange fees, UPL, funding for LIVE PnL; USDC 1:1 to USDT.
Option open P&L stays local (option net); exit target ignores estimated close fees.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 21:49:20 +08:00
dekun dbc86a1ce6 Add Binance live trading, anti-stuck open/close recovery, and configurable rate limits.
OKX/Binance LIVE share half_open and option_closed_perp_pending repair paths; private REST throttles default to 1s and are tunable in settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 21:35:10 +08:00
dekun e666230d0b Add SIM/LIVE switch with API keys saved to .env and OKX live executor.
Enable settings UI for mode/keys, gate strategy start when LIVE is not ready, and stop PM2 from forcing MODE=SIM.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 21:08:39 +08:00
dekun 38ffbf728b Pin market watch to held option strike while a position is open.
Stop falling back to ATM quotes for unrealized/close PnL after ATM drifts or restart.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 18:37:20 +08:00
dekun 4994aaab16 Implement dual target-close paths and residual option expiry.
Document and enforce: A full dual-leg close, B perp-only when deep OTM with residual archive that does not block next open, and expiry settlement when target is missed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 18:32:05 +08:00
dekun e3671d9798 Settle expiry options at intrinsic value like live exchange.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 16:08:44 +08:00
dekun a58d97938c Floor option close at intrinsic to fix expiry garbage quotes.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 16:07:20 +08:00
dekun fff285c1f9 Add ATM open-offset toggle default off.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:42:20 +08:00
dekun 79c074ec6c Prefer open direction from ATM vs spot (below=Call/short, above=Put/long).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:39:23 +08:00
dekun ee0ec57f89 Gate opens when ATM-spot offset exceeds configurable max (default 3).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:32:36 +08:00
dekun 586469482e Fix Binance boot using OKX symbols after restart.
Startup ignored DB exchange choice and kept OKX ATM ids under a Binance health label, so option bid/ask stayed empty.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:13:19 +08:00
dekun 78fd046fb6 Add Binance SIM market adapter and exchange switch in settings.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:02:36 +08:00
dekun b50c134f5b Add weekend open skip, expiry force-close, and Chinese trade labels.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 10:28:33 +08:00
dekun cce26e87b5 Add dual exit modes: fixed USDT or premium multiple.
Net PnL (after estimated close fees) drives auto close; Plan/Settings expose the choice.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 09:17:50 +08:00
dekun 9fd2a842af Add option close liquidity gate with 30% bid/mark cap.
Block new opens while flat legs wait; emergency close bypasses the check.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 09:05:04 +08:00
dekun 3957a83761 Revise strategy: TTM+ATM+leverage option pick, % exit, perp leverage/margin.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 08:38:03 +08:00
dekun 51b8bb8f8a Implement P1 local matcher/ledger and P2 strategy engine.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 17:03:46 +08:00
dekun e51f357b48 Initial eth_hedge_sim: P0 market, auth UI, one-click deploy.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 16:33:25 +08:00