Fuente en inglés — traducción pendiente — inglés
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
- Launcher binds an adapter (
DirectMT5Adapter/RemoteMT5GatewayAdapter/
paper) behind IMT5Port.
- Pre-flight doctor gate: MT5 terminal present? config valid? platform
supported? — otherwise the engine refuses to start.
- Migration gate: canonical DB migration engine runs (additive, checksummed).
- Model load: Champion bundle validated by the 10-gate load gate (manifest
hash, scaler dim, schema family, width contract…).
- Mode select: PAPER (default) / SHADOW / LIVE (interactive confirmation).
- Web server: FastAPI Control Center + SSE + WebSocket.
- 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 syncInvariants 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
- Execution pipeline
- Observability
- Internal:
docs/architecture/order_manager_architecture.md