How deskiziarecords/smart-exe works
1. Overall shape
This repo is a Python-first trading system with three clear zones: a live decision/execution loop, an offline learning and analysis pipeline, and a small UI/server layer for monitoring. The main runtime appears to be centered around main.py, with start_hyperion.py, main_server.py, and controller.py acting as alternate launch/orchestration paths.
2. Market data boundary
Live market input is handled by the data-ingestion side of the system, represented by oanda_stream.py and tick_aggregator.py in the tree, plus the README’s data_feed.py concept. This layer is responsible for taking OANDA market data and turning raw ticks into structured price windows that downstream engines can evaluate.
3. Pattern encoding subsystem
encoder.py, pattern_encoder_fast.py, and core/jax_pattern_engine.py form the feature/pattern interpretation layer. Their role is to convert candle or tick sequences into symbolic or vectorized representations that can be compared, scored, or passed into memory/model components. The presence of a “fast” encoder and a JAX-based engine suggests performance-sensitive pattern processing.
4. Memory and similarity search
memory.py and memory/jax_faiss_memory.py implement the repository’s pattern memory. This is not just storage; it is a retrieval layer that likely compares current market structure against prior sessions and associates patterns with outcomes. FAISS is the key architectural boundary here: it separates the live engine from fast nearest-neighbor retrieval over stored embeddings or signatures.
5. Risk gating and trade approval
risk_engine.py and lambda7.py are the decision gates between “interesting market state” and “order allowed.” The README describes entropy filtering, memory agreement, and macro causal validation. Architecturally, this means the system is designed to reject by default and only pass a trade when multiple independent checks align.
6. Execution layer
trader.py is the order-placement boundary, likely responsible for translating an approved signal into OANDA orders and handling execution details like sizing and trade submission. market_engine.py appears to sit near this boundary as a market/state manager, probably coordinating conditions needed for execution or live tracking.
7. Control and orchestration
controller.py and main.py are the main application coordinators. controller.py is especially important for multi-asset or session-based orchestration, while main.py is the single-symbol/live-brain entry point described in the README. start_hyperion.py likely wraps startup behavior for the full system.
8. Logging and feedback loop
logger.py captures blocked trades and other decision outputs, with logs/blocked_trades.jsonl as the persistent audit trail described in the README. This logging boundary is important because rejected trades are treated as training data, not just diagnostics.
9. Offline dataset and learning pipeline
dataset_builder.py turns live-session logs into training data. That creates the feedback loop from rejected/accepted decisions back into future model improvement. The repo also contains model.py, which the README frames as a GRU-ready neural component, suggesting the system is designed to evolve from rule-heavy gating toward learned prediction.
10. Training and experimental ML
The geometric_training/train_per_asset.py path and the training GRU directory indicate a separate offline experimentation area for per-asset or model training workflows. This is distinct from live execution: training consumes historical logs/exports, while the live loop consumes market data and emits trades or blocks.
11. UI and operator surface
The ui/ directory is a separate React/Vite frontend. It is likely a monitoring or visualization layer rather than the trading core itself. main_server.py likely exposes the backend API that bridges live system state, logs, and model outputs to the frontend.
12. Artifacts and exported state
Files like vector_export.json and report.json indicate offline export artifacts, likely used for inspection, memory serialization, or training/report generation. These sit outside the live path and help move data between the execution subsystem and analysis/training tools.
13. Technology boundaries that matter
The repo is primarily Python, with a frontend in TypeScript/React/Vite. FAISS is used for similarity search, and the README explicitly mentions OANDA as the external trading/data provider. JAX and PyTorch appear in the tree/README as acceleration and modeling technologies, but they are secondary to the core architecture: ingest, encode, retrieve memory, gate risk, execute, log, retrain.
14. Diagramming summary
For an architecture diagram, the cleanest flow is: OANDA data → tick aggregation/encoding → memory + causal/risk evaluation → trade decision → trader/execution, with a side loop from logger → dataset_builder → model/training → improved parameters/memory artifacts. The UI/server layer should be drawn as an observability/control plane around the live system, not inside the trading decision path.
Main entry points: memory.py Pattern memory · jax_pattern_engine.py JAX engine · risk_engine.py Risk engine · controller.py Controller
Components 22
Live trading
Real-time market intake, pattern evaluation, risk gating, and execution.
- OANDA stream · External live market data source and stream adapter.
oanda_stream.py - Tick aggregator · Converts raw ticks into structured price windows.
tick_aggregator.py - Market engine · Maintains live market state and execution-adjacent coordination.
market_engine.py - Pattern encoder · Transforms candles or ticks into symbolic or vector representations.
encoder.py - Fast encoder · Performance-oriented pattern encoder implementation.
pattern_encoder_fast.py - JAX engine · JAX-based pattern processing and scoring core.
core/jax_pattern_engine.py - Risk engine · Filters candidates using entropy, agreement, and validation checks.
risk_engine.py - Lambda7 gate · Additional causal or macro validation for trade approval.
lambda7.py - Trader · Translates approved signals into orders and execution actions.
trader.py
Offline learning
Dataset generation, model training, and export artifacts.
- Dataset builder · Turns logs and session history into training data.
dataset_builder.py - Model · Learned predictive component used by the offline and future live pipeline.
model.py - Per-asset training · Offline per-asset training workflow and experiments.
geometric_training/train_per_asset.py - Reports · Exported analysis outputs and serialized reports.
report.json - Vector export · Exported embeddings or memory state for inspection or reuse.
vector_export.json
Control plane
Launchers, orchestration, logging, and operator-facing server/UI.
- Main loop · Primary live trading entry for a single-symbol or focused runtime.
main.py - Startup wrapper · Alternate bootstrap path for the broader system.
start_hyperion.py - Controller · Coordinates sessions, assets, and overall runtime flow.
controller.py - Main server · Backend surface for monitoring and control.
main_server.py - Decision log · Persists blocked trades and decision outcomes.
logger.py - Operator UI · React/Vite dashboard for observability and interaction.
ui/src/App.tsx
Memory layer
Similarity search and pattern memory used by the live engine.
- Pattern memory · Live memory of prior patterns and outcomes.
memory.py - FAISS memory · Vector similarity retrieval backing the memory boundary.
memory/jax_faiss_memory.py
Connections 25
- Main loop → Controller: orchestrates · Main runtime delegates session and asset coordination.
- Startup wrapper → Controller: boots · Startup wrapper initializes the coordinated system.
- Controller → OANDA stream: subscribes · Controller ties live runtime to market data input.
- OANDA stream → Tick aggregator: feeds · Raw market stream is normalized into tick windows.
- Tick aggregator → Pattern encoder: encodes · Aggregated price action is transformed into patterns.
- Tick aggregator → Fast encoder: encodes · High-throughput path for pattern encoding.
- Pattern encoder → JAX engine: scores · Encoded structures are evaluated by the pattern engine.
- Fast encoder → JAX engine: scores · Accelerated patterns flow into the same scoring core.
- JAX engine → Pattern memory: queries · Pattern engine consults prior analogues and outcomes.
- Pattern memory → FAISS memory: retrieves · Similarity search is backed by vector lookup.
- JAX engine → Risk engine: candidates · Pattern results become trade candidates for gating.
- Pattern memory → Risk engine: agreement · Memory consensus informs whether a setup is trusted.
- Risk engine → Lambda7 gate: validates · Secondary causal or macro gate is applied.
- Lambda7 gate → Trader: approves · Only approved signals can reach execution.
- Market engine → Trader: context · Market state supports order timing and live handling.
- Trader → Decision log: records · Execution outcomes and blocked decisions are logged.
- Risk engine → Decision log: blocks · Rejected trades are persisted for audit and learning.
- Decision log → Dataset builder: exports · Decision history becomes offline training material.
- Dataset builder → Model: trains · Prepared data feeds the predictive model.
- Model → Per-asset training: used by · Model training experiments consume the learned component.
- Per-asset training → Reports: emits · Training produces reports and analysis outputs.
- Pattern memory → Vector export: exports · Pattern memory state can be serialized for offline use.
- Main server → Operator UI: serves · Backend exposes state and logs to the operator UI.
- Main loop → Main server: exposes · Live runtime can publish status through the server layer.
- Controller → Main server: updates · Orchestrator feeds control and monitoring data upward.