How deskiziarecords/7zero-reverse works
1. Overall shape
This repo is a hybrid trading/analysis system: a Rust core engine does the market-data processing and pattern detection, while a React/JavaScript terminal renders the results. The two halves are connected through a WASM boundary.
2. Primary runtime boundary
The important architecture line is:
market data in → Rust processing/detection → structured engine state/signals → frontend visualization.
The Rust side is optimized for low-latency, event-driven processing; the frontend is a read-only visualization/control surface.
3. Data ingestion layer (src/data)
realtime.rs is the market-feed entry point, described as handling providers like OANDA tick streaming.
candle_builder.rs converts raw ticks into fixed-interval candles, which is the normalized data stream the rest of the engine consumes.
4. Engine orchestration layer (src/engine)
core.rs is the central orchestrator: it advances the system one candle at a time, manages transitions, and triggers detection logic.
state.rs holds rolling market context and optimized state containers.
This is the core runtime loop of the backend.
5. Detection subsystem (src/engine/detectors.rs)
The detector layer implements the repo’s “Lambda Detection Matrix” and related market-regime logic.
It classifies conditions such as phase entrapment, temporal alignment, spectral inversion, liquidity inversion, and a displacement veto.
In diagram terms, this is the decision layer between normalized market state and emitted trading/analysis signals.
6. Shared domain model (src/types)
types.rs centralizes the core structs, configs, and system-state definitions used across data, engine, and models.
This is the main contract layer inside the Rust backend.
7. Analytical/modeling support (src/models)
math.rs contains the low-level quantitative utilities such as SMA, ATR, standard deviation, and the “Adelic Manifold Validator.”
meta_cognitive.rs and neuro_symbolic.rs appear to be experimental or higher-level inference layers.
For architecture purposes, these are support modules feeding the detector/engine logic rather than separate services.
8. Rust crate boundaries
src/lib.rs exposes the reusable backend logic, while src/main.rs is the runnable entrypoint for local execution/simulation.
This suggests the Rust code can act both as a library for WASM export and as a native executable for backend testing.
9. Frontend application (frontend/)
The frontend/ directory is a separate Vite-based React app.
It is the human-facing terminal: charting, indicator display, and engine-health monitoring.
The README specifically calls out lightweight-charts for financial visualization.
10. WASM / JS integration
frontend/src/engine.js is the glue layer that bridges the browser UI with the Rust engine compiled to WASM via wasm-pack / wasm-bindgen.
The UI bootstraps through frontend/src/main.jsx, then consumes engine outputs for live rendering.
11. Repo structure note
There is also a top-level src/App.jsx and src/pages/PatternScanner.jsx, which suggests an additional or shared JS UI surface outside frontend/.
For an architecture diagram, treat the Rust engine as the backend core and the React/Vite layer as the visualization frontend; the top-level JS files look like a secondary UI entrypoint or shared app shell.
12. External dependencies that matter architecturally
The materially important external pieces are:
- OANDA-style market ticks as the data source
- WASM toolchain for Rust-to-JS bridging
- Vite/React for the terminal UI
- lightweight-charts for market visualization
13. Build/runtime separation
Rust is built with Cargo; the browser UI is built with npm/Vite; the WASM artifact is produced separately with wasm-pack.
That means the repository has two deployment/runtime paths: a native Rust execution path and a browser-based visualization path.
Main entry points: detectors.rs Detectors · core.rs Engine core · types.rs Domain types · App.jsx Terminal app
Components 20
Rust core
Market-data ingestion, engine loop, shared domain, and analytical models.
- Realtime feed · Entry point for live market ticks and provider streaming.
src/data/realtime.rs - Candle builder · Converts raw ticks into fixed-interval candles for the engine loop.
src/data/candle_builder.rs - Engine core · Advances the system candle by candle and coordinates processing.
src/engine/core.rs - Engine state · Holds rolling market context and optimized runtime state.
src/engine/state.rs - Detectors · Implements regime and pattern classification, including matrix-style detection logic.
src/engine/detectors.rs - Domain types · Shared structs, configs, and system-state definitions used across the backend.
src/types/types.rs - Quant math · Low-level indicators and validation utilities used by the detection stack.
src/models/math.rs - Meta layer · Higher-level inference support feeding the engine and detectors.
src/models/meta_cognitive.rs - Neuro-symbolic · Symbolic/inference support module for analysis and detection.
src/models/neuro_symbolic.rs - Rust lib · Library boundary exposing reusable backend logic and WASM-facing code.
src/lib.rs - Rust main · Native executable entrypoint for local execution and simulation.
src/main.rs
Web terminal
Browser UI and WASM bridge for visualization and control.
- UI bootstrap · Starts the browser app and mounts the React terminal.
frontend/src/main.jsx - WASM bridge · Connects the browser UI to Rust engine outputs compiled to WebAssembly.
frontend/src/engine.js - Terminal app · Main UI shell for charts, indicators, and engine status.
frontend/src/App.jsx
JS shell
Top-level React surface outside the Vite frontend.
- Pattern shell · Top-level JS app surface and pattern-scanner view.
src/App.jsx - Pattern scanner · Dedicated scanning page for pattern-focused analysis.
src/pages/PatternScanner.jsx
External systems
Outside services and runtime toolchains that shape the architecture.
- OANDA feed · Live tick source implied by the realtime ingestion layer.
- WASM toolchain · Rust-to-JS compilation path via wasm-pack and wasm-bindgen.
- Vite/React · Frontend build and browser runtime for the terminal UI.
- Charts lib · Financial charting library used for market visualization.
Connections 21
- OANDA feed → Realtime feed: ticks in · Live market ticks enter through the realtime provider layer.
- Realtime feed → Candle builder: normalize · Raw ticks are aggregated into candles.
- Candle builder → Engine core: candles in · Normalized candles drive the core runtime loop.
- Engine core → Engine state: update state · The orchestrator advances and mutates rolling engine state.
- Engine core → Detectors: run detection · Each candle step triggers regime and pattern detection.
- Engine state → Detectors: context · Detectors read rolling market context from state.
- Domain types → Realtime feed: contracts · Shared types define data and message shapes.
- Domain types → Engine state: models · State is structured by the shared domain model.
- Domain types → Detectors: signals · Detection outputs use shared system-state types.
- Quant math → Detectors: features · Indicators and validation utilities feed detection logic.
- Meta layer → Detectors: support · Experimental inference support contributes to analysis.
- Neuro-symbolic → Detectors: support · Symbolic reasoning support feeds the decision layer.
- Engine core → Rust lib: exposed by · Core engine logic is exported through the library boundary.
- Rust main → Engine core: runs · Native executable drives the engine loop for local execution.
- Rust lib → WASM toolchain: compiled via · The Rust library is built for browser use through the WASM toolchain.
- WASM toolchain → WASM bridge: bridges · WASM output is consumed by the browser integration layer.
- UI bootstrap → Terminal app: mounts · The UI bootstrap renders the main terminal app.
- Terminal app → WASM bridge: consumes · The terminal reads engine outputs through the JS bridge.
- Terminal app → Charts lib: renders · Charts are used for market visualization.
- UI bootstrap → Vite/React: served by · The browser app runs in the Vite/React frontend environment.
- Pattern shell → Pattern scanner: navigates · The shared JS shell includes the pattern scanner view.