operations.md 4.7 KB

Operations

Environment

Remote server:

  • SSH: ubuntu@66.253.42.170
  • App dir: /opt/okx-codex-trader
  • Runtime user: okxbot
  • Env file: /etc/okx-codex-trader/okx.env
  • Local repo: /home/lxy/okx-codex-trader

Do not print secrets from the env file. Only check whether required keys exist when needed.

Services

Live executor:

  • bb-squeeze-executor.service

Read-only observers:

  • bb-squeeze-t-gated-observer.service
  • calendar-fusion-observer.service
  • crash-follow-short-observer.service
  • eth-focused-portfolio-observer.service
  • eth-nextgen-micro-observer.service
  • high-frequency-portfolio-observer.service
  • short-bias-readonly-observer.service

Historical or dry-run service files may exist in deploy/, but the list above is the current operational set.

Monitoring

Service status:

rtk ssh ubuntu@66.253.42.170 'systemctl status bb-squeeze-executor.service --no-pager -l'
rtk ssh ubuntu@66.253.42.170 'systemctl status high-frequency-portfolio-observer.service --no-pager -l'

All relevant services:

rtk ssh ubuntu@66.253.42.170 'systemctl list-units --type=service --all --no-pager | grep -Ei "bb-squeeze|observer|eth|short-bias|calendar|crash|high-frequency"'

Recent live executor events:

rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && tail -n 80 var/bb-squeeze-executor/events.jsonl'

Unified observer snapshot:

rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && sudo -u okxbot .venv/bin/python scripts/summarize_readonly_observers.py && sed -n "1,120p" reports/live-recent/readonly-observers-snapshot.md'

Individual heartbeats:

rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && python3 -m json.tool var/high-frequency-portfolio/heartbeat.json | sed -n "1,160p"'
rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && python3 -m json.tool var/calendar-fusion/heartbeat.json | sed -n "1,160p"'
rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && python3 -m json.tool var/short-bias-readonly/heartbeat.json | sed -n "1,160p"'

Deploying Script Changes

For a targeted script-only deploy:

rtk scp scripts/<script>.py ubuntu@66.253.42.170:/tmp/<script>.py
rtk ssh ubuntu@66.253.42.170 'sudo install -o okxbot -g okxbot -m 0755 /tmp/<script>.py /opt/okx-codex-trader/scripts/<script>.py'
rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && sudo -u okxbot .venv/bin/python -m py_compile scripts/<script>.py'

Restart only the affected service:

rtk ssh ubuntu@66.253.42.170 'sudo systemctl restart <service>.service && sleep 3 && systemctl status <service>.service --no-pager -l'

For a new observer service, add the service file to deploy/, install it to /etc/systemd/system/, run systemctl daemon-reload, then enable --now.

Current High-frequency Observer

Files:

  • scripts/build_high_frequency_portfolio_observation_intent.py
  • scripts/run_high_frequency_portfolio_observer.py
  • deploy/high-frequency-portfolio-observer.service

Service:

rtk ssh ubuntu@66.253.42.170 'systemctl status high-frequency-portfolio-observer.service --no-pager -l'

It is read-only. It writes:

  • var/high-frequency-portfolio/heartbeat.json
  • var/high-frequency-portfolio/observer-events.jsonl
  • reports/ultrashort/high-frequency-portfolio-observation-intent.json
  • reports/ultrashort/high-frequency-portfolio-observation-intent.md

Current Calendar Fusion Observer

Files:

  • scripts/build_calendar_fusion_observation_intent.py
  • scripts/run_calendar_fusion_observer.py

The builder selects observation candidates from reports/long-short-fusion/fusion-calendar-total.csv. If no candidate matches the explicit rule, it raises an error instead of silently using stale candidates.

Data and Reports

Local and server candle caches can differ. Recent operational decisions should use the server cache when evaluating live services.

Server refresh/check examples:

rtk ssh ubuntu@66.253.42.170 'cd /opt/okx-codex-trader && sudo -u okxbot .venv/bin/python scripts/summarize_current_strategy_recent_activity.py'
rtk scp ubuntu@66.253.42.170:/opt/okx-codex-trader/reports/eth-exploration/current-strategy-recent-activity-report.md reports/eth-exploration/current-strategy-recent-activity-report.md

Live Order Safety

Before touching live trading:

  • Check current account and positions first.
  • Do not disturb existing positions unless explicitly requested.
  • Keep single-order and total exposure caps.
  • Do not promote observer code by adding order submission inside it.
  • Prefer a separate executor that consumes a tested signal payload.

The live BB squeeze executor is the only current live order service. Observer services must remain read-only.