Commit Graph

35 Commits

Author SHA1 Message Date
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 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 44fd0371b9 Fix OKX abandon residual double-book and fill/residual ledger holes.
After dual-close leaves option pending, continue close_group instead of false residual; reject partial fills on wait timeout; LIVE residual settle allow_negative.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 20:20:36 +08:00
dekun 81e51236c0 Align funds to OKX funding/trading only; fold rules; match settings width.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 17:59:28 +08:00
dekun 5c3bd4b654 Add OKX-style funds bar with USDT/USDC convert and transfer.
SIM uses multi-wallet balances; LIVE hits OKX asset/account APIs and spot USDC-USDT swap. Funds strip hides sim labeling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 17:06:13 +08:00
dekun 1c75db4a19 Split fee stats by leg and hide LIVE slip.
SIM shows perp/option fees and slip separately; LIVE keeps real exchange fees only with slip forced to zero.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 16:37:18 +08:00
dekun 8518a207a7 Show expiry settlement as index vs strike intrinsic.
Persist settle_index_px and surface formula in trade detail so expiry closes are not mistaken for book fills.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 16:15:22 +08:00
dekun 3df64aeb2d Show open time and hold duration on position cards.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 15:41:56 +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 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 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 96e8e5cb70 Show option/perp PnL and fee-deducted net in trade details.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 16:14:48 +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 f25c79fd76 Close option before perp so the hedge stays while exiting the thin leg.
EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 13:03:51 +08:00
dekun 32e8de85cc Show option top-of-book size and open option before perp.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:57:16 +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 5dcec0fde0 Add configurable SIM equity (default 10k) and strategy docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 11:43:51 +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 ab7daa31e6 Fix option UPL to bid times size minus initial premium.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 09:32:12 +08:00
dekun fd4597f735 Compute option UPL as initial premium minus bid times size.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 09:28:40 +08:00
dekun 77ae6a44b9 Show option expiry countdown and widen settings for ultrawide/tablet.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 09:24:11 +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 e19bb452f9 Split exchange and strategy modules for future Binance support.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 08:43:09 +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 7db4c9c8a3 Realign ATM to current mark before open; skip while in position.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 07:52:37 +08:00
dekun 1155cf082d Show OKX-style perp/option position cards on plan page.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 17:32:57 +08:00
dekun 5125c6702b Fix running status color; add ETH qty settings with Chinese labels.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 17:24:27 +08:00
dekun 8ea05e7064 Fix PriceResult slots serialization that broke open-group response.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 17:09:38 +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