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.2 KiB
2.2 KiB
title, description, lang
| title | description | lang |
|---|---|---|
| Execution Pipeline | OrderManager — the 60-scenario router, position state machine, protection ledger, recovery budget, and every hard clamp. | en |
Execution Pipeline
execution/order_manager.py is the single dispatch authority (INV-004). It is
large by design (convention-locked hot path) and is being decomposed
surgically, seam by seam, with golden tests.
Path of an order
TradeProposal (frozen domain contract, execution_id trace)
→ policy/confluence checks (SMC matrix, Regime Guardian, confidence gate)
→ RiskEngine.evaluate_proposal() → dynamic volume (fractional Kelly)
→ OrderManager router (60 scenarios: fills, rejections, partials, errors)
→ IMT5Port adapter (Win32 IPC / ZMQ / paper)
→ position lifecycle (11 states with hysteresis)
→ protective exits (SL/TP first-touch, breakeven lock, profit giveback,
adaptive exit protection)
→ broker reconciliation (broker truth wins — INV-011)
→ accounting + autopsy (immutable ledger)
Hard clamps (never bypassed)
| Clamp | Value |
|---|---|
HARD_MAX_LOTS |
10.0 |
MAX_TOTAL_EXPOSURE |
1 position |
| free-margin clamp | ≤ 20% |
| pending re-quote lock | 30 s |
| exit drift guard | 1.0 × ATR |
| circuit breaker | SAFE_MODE after 3 rejections |
Extracted seams (zero-behavior-change decomposition)
position_state_machine.py— 11-state machine with hysteresis + emergency bypass (golden-tested).protection_ledger.py— per-ticket protection state (monotonic peak, NaN guard).recovery_budget.py— per-ticket recovery envelopes (ATR fallback, horizon clamp 30–600 s, exhaustion verdicts).
Forensic traceability
Every proposal carries an execution_id; [EXEC_TRACE] logging, dispatch
reason embedding, and /api/debug/trace expose the full decision path. Exit
classification (EXIT_CLASSIFICATION v3) never invents a reason: UNKNOWN
stays UNKNOWN; MT5 DEAL_REASON 4 = SL (INV-012/013).
Safety properties
- No second concurrency path around OrderManager.
- Teardown of per-ticket state is an atomic bundle (state machine + protection ledger + recovery budget + tombstones dropped together).
- Churn throttle + duplicate-execution guards (INV-005/006 idempotency).