How deskiziarecords/trade works
1. Repository shape
- This is a multi-language trading/research monorepo, not a single app.
- The main production-oriented path is the Python package under trading_engine/aegis, backed by several Rust crates in hyperion and other Rust subprojects.
- Around that core are offline research notebooks/scripts, dataset prep pipelines, broker adapters, and deployment tooling.
2. Primary runtime: trading_engine/aegis
- trading_engine/aegis/main.py is the central Python entrypoint.
- The package is split into clear subsystems: app, config, execution, risk, simulators, and zeta_flux.
- This is the orchestration boundary where signals, risk checks, and execution decisions are assembled into one trading flow.
3. Signal generation / regime logic
- trading_engine/aegis/zeta_flux contains the signal/regime side of the system: reversal_predictor, chromadb_regime, sos27x_sentinel, akts, and related modules.
- These components appear to consume market features and produce directional or regime-aware outputs before execution.
- The tests in trading_engine/tests/unit and tests/integration indicate this layer is independently validated.
4. Execution and routing
- trading_engine/aegis/execution contains the execution logic, with submodules for ipda_core, aecabi, and urol.
- trading_engine/aegis/config/brokers includes broker-specific configuration for IB, LMAX, and Oanda, so execution is explicitly broker-abstracted.
- This is the point where strategy output becomes broker-facing order/action logic.
5. Risk and governance boundary
- trading_engine/aegis/risk implements hierarchical risk control via governance_hierarchy.py and hierarchy.py.
- The README’s “Adelic” and “Causal Truth Gating” ideas map to this kind of layer: it sits between signal generation and execution and can veto or constrain actions.
- trading_engine/tests/unit/test_adelic.py and tests/test_sos27x.py suggest risk/constraint behavior is a first-class subsystem.
6. Low-latency Rust infrastructure: hyperion
- hyperion is a Rust workspace with several crates focused on performance-sensitive plumbing.
- rpd_net handles socket/uring/zero-copy style networking concerns.
- rpd_executor and rpd_executor/src/pipeline.rs suggest streamed execution pipelines.
- fix-encoder is a FIX protocol encoding layer.
- schur_engine and ev-atr indicate specialized mathematical / allocation / confluence components.
- Architecturally, this is the systems boundary for ingestion, encoding, and transport.
7. Alternative Rust pipelines
- ASYNCRONIC-SYSTEM-rs is another standalone Rust engine with core, pipeline, analysis, and config modules.
- It includes indicators, kill_zone, state, and pipeline stages like aecabi, ipda, and urol.
- position-sizing-rs and multi-signal-rust are additional Rust crates that likely provide reusable trading/math primitives rather than the main orchestration path.
8. Adapters and external integration
- MCP-SERVERS/ipda-mcp.py and MCP-SERVERS/metatrader5-mcp.py are explicit integration points to external tooling/services.
- ipda-backend is a separate Python/Rust-backed service boundary with api/main.py, core/engine.py, and a Rust library under src/lib.rs.
- These are the places where the system likely exposes control or data access to other agents/tools or broker/execution environments.
9. Data and offline processing
- The repo carries many EUR/USD minute-bar datasets in candels, data-hist, eur-usd-dataset, eur-usd-dataset-ask, and uer2.
- Output folders such as annotated_candles.csv, pattern_sequence.txt, and training_data.csv show a pipeline that transforms raw candles into labeled sequences and training artifacts.
- data-hist/encoder.py, eur-usd-dataset/encoder.py, and data/data-pull.py suggest offline ingestion, encoding, and dataset consolidation are separate from live execution.
10. Research, visualization, and prototype space
- 3d-app-components, standalone-strategies, pine-scripts, and magnet-market contain experimental signal visualizations, geometry/state-space tools, and strategy prototypes.
- The 3D and manifold-oriented files (pca-reduced-space.py, persistent-homology.py, liquidity_field.py, surface-plot.py, etc.) are analysis aids, not the main runtime.
- pine-scripts and magnet-market provide cross-language strategy research in Python, Rust, and TradingView-oriented artifacts.
11. Deployment and build boundaries
- Makefile, deployment/docker, and scripts/*.sh define the build/run orchestration.
- The repo is clearly set up for mixed-language builds: Cargo for Rust crates, Python packaging/requirements for the engine side.
- docs/ contains architecture and theory material that appears to define the intended system model alongside the code.
12. High-level data flow to diagram
- The clearest architecture diagram is: market data and historical candles enter Rust ingestion/encoding layers, flow into Python/JAX signal and risk layers, then into execution adapters and broker integrations.
- Offline datasets also flow into encoder/annotation scripts and research notebooks, producing features and labels that feed back into strategy development.
- The Python trading engine and the Rust low-latency crates are the main boundary: math/decision logic on one side, transport/execution plumbing on the other.
Main entry points: ipda_core.py Execution core · pipeline.rs RPD executor · zeta_flux Zeta Flux · main.py Aegis main
Components 24
Python trading engine
Primary orchestration and decision-making runtime.
- Aegis main · Central Python entrypoint for the trading engine.
trading_engine/aegis/main.py - App layer · Top-level application wiring and entry coordination.
trading_engine/aegis/app/app.py - Zeta Flux · Signal generation and regime-aware market interpretation.
trading_engine/aegis/zeta_flux - Reversal model · Directional/reversal prediction logic.
trading_engine/aegis/zeta_flux/reversal_predictor.py - Regime store · Chromadb-backed regime context and retrieval.
trading_engine/aegis/zeta_flux/chromadb_regime.py - SOS27x sentinel · Sentinel layer for signal gating and monitoring.
trading_engine/aegis/zeta_flux/sos27x_sentinel.py - Risk governance · Hierarchical veto and constraint logic between signal and execution.
trading_engine/aegis/risk/governance_hierarchy.py - Execution core · Python execution boundary that turns decisions into actions.
trading_engine/aegis/execution/ipda_core/ipda_core.py - AECABI · Execution-stage logic for structured order handling.
trading_engine/aegis/execution/aecabi/aecabi.py - UROL · Execution-stage logic for routing and order lifecycle.
trading_engine/aegis/execution/urol/urol.py - Broker config · Broker-specific configuration for IB, LMAX, and Oanda.
trading_engine/aegis/config/brokers - Simulator · Local simulation path for validating strategy behavior.
trading_engine/aegis/simulators/sim1.py
Rust runtime stack
Low-latency transport, encoding, and execution plumbing.
- RPD net · Socket, uring, and zero-copy network plumbing.
hyperion/rpd_net/src - RPD executor · Streamed execution engine and pipeline coordinator.
hyperion/rpd_executor/src/pipeline.rs - FIX encoder · FIX message encoding and message framing.
hyperion/fix-encoder/src/encoder.rs - Schur engine · Specialized allocation/confluence and routing math.
hyperion/schur_engine/src/schur.rs - Asyncronic RS · Standalone Rust engine with core, analysis, and pipeline stages.
ASYNCRONIC-SYSTEM-rs/src
Research and prototypes
Experimental strategy, geometry, and visualization code.
- Research tools · 3D visualization, geometry, and strategy prototypes.
3d-app-components - Magnet market · Cross-language signal research and spectral/magnet-inspired modeling.
magnet-market/python/main.py
Data and offline prep
Historical market data, encoding, and label-generation pipelines.
- Dataset prep · Historical candle ingestion, encoding, and label generation.
data-hist/encoder.py - Market candles · EUR/USD minute-bar datasets used for research and training.
candels
Adapters and deployment
External integrations, backend services, and build/run tooling.
- IPDA backend · Separate backend service exposing IPDA engine functionality.
ipda-backend/core/engine.py - MCP servers · Agent/tool integration points for external control surfaces.
MCP-SERVERS/ipda-mcp.py - Deployment · Containerization and shell scripts for runtime setup.
deployment/docker/Dockerfile
Connections 24
- Market candles → Dataset prep: raw bars · Historical candles are encoded and labeled for offline use.
- Dataset prep → Research tools: features/labels · Prepared datasets feed analysis and prototype notebooks/scripts.
- Aegis main → App layer: boot · Main entrypoint initializes the application layer.
- App layer → Zeta Flux: signals · Application orchestration invokes signal/regime logic.
- Zeta Flux → Reversal model: predict · Core signal generation uses reversal prediction.
- Zeta Flux → Regime store: context · Regime-aware retrieval and state inform decisions.
- Zeta Flux → SOS27x sentinel: gate · Sentinel logic monitors and constrains signals.
- SOS27x sentinel → Risk governance: constraints · Sentinel outputs are enforced through risk governance.
- Risk governance → Execution core: allow/veto · Risk layer decides whether execution can proceed.
- Execution core → AECABI: stage · Execution core delegates to AECABI stage logic.
- Execution core → UROL: stage · Execution core delegates to UROL stage logic.
- Execution core → Broker config: routes · Execution is parameterized by broker-specific configuration.
- Execution core → Simulator: simulate · Execution logic is also exercised through simulation.
- RPD net → RPD executor: transport · Networking feeds the streamed execution pipeline.
- RPD executor → FIX encoder: encode · Execution pipeline emits FIX-formatted messages.
- RPD executor → Schur engine: math · Pipeline uses specialized math/routing primitives.
- Asyncronic RS → RPD executor: pipeline · Alternative Rust engine implements similar staged processing.
- Asyncronic RS → Schur engine: confluence · Rust subsystem shares routing/allocation ideas.
- IPDA backend → MCP servers: expose · Backend services are surfaced through external tool bridges.
- Deployment → Aegis main: run · Deployment scripts and containers launch the Python engine.
- Deployment → RPD net: build · Deployment supports the Rust networking/runtime pieces.
- Magnet market → Research tools: prototype · Magnet-market research complements the visualization and strategy space.
- Aegis main → RPD executor: plumbing · Python trading flow connects to Rust low-latency infrastructure.
- Execution core → IPDA backend: service · Execution and IPDA functionality can be delegated to the backend boundary.