Commit Graph

61 Commits

Author SHA1 Message Date
dekun 83ce50b24e Add OKX three-way trade mode for options vs hedge.
Env OKX_TRADE_MODE selects standalone options, perp hedge, or OO hedge; hide the other module UI and use group or position limits per mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 08:28:50 +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 d2028ed0ee Show options budget buffer ratio in open-order rule tip.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 10:37:20 +08:00
dekun 00d76ba20f Stop browser autofill stuffing login username into transfer amount fields.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 10:14:14 +08:00
dekun 88d460d484 Options: collapse open rules; move open-guard tip into risk policy.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 08:46:02 +08:00
dekun ed1ec6f14a Options: default nearest expiry and env ask-liquidity chain filter.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 08:37:39 +08:00
dekun 972ef4f910 Options: loosen order dialog spacing and stack mode/note rows.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 08:15:55 +08:00
dekun 4e614eb9ed Options: frame target and size-mode chips like cancel buttons.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 08:11:23 +08:00
dekun 547eedeec4 Options: show order form as viewport modal on select.
Stop inserting the panel under the strike row; mount backdrop on body with cancel/Esc close.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 08:06:07 +08:00
dekun 19b46d19fd Options: eth-amount dialog, stop note autofill, pending tab in positions.
Selecting 指定币数量 opens an order dialog; pending orders move into a 当前委托 tab after 当前持仓; harden remark autofill that showed dekun.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 08:00:39 +08:00
dekun 899a2de931 Show options position source (纯期权/永期/期期) on holdings cards.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-19 08:45:17 +08:00
dekun d7272c9722 Persist options review deletes across local resync.
Hide deleted rows by history key and contract/close fingerprint so local options_trades imports no longer resurrect them.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 10:03:00 +08:00
dekun 8f71dbe874 Show hedge targets in options monitoring
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 07:15:00 +08:00
dekun 4686cf049a Require real ask depth for options and hedge opens.
Block mark-as-ask opens, show reference mark when no depth, cap sheets to ask size; leave close paths unchanged. Document in docs/更新文档.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 12:48:53 +08:00
dekun 195eeae295 Fix options select UI and false contract-missing quotes.
Keep the order host out of tbody wipes, sync pick-button labels, and retry/fallback OKX meta under rate limits so live contracts are not reported as missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 12:18:41 +08:00
dekun 12c4e55f24 Fix intermittent empty options expiry dropdown after coin select.
Retry instrument fetch, reject empty chains instead of caching them, and ignore stale loadChain races.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 12:04:08 +08:00
dekun 4c7197ad99 Fix options chain headers mixing list and T-view columns.
Thead rows used a .hidden class with no CSS rule on instance pages, so both header sets stayed visible.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 11:57:07 +08:00
dekun a21b962bf1 Fix options mark price float junk and target index input rollback.
Skip full card redraw while the monitor target field is focused, and format mark/avg without relying on dusty server strings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 22:24:52 +08:00
dekun 6f934ecbbf Clarify 2x recycle is a target-close gate, not auto-close.
Rename UI copy from auto-close to target gate so 2x alone is not read as a close trigger.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 22:16:06 +08:00
dekun cbb7f954f5 Auto-cancel stale option close limits after pending TTL.
Default 10m via OKX_OPTIONS_PENDING_TTL_SECONDS; show age/countdown in pending panel; monitor loop cancels sell closes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 22:06:24 +08:00
dekun ee7be3e7f3 Align options realtime PnL with bid-net and show totals in stats.
Header float PnL now uses bid recycle minus premium like position cards. Stats adds realized/open/total net PnL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 22:00:45 +08:00
dekun 1909eea654 Use bid1-only option closes with hard-disabled market exits.
Manual close checks liquidity only; target auto still requires 2x recycle hold once, then reuses the shared bid1 executor. Add /options/guide doc and update hedge-plan refs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 21:49:06 +08:00
dekun ab8b2a74e2 Show cancellable pending option orders beside the order form.
Fetch live OKX option hangs on the right after submit, with refresh and one-click cancel.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 21:22:29 +08:00
dekun 61f63c456b Use bid-only limit closes when option index targets hit.
Target price is only for monitoring; auto flat waits for 买一 instead of falling back to mark.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 15:53:08 +08:00
dekun d6823a2903 Add options index target monitors that auto limit-close on hit.
Position and order forms can arm a target; right-side and hub panels show active monitors; expiry remains the stop with no separate SL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-15 15:27:46 +08:00
dekun 6f6545ce52 Add T-shaped options chain view with straddle metrics (phase A).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 15:00:50 +08:00
dekun c9c8388250 Improve options order estimates and chain filter defaults.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 14:37:53 +08:00
dekun 68733eb4f9 Show average profit and loss in option stats panel.
Expose avg_win and avg_loss from stats API and update chart labels and values to match the average-based P/L ratio.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 09:29:26 +08:00
dekun bf2d668d3c Fix option history to full closes only, 2-decimal USDC, restore hide-delete.
Filter OKX positions-history to type 2/3/6, format premium and bid recovery to 2 decimals, and allow locally hiding rows via delete button.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 09:24:24 +08:00
dekun fdea5bb610 Align option display precision with OKX and use exchange position history.
Format prices by tickSz, move bid depth/recovery to card end with plain styling, and load option history from OKX positions-history instead of local DB.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 09:14:43 +08:00
dekun 1b31c61aac Simplify option close depth display.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 09:04:17 +08:00
dekun e8a55a0f85 Polish option close depth display.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 08:57:19 +08:00
dekun 6e45604d93 Add depth-based option close flow.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 08:46:07 +08:00
dekun d1ab2d5172 Add options stats holding time metrics and lightweight charts.
Show average hold duration for wins and losses, open positions, and CSS ring/bar visualizations in the stats tab.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 11:32:45 +08:00
dekun 9f255f13dd Add ITM and OTM filter toggles to options chain.
Default to in-the-money view with at-the-money contracts included; update expiry counts and empty states for the active filter.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 11:25:24 +08:00
dekun b70ce510ef Add tabbed layout for options positions card.
Split current positions, stats, and history into tabs to save vertical space and improve readability.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 11:19:33 +08:00
dekun f99900ac40 Fix intermittent loss of options positions and realtime PnL on refresh.
Use stale-while-revalidate for positions API and UI, throttle sync calls, and avoid overwriting displayed PnL with null on transient failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 18:09:58 +08:00
dekun 5a97e14f3e Fix false options close sync, restore bar layout, and show open premium in history.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 17:51:07 +08:00
dekun 08a61fd4ae Tighten options position bar grouping and compact history table status layout.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 17:43:24 +08:00
dekun 3d11b91869 Expand options position card inline below the clicked bar.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 17:06:22 +08:00
dekun ff83f6eebc Refine options position accordion: default collapsed, 2dp PnL, card outside scroll.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 17:00:06 +08:00
dekun f41af0bf1c Improve OKX options sizing, expiry sync, and multi-position accordion UI.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 16:51:48 +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 279648de56 Add hub TP profit field, 2-decimal options PnL, and exchange mark price display.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 17:22:26 +08:00
dekun 189b27e076 Add live expiry countdown for options positions on instance page and trading hub.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 11:14:30 +08:00
dekun 75a64c5d24 Show premium paid on options position card and parse strike/type from instId when OKX omits them.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 10:40:07 +08:00
dekun 43fa1ad1f3 Show OTM options in chain even when ticker has no quotes.
Stop skipping contracts with empty ask, bid, and mark so out-of-the-money strikes remain visible in the list.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 07:28:11 +08:00
dekun 7f225c7407 Estimate missing option ask from mark or intrinsic on chain list.
Deep ITM contracts often have no ask on the book; show mark-based estimates with a tilde and restore breakeven calculations.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 17:50:25 +08:00
dekun 25879dd007 Show equivalent contract leverage on options order panel.
Display notional-over-premium leverage at current index and at the user target price for quick sizing comparison.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 16:58:25 +08:00
dekun 27921213b0 Add expiry profit estimate and remove chain quick-buy button.
Let users enter a target index in the order panel for estimated expiry P&L, and remove the redundant buy button from the options chain row.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 16:46:21 +08:00