live-eth-nextgen-micro-deployment.md 2.7 KB

ETH nextgen micro live observer deployment

Scope

This deployment is read-only. It continuously refreshes local OKX candles, rebuilds the ETH nextgen+micro signal intent, records account/position snapshots when credentials are present, writes heartbeat files, and submits no orders.

Order execution remains blocked until the persistent virtual state and target-position reconciliation are implemented.

Files

  • scripts/run_eth_nextgen_micro_observer.py
  • deploy/eth-nextgen-micro-observer.service
  • deploy/install_eth_nextgen_micro_observer.sh

Server

Target host: 66.253.42.170

Install path: /opt/okx-codex-trader

Environment file: /etc/okx-codex-trader/okx.env

Service: eth-nextgen-micro-observer.service

Deploy

rsync -a --delete --exclude .git --exclude .venv --exclude .pytest_cache --exclude var ./ ubuntu@66.253.42.170:/tmp/okx-codex-trader/
ssh ubuntu@66.253.42.170 'cd /tmp/okx-codex-trader && bash deploy/install_eth_nextgen_micro_observer.sh'

Then edit credentials on the server:

sudo nano /etc/okx-codex-trader/okx.env
sudo systemctl restart eth-nextgen-micro-observer.service

Monitor

systemctl status eth-nextgen-micro-observer.service --no-pager
journalctl -u eth-nextgen-micro-observer.service -f
cat /opt/okx-codex-trader/var/eth-nextgen-micro/heartbeat.json
tail -f /opt/okx-codex-trader/var/eth-nextgen-micro/observer-events.jsonl

Live execution gate

Do not add live order submission to this service until all of these are true:

  • Persistent virtual nextgen and micro state is maintained.
  • Target position is expressed as one net ETH position with units 0, 0.5, or 1.0.
  • Close/reduce-only order support is implemented and tested.
  • The daemon is idempotent by completed candle timestamp and client order id.
  • A hard max_margin_usdt cap is enforced.

Execution design

The live executor should be a separate service from this observer. The observer answers only: latest completed candles, selected engine, intended signal, and current account snapshot.

The executor should process only completed 15m candles. For each candle it should:

  1. Rebuild the strategy state from persisted last state plus the new candle.
  2. Convert virtual legs to one target ETH position: flat, long 0.5, long 1.0, short 0.5, or short 1.0.
  3. Read current OKX ETH swap position.
  4. Submit only the delta needed to reach the target position.
  5. Persist candle timestamp, target position, submitted client order id, fills, fee, and resulting position.

The first live version should use a hard small margin cap and market/reduce-only orders only. Price-distributed TWAP entry can be added after target reconciliation and fill logging are proven live.