eth-focused-portfolio-live-readiness.md 5.3 KB

ETH-focused portfolio live readiness

Read-only static inspection. No OKX request, order, or cancel was made.

Topline

  • Ready for quasi-live: False
  • Submit-capable code exists now: True
  • Should submit now: False
  • Reason: Required order lifecycle, state ownership, scheduling, and audit pieces are missing or only partial.

Checklist

Check Status Category Gap Minimum task
OKX post-only entry support missing must No code path emits ordType=post_only or deterministic client order ids for ETH portfolio entries. Add a read-only order-intent builder that renders the exact post_only order payloads for each required entry level without submitting them.
Batch entry order support missing must The conservative portfolio can require multiple leg/order intents; the client cannot express an atomic or coordinated batch. Define the portfolio order-intent shape for all active legs and add a non-submitting batch payload renderer.
Cancel open orders missing must A quasi-live loop cannot expire stale maker orders or clear outstanding leg orders. Add read-only cancel-intent generation from tracked open order ids, then add client cancel/list methods before any live runner is enabled.
State persistence partial must There is no dedicated ETH portfolio state containing signal clock, order ids, fills, exposure, and audit events. Add a dedicated ETH portfolio state schema and read/write command for quasi-live intent tracking.
Position isolation partial must Isolation exists only inside the single-order submitter; portfolio readiness still needs the same fields in generated leg/order intents and close intents. Require tdMode=isolated, posSide=long, and bounded leverage in every generated ETH portfolio intent.
Existing position protection missing must A future runner could merge with or alter pre-existing ETH-USDT-SWAP exposure in the same account. Before any submit-capable command, require zero conflicting ETH-USDT-SWAP exposure or an explicitly dedicated state-owned position id.
Signal scheduling missing must The repo cannot run a quasi-live candle-bound signal loop for the ETH-focused portfolio. Add a read-only quasi-live runner that records last confirmed candle per leg and emits intent only when a leg clock advances.
Operational logs missing must There is no durable audit trail for signal decisions, payloads, cancel intents, fills, or state transitions. Add append-only JSONL event logging for read-only signal/order/cancel intent cycles.

Must implement

# Task
1 Add a read-only order-intent builder that renders the exact post_only order payloads for each required entry level without submitting them.
2 Define the portfolio order-intent shape for all active legs and add a non-submitting batch payload renderer.
3 Add read-only cancel-intent generation from tracked open order ids, then add client cancel/list methods before any live runner is enabled.
4 Add a dedicated ETH portfolio state schema and read/write command for quasi-live intent tracking.
5 Require tdMode=isolated, posSide=long, and bounded leverage in every generated ETH portfolio intent.
6 Before any submit-capable command, require zero conflicting ETH-USDT-SWAP exposure or an explicitly dedicated state-owned position id.
7 Add a read-only quasi-live runner that records last confirmed candle per leg and emits intent only when a leg clock advances.
8 Add append-only JSONL event logging for read-only signal/order/cancel intent cycles.

Optional

# Task
1 Add a demo-only execution adapter after read-only intent/state/logging proves one full signal cycle.
2 Add reduce-only close-intent rendering and tests before adding any close submit path.
3 Add portfolio-level exposure reports comparing intended weight, tracked exchange exposure, and cash limits.

Evidence

OKX post-only entry support

  • Current place_order chooses ordType market when entry_price is absent and limit when entry_price is present.
  • The only trade submit endpoint in code is /api/v5/trade/order.

Batch entry order support

  • Current OKX client has one single-order place_order method.
  • No /api/v5/trade/batch-orders endpoint or multi-order method is present.

Cancel open orders

  • No cancel_order, cancel_batch_orders, or orders-pending method exists in okx_client.py.
  • The signal-intent report always sets needs_cancel to False and no_cancel_submission to True.

State persistence

  • paper_engine.py persists paper_state.json.
  • Existing paper state assumes immediate local fills and has no exchange order lifecycle.

Position isolation

  • place_order calls ensure_hedge_mode before submitting.
  • set_leverage sends mgnMode=isolated and place_order sends tdMode=isolated with posSide.

Existing position protection

  • okx-account reads positions.
  • okx-order does not check existing ETH exposure before calling place_order.

Signal scheduling

  • build_eth_focused_portfolio_signal_intent.py evaluates cached candles once and writes dry-run output.
  • No scheduler, last-confirmed-candle state, or one-cycle-per-candle guard exists in CLI code.

Operational logs

  • No logging module usage is present in okx_codex_trader.
  • Existing reports are generated snapshots, not append-only runtime logs.