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
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>
2.4 KiB
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
- Launcher binds an adapter (
DirectMT5Adapter/RemoteMT5GatewayAdapter/ paper) behindIMT5Port. - 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 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
- Execution pipeline
- Observability
- Internal:
docs/architecture/order_manager_architecture.md