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>
55 lines
2.6 KiB
Markdown
55 lines
2.6 KiB
Markdown
---
|
||
title: Data Flow — Tick to Decision
|
||
description: The canonical data path from a broker tick to an audited trading decision, with every contract boundary.
|
||
lang: en
|
||
---
|
||
|
||
# Data Flow — from tick to decision
|
||
|
||
This is the canonical path (from `agents/skill.md` §4). Every arrow is a
|
||
contract boundary.
|
||
|
||
```text
|
||
TickData (MT5 / paper / gateway)
|
||
→ ScalpFeatureEngine.to_tensor_input()
|
||
50D base (scalp_v1 · FEATURE_NAMES · [-3,+3] · finite)
|
||
→ assemble_70d / build_70d_vector()
|
||
70D canonical: Base 0..49 | News 10D 50..59 | Liquidity 10D 60..69
|
||
→ InferenceContractValidator
|
||
scaler dim == feature dim · schema hash · finite · bounds
|
||
→ ScalpNet → 4 logits (NO_TRADE / BUY / SELL / WAIT) → confidence gate 0.35
|
||
→ regime_classifier (Regime Guardian)
|
||
→ signals/policy + rule_matrix (~30 rules, TTL 5s cache)
|
||
→ RiskEngine.calculate_dynamic_volume() + evaluate_proposal()
|
||
free-margin 20% clamp · tier caps · HARD_MAX_LOTS
|
||
→ OrderManager (60-scenario router · 11 position states ·
|
||
MAX_TOTAL_EXPOSURE=1 · 30s re-quote lock · 1.0×ATR drift)
|
||
→ broker (IMT5Port adapter: Win32 IPC / ZMQ / paper)
|
||
→ accounting (TradeOutcome / ACCOUNT_SNAPSHOT) → AuditRepository (queued, WAL)
|
||
→ web SSE/WebSocket + Telegram (read-only) + experience/research/shadow
|
||
```
|
||
|
||
## Contract boundaries in the flow
|
||
|
||
| Boundary | Enforced by | Failure mode |
|
||
| :--- | :--- | :--- |
|
||
| feature dim / ordering | schema registry + `schema_contract` hash | loud rejection (`FEATURE_CONTRACT_MISMATCH`), never silent padding |
|
||
| scaler ↔ features | `InferenceContractValidator` | `SCALER_MISMATCH` blocks inference |
|
||
| confidence semantics | policy gate measures trained-class directional share (CHG-0042) | miscalibrated confidence cannot masquerade as direction |
|
||
| sizing limits | `RiskEngine` + OrderManager clamps | order refused |
|
||
| order authority | ports/adapters isolation + INV-002 | research/learning components physically cannot place orders |
|
||
| persistence | `AuditRepository` background writer | hot path never blocks (INV-001) |
|
||
|
||
## Hot-path discipline (INV-001)
|
||
|
||
The tick pipeline performs **zero synchronous I/O**: no DB queries, no
|
||
training, no network on the tick path. Bar aggregation and broker snapshots
|
||
are cached off-path; news context is cache-only.
|
||
|
||
## Assembly rules for the 70D block
|
||
|
||
Missing sub-blocks require **explicit neutral vectors** (`FEATURE_DISABLED`) —
|
||
silent fabrication is forbidden; unavailable features block
|
||
(`FEATURE_UNAVAILABLE`). Reordering features changes the schema hash, which
|
||
invalidates models — by design.
|