Skip to content

Latest commit

Β 

History

1,878 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Nexus Scalp Engine

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

GitHub stars commits this month repo size forks open issues license

Nexus Trading Control Center

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.


🧭 Start here

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

πŸš€ Quick Start

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 stop

Control 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


πŸ’‘ What is Nexus?

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.


πŸ“¦ Installation

Three paths β€” same safety guarantee Β· First run always PAPER, never LIVE silently

🎁 End users β€” packaged release

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.

⚑ PowerShell bootstrap β€” zero prerequisites

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

πŸ‘©β€πŸ’» Developers β€” from source

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.


πŸ›‘οΈ Why Nexus β€” Engineering Philosophy

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


πŸ—οΈ Architecture at a glance

 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


πŸ” Safety & Operating Modes

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.


πŸ–₯️ Control Center

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

Account Center β€” 1920px Account Center β€” 768px Deep state Many metrics


⌨️ CLI

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

🐳 Docker

cp .env.example .env       # optional β€” safe defaults exist
docker compose up -d --build

Starts engine + Control Center in container-safe PAPER mode; dashboard at http://localhost:9090; /health readiness (READY/DEGRADED = healthy). Full reference β†’ docs/docker.md


πŸ”¬ Research & Validation

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

πŸ§ͺ Engineering Quality

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 gate

CI 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


⭐ If Nexus was useful β€” a star is the best thank you

Helped you learn, research, or trade smarter β€” even a little?
One click Β· 2 seconds Β· fuels months of open research. We'd be truly grateful. πŸ™

Star this repo
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.

Star History

Star History Chart

Every ⭐ you gave made this curve β€” thank you for being part of it.


πŸ“š Documentation

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)
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

🀝 Contributing

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.

  1. Read the contribution guide.
  2. Claim a task in agents/taskboard.md or open an issue with a [Research] / [Proposal] tag.
  3. Fork & submit a PR β€” atomic commits (<Name>: <summary>), Ruff, strict mypy, pytest coverage. Evidence-based changes only.

πŸ“Œ Status & Roadmap

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


πŸ“„ License & Disclaimer

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

About

πŸ‘‘ Enterprise-grade, high-frequency quantitative scalp trading engine for XAUUSD (Gold). Driven by PyTorch (TCN + Self-Attention), Smart Money Concepts (SMC/ICT) , Win32 C++ MT5 IPC bindings, and a real-time FastAPI Canvas Web Dashboard.

Topics

Resources

Stars

11 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages