Files
gavindiazandClaude Code 3a005ddcc6
Docs / Validate documentation (push) Canceled after 0s
Docs / Deploy GitHub Pages (push) Canceled after 0s
CI Final Summary (AI) / AI Final Summary (push) Canceled after 0s
CI Final Summary (AI) / Push/PR event feed (push) Canceled after 0s
CI / CI Integrity and Change Classification (push) Canceled after 0s
CI / Code Quality & Tests (push) Canceled after 0s
Dependency Lock & Migration Safety / Dependency drift (lock vs pyproject) (push) Canceled after 0s
Dependency Lock & Migration Safety / Migration safety (fail-loud + version postconditions) (push) Canceled after 0s
JS Tests / Frontend JS Unit Tests (push) Canceled after 0s
Security / CodeQL Analysis (push) Canceled after 0s
Security / Trivy Vulnerability Scan (push) Canceled after 0s
Tests (OS Matrix) / Py Tests (macos-latest) (push) Canceled after 0s
Tests (OS Matrix) / Py Tests (windows-latest) (push) Canceled after 0s
CI / Extended Validation (Tier 2) (push) Canceled after 0s
CI / Heavy CI (database-provider) (push) Canceled after 0s
CI / Heavy CI (e2e) (push) Canceled after 0s
CI / Heavy CI (integration) (push) Canceled after 0s
CI / Heavy CI (model-validation) (push) Canceled after 0s
CI / Heavy CI (research-backtest) (push) Canceled after 0s
CI / Aggregate CI Results (push) Canceled after 0s
chore(repo): initial import of Nexus Trading Forex Bot into self-hosted hosting
Full project import for the self-hosted code hosting
(https://code.aifunny.ltd/gavindiaz/my-NexusTradingForexBot.git).

Includes the live-freshness + scaler-hash fixes for the permanent
STALE dashboard (tick_pipeline now_utc stamps; infer_probabilities
computes model_input_hash on the actual scaled 70D tensor), the
data-fetch default-path fix, the g29 web-auth test fixes, and a
Chinese user manual (使用手册.md) for the web dashboard.

Scratch diagnostic scripts (check*.py, contain a live web-auth token)
and the .kilo/ agent-worktree directory are gitignored, not committed.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-23 23:24:54 +08:00

2.4 KiB

title, description, lang
title description lang
Runtime — the LiveEngine Loop How the async runtime behaves at runtime — tick pipeline, workers, modes, and what may never block. en

Runtime — the LiveEngine loop

application/live_engine.py is the orchestrator: a single async event loop that drives the tick pipeline and coordinates background workers.

Startup sequence

  1. Launcher binds an adapter (DirectMT5Adapter / RemoteMT5GatewayAdapter / paper) behind IMT5Port.
  2. Pre-flight doctor gate: MT5 terminal present? config valid? platform supported? — otherwise the engine refuses to start.
  3. Migration gate: canonical DB migration engine runs (additive, checksummed).
  4. Model load: Champion bundle validated by the 10-gate load gate (manifest hash, scaler dim, schema family, width contract…).
  5. Mode select: PAPER (default) / SHADOW / LIVE (interactive confirmation).
  6. Web server: FastAPI Control Center + SSE + WebSocket.
  7. Workers start (audit writer, research, hygiene, incidents, Telegram).

Tick pipeline (per tick)

on_tick → normalize → features (50D) → [governed 70D assembly] → inference
        → regime → policy → risk → execution dispatch → state sync

Invariants riding on this loop:

  • INV-001 — zero sync DB / training / network on the tick path.
  • INV-004 — OrderManager is the only dispatch authority.
  • INV-011 — broker truth wins when reconciling exposure.
  • Record builders for online learning route through ONE canonical builder and refuse (None) when the feature snapshot is not VALID — never zero-fill.

Background workers (off-path)

Audit writer (queued WAL writes), research worker, training worker (asyncio.to_thread, disabled by default), hygiene worker, incident worker, Telegram notifier (outbound only).

Runtime modes

Mode Order authority Purpose
paper (default) simulated fills development, UI, CI
shadow none (simulated=True) live-data evaluation without risk
live real broker explicit interactive confirmation; full risk panel printed

Teardown

Foreground runs stop with Ctrl+C (graceful teardown); nexus stop handles --daemon pidfiles honestly (BUG-172: dead-pid reported as such). Updates are blocked while LIVE.

Deep dives