متن انگلیسی نمایش داده می‌شود — ترجمه این صفحه هنوز تکمیل نشده است — انگلیسی

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.

  1. Pre-flight doctor gate: MT5 terminal present? config valid? platform

supported? — otherwise the engine refuses to start.

  1. Migration gate: canonical DB migration engine runs (additive, checksummed).
  2. Model load: Champion bundle validated by the 10-gate load gate (manifest

hash, scaler dim, schema family, width contract…).

  1. Mode select: PAPER (default) / SHADOW / LIVE (interactive confirmation).
  2. Web server: FastAPI Control Center + SSE + WebSocket.
  3. 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:

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

ModeOrder authorityPurpose
paper (default)simulated fillsdevelopment, UI, CI
shadownone (simulated=True)live-data evaluation without risk
livereal brokerexplicit 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