Research-driven quantitative trading engine
Causal features Β· Governed models Β· Invariant risk Β· Deterministic research Β· Forensic observability
Hexagonal Β· Event-driven Β· MetaTrader 5 Β· XAUUSD M1 Β· Python 3.11
English Β· ΩΨ§Ψ±Ψ³Ϋ Β· EspaΓ±ol Β· Ψ§ΩΨΉΨ±Ψ¨ΩΨ© Β· Deutsch Β· π Documentation
Important
Research and engineering platform β not a promise of profit. Every status claim is evidence-graded, and this repository publishes its negative results alongside wins. Leveraged XAUUSD scalping carries extreme financial risk.
Pick your path β five doors, one engine
|
π Quick Start Run in under 5 minutes β Open
|
ποΈ Architecture System map & data flow β Explore
|
π¬ Research Claims & evidence β Validate
|
π Reference CLI Β· API β Lookup
|
π€ Contribute Join the research β Join
|
git clone https://github.com/Opselon/NexusTradingForexBot.git
cd NexusTradingForexBot
python -m venv .venv
# Windows PowerShell: .\.venv\Scripts\Activate.ps1
# Linux / macOS: source .venv/bin/activate
pip install -e ".[dev]"
nexus doctor # read-only diagnostics + suggested fixes
nexus start # PAPER mode (default, safe) β http://127.0.0.1:8080
nexus start --mode shadow # live feed, ZERO order authority β recommended for evaluation
nexus stopControl Center opens at
http://127.0.0.1:8080β live M1 chart, Order Blocks, FVGs, risk overlays, and tuner. More entry paths + first-run wizard β installation Β· quickstart
Nexus Scalp Engine (NSE) unifies deep-learning inference, market-microstructure analysis, and high-frequency execution into one auditable pipeline:
Causal Feature Engine β Dual-path TCN + Self-Attention (ScalpNet) β SMC Policy Matrix (Order Blocks Β· Fair Value Gaps Β· Liquidity Sweeps) β Invariant Risk Engine β Hard-Clamped Execution Router β all on a hexagonal core that talks to MetaTrader 5 via Win32 IPC, ZMQ gateway, or a paper simulator.
What makes Nexus different is not a claim of alpha β it's how claims are treated:
identity fingerprints on every dataset / model / run Β· hard out-of-sample gates Β· bit-exact replay Β· immutable ledgers Β· public forensic bug ledger β rejected candidates stay published.
Three paths β same safety guarantee Β· First run always PAPER, never LIVE silently
No Python needed Β· Windows x64 Β· double-click install
Download from Releases β and run:
NexusScalpEngine-<version>-win-x64-setup.exe β installer (recommended)
NexusScalpEngine-<version>-win-x64-portable.zip β unzip & run
First-run wizard defaults to PAPER mode. Upgrades preserve your config.
No Python Β· No Git Β· No admin Β· installs to %LOCALAPPDATA%\Nexus
Paste in PowerShell β click top-right copy button:
iex (irm https://raw.githubusercontent.com/Opselon/NexusTradingForexBot/main/installer/install.ps1)options β preview, repair, pin
# Preview what it will do (no changes)
iex (irm https://raw.githubusercontent.com/Opselon/NexusTradingForexBot/main/installer/install.ps1) -DryRun
# Heal a broken install
.\install.ps1 -Repair
# Pin to an exact commit
.\install.ps1 -Commit <sha>Idempotent & repeatable Β· -DryRun Β· -Repair Β· -Commit <sha> Β· portable Git fallback if needed
See π Quick Start above β clone, venv, pip install -e ".[dev]", nexus start.
Requires Python 3.11 + Git. Full dev setup β installation guide
Advanced β rollback, manifests, SHA-256
Full reference: docs/INSTALL_WINDOWS.md Β· docs/INSTALLER_ARCHITECTURE.md
The release pipeline ships SHA-256 manifests + SBOM with post-publish verification; nexus update verify|rollback covers the installed lifecycle.
Enforced in code and contracts, not just stated:
| Principle | Guarantee |
|---|---|
| π Evidence before claims | Metrics without evidence render n/a, never fake zeros; runtime claims are graded |
| β³ No lookahead | Purged + embargoed walk-forward; strictly causal features β INV-008 |
| π Causal parity | live = replay = training feature semantics, protected by schema hashing |
| π― Runtime truth | Broker truth wins over stale local state; gates are runtime authorities, settings are intent β INV-011 |
| π§± Layered isolation | Hexagonal ports/adapters; research holds zero order authority β INV-002; hot path never blocks on DB/training/network β INV-001 |
| β Validation before promotion | OOS failure β REJECTED; promotion is strictly operator-gated; candidates never promote themselves |
Deep dive β architecture overview Β· runtime invariants
Market Data ( MT5 Β· ZMQ gateway Β· paper )
β
Causal Features ββ 50D live contract (scalp_v1) Β· governed 70D research assembly
β
Inference Validator ββ schema hash Β· scaler dim Β· bounds (loud rejection, never silent)
β
ScalpNet ( TCN + self-attention ) ββ 4 logits β confidence gate β Regime Guardian
β
SMC Policy Matrix βββΊ Risk Engine ( Kelly sizing Β· margin / tier clamps )
β
OrderManager ββ scenario router Β· position-state machine Β· hard clamps
β
IMT5Port adapter βββΊ MetaTrader 5 (live) Β· paper simulator Β· zero-order shadow
β
Accounting ( immutable SQLite WAL ledger ) βββΊ Experience & autopsy intelligence
β
Observability ( logs Β· incidents Β· forensics ) β Research loop
β ( walk-forward β OOS gate β operator promotion )
Control Center ( FastAPI Β· REST / SSE / WS dashboard )
Every stage is isolated behind hexagonal ports β every promotion requires an operator decision on reproducible evidence.
Overview Β· System Map Β· Data Flow Β· Model Pipeline Β· agents/skill.md
| Mode | Market data | Orders | Purpose |
|---|---|---|---|
| PAPER (default) | simulated | simulated | First run, development, UI work |
| SHADOW | live feed | none β zero order authority | Evaluate signals on real data, risk-free |
| LIVE | live feed | real | Real financial risk β explicit confirmation + full risk panel |
- The live adapter refuses a terminal logged into a different account than configured (account-identity fail-safe).
- Recommended path: DEMO MT5 β SHADOW for days β small LIVE β first-run guide
Warning
This bot places REAL trades with REAL money in LIVE mode. Hard clamps protect the strategy β not your capital from market volatility.
nexus start serves the Control Center at http://127.0.0.1:8080 β live M1 chart with Order Block / FVG / swept-liquidity overlays, entry-SL-TP lines with risk tooltips, plus Overview Β· Strategy Research Β· News Intelligence Β· Scalping Rules Β· Account Β· Debug Hub.
Telemetry streams over SSE, dashboard over WebSocket, tuner applies without restart. Docs β control-center-ui.md
The bundled nexus console is the operational control surface (nse is a legacy alias; from source python -m nexus_scalp.cli.main).
nexus start [--mode paper|shadow|live] [--port N] [--daemon] # paper default Β· live needs confirmation
nexus stop / restart # control the background engine
nexus status / health # READY / DEGRADED / NOT READY
nexus doctor # 19-category diagnostics + suggested fixes
nexus setup / install # first-run wizard
nexus logs [--tail N] [--errors] # tail / filter / export logs
nexus config [--validate path] # inspect / validate (secrets masked)
nexus test --mode quick|unit|integration # run suites (never live-broker tests)
nexus update check|download|install|verify|rollback # release lifecycle
nexus export-diagnostics # sanitized diagnostics ZIP (no secrets)
Stable exit codes: 0 success Β· 1 runtime/validation Β· 2 usage Β· 3 environment blocked Β· 4 release verification Β· 5 update.
Full reference β CLI reference
Research / database / forensics commands
nexus model-dataset-build / -experiment-create / -train / -validate / -replay
# artifact-first model factory (research)
nexus db hygiene status|plan|run # database hygiene (audit-only by default)
nexus forensic --deploy-gate # forensic pre-release gate (wired into beforePush)
nexus incidents list|reports|export # incident center (sanitized exports)
nexus repair # non-destructive derived-state repair
nexus release info # installed release metadata
cp .env.example .env # optional β safe defaults exist
docker compose up -d --buildStarts engine + Control Center in container-safe PAPER mode; dashboard at http://localhost:9090; /health readiness (READY/DEGRADED = healthy).
Full reference β docs/docker.md
DATA ββΊ FEATURES ββΊ MODEL ββΊ STRATEGY ββΊ BACKTEST ββΊ WALK-FORWARD ββΊ OOS GATE
ββΊ ROBUSTNESS ββΊ COUNTERFACTUAL ββΊ REPLAY ββΊ VALIDATION ββΊ OPERATOR PROMOTION
- Philosophy: reproducibility, no future leakage, deterministic replay, identity/fingerprint tracking, dataset & model provenance, execution fidelity β methodology Β· validation Β· runtime path
- Negative results are published, not buried. The flagship 70D series (
scalp_v3) was returned NOT_ELIGIBLE by the hard OOS gate on real-data walk-forward and was not promoted. The live contract remains governed. Evidence: TASK-05 Β· TASK-09 Β· status
pytest tests/unit -q # unit corpus (critical subset: tests/critical_suite.txt)
pytest tests/unit tests/integration -q
./beforePush.sh -SkipPush # full gate: ruff Β· format Β· mypy Β· critical suite Β· forensic deploy gateCI runs ruff Β· mypy Β· pytest (critical suite) Β· CodeQL Β· Trivy Β· OSV Β· JS tests. Keep commits atomic (<Name>: <summary>); reuse > extend > refactor > create.
Quality docs β docs/engineering/quality.md
Helped you learn, research, or trade smarter β even a little?
One click Β· 2 seconds Β· fuels months of open research. We'd be truly grateful. π
If this project is usable or profitable for you, please consider starring β it helps others discover Nexus and motivates the next release.
Tip
No sign-up, no cost, no catch β just a β. That one star tells GitHub this research matters, pushes Nexus to more traders and researchers, and is the kindest way to say thank you if Nexus delivered any value to you.
Every β you gave made this curve β thank you for being part of it.
Site: https://opselon.github.io/NexusTradingForexBot/
| Category | Entry points |
|---|---|
| Getting started | quickstart Β· installation |
| Architecture | overview Β· system map |
| Research | methodology Β· validation |
| Engineering & quality | quality gates Β· release process |
| Guides | troubleshooting Β· common workflows |
| Reference | CLI reference Β· FAQ |
| Contributing | contribution guide Β· add a language |
Languages: English (source) Β· ΩΨ§Ψ±Ψ³Ϋ Β· EspaΓ±ol Β· Ψ§ΩΨΉΨ±Ψ¨ΩΨ© Β· Deutsch β RTL for Persian/Arabic; partial translations are marked honestly.
Engineering memory & internal maps (maintainers)
agents/skill.mdβ authoritative architecture mapagents/bugs.mdβ public forensic bug ledger (BUG-001β¦)agents/runtime_invariants.mdβ INV registryagents/contracts.mdΒ·agents/taskboard.mddocs/forensics/README.mdβ forensic recovery & provenance indexdocs/70D_DATA_CONTRACT.mdβ 70D research contract
Repository structure
src/nexus_scalp/ Core engine (hexagonal packages: domain, ports, adapters, features,
models, signals, risk, execution, application, research, shadow, β¦)
tests/ Unit + integration + golden + js + installer suites
Web/ Control Center UI β buildless vanilla-JS SPA (no Node runtime)
agents/ Engineering memory: architecture map, bug ledger, contracts, taskboard
docs/ Engineering documentation (this platform's IA tree)
site/ GitHub Pages source (multilingual static site)
configs/ base.yaml Β· live.yaml.example
scripts/ Build/release scripts, quality gates, docs tooling (scripts/docs/)
installer/ PowerShell bootstrap installer (stage protocol)
docker/ entrypoint.sh Β· healthcheck.sh
pics/ Screenshots
Nexus is actively evolving and welcomes contributors in quantitative research Β· ML / time-series modeling Β· market microstructure Β· trading-system engineering Β· frontend / Control Center Β· testing / QA Β· documentation and localization.
- Read the contribution guide.
- Claim a task in
agents/taskboard.mdor open an issue with a[Research]/[Proposal]tag. - Fork & submit a PR β atomic commits (
<Name>: <summary>), Ruff, strict mypy, pytest coverage. Evidence-based changes only.
Versioning is single-sourced in pyproject.toml (semver, stamped into every artifact) β the release badge reads the latest tag dynamically.
Current state β docs/project/status.md Β· capabilities
Known limitations (published, not hidden):
- 70D research series is candidate-only with negative OOS evidence so far; live contract stays 50D until a candidate clears all gates and an operator promotes it.
- Packaged release is Windows x64 only.
- News engine is opt-in (disabled until a
news:config block exists). - No CLI hot-swap to the PAPER adapter β risk-free validation goes through SHADOW or a demo account.
Current priorities:
- Rebuild 70D candidate evidence under corrected confidence semantics (
CHG-0042) β under evaluation - Counterfactual evidence deepening (
CHG-0041) β policy review - Large-file decomposition with golden tests (
CHG-0032-A1) - 70D promotion decision β operator-gated, or honest retirement
Full roadmap with dependencies & completion gates β docs/project/roadmap.md
DISCLAIMER: Algorithmic trading β especially leveraged XAUUSD/Gold scalping β carries immense financial risk. This engine is provided strictly for educational, academic research and simulation purposes; it does not guarantee profit and is not financial advice. Always perform rigorous backtesting and forward paper-trading before committing capital. In LIVE mode it can place real trades β operator responsibility.
Proprietary License β All Rights Reserved. Designed for Quantitative Excellence.
Documentation Β· Roadmap Β· Status Β· Issues Β· Releases




