How deskiziarecords/hyperion works
1. Repository shape
- This is primarily a Rust 2021 crate that looks like a single executable plus library modules (src/main.rs, src/lib.rs).
- There is also a Python sidecar/research layer (main_hybrid.py, logic/*.py) that appears to prototype or mirror some of the same signal-processing ideas, but the main architecture is Rust-first.
2. Top-level responsibility
- The repo is organized around a market strategy engine for an IPDA-style trading model.
- The core job is: ingest live market data, derive a market state, decide whether a regime/phase change has occurred, and then route execution across venues.
3. Shared domain model
- src/types.rs defines the main data structures used across the system: price frames, market context, and strategy-level abstractions.
- This file is the main boundary for what counts as “market truth” inside the engine, and it likely feeds both analysis and execution layers.
4. Market data pipeline
- src/data/realtime.rs and src/data/candle_builder.rs form the ingestion path from raw ticks/streaming data into higher-level candle/price-frame objects.
- This is the front of the runtime data flow: external market feed → normalized realtime events → aggregated candles/frames used by the strategy logic.
5. Strategy state machine
- src/continuum.rs is the centerpiece of the strategy, described in the README as the HamiltonianEngine.
- It models regime transitions such as consolidation, expansion, retracement, reversal, and stasis, using volatility/range conditions and “displacement veto” style filters to decide when a move is actionable.
6. IPDA and liquidity logic
- src/ipda.rs, src/kill_zone.rs, src/urol.rs, and src/aecabi.rs are the strategy-specific analytical modules.
- These likely encapsulate price-delivery assumptions, session/time-window logic, liquidity targeting, and other internal concepts that feed the state machine and signal generation.
7. Order routing and execution boundary
- src/routing.rs and src/engine/execution.rs represent the handoff from signal to trade action.
- The router decides how an order should be split or dispatched, while the execution layer translates that decision into broker-specific actions.
8. Runtime state management
- src/engine/state.rs is the internal bookkeeping layer for the running strategy.
- This is where current position/order status, active regime, and other execution-time state would be maintained so that routing and strategy logic stay synchronized.
9. Exchange/broker integrations
- src/brokers/bitget.rs, bybit.rs, mexc.rs, and okx.rs are venue adapters behind src/brokers/mod.rs.
- These modules are the external-service boundary of the system: they isolate exchange-specific APIs, auth, order formats, and response handling from the core strategy logic.
10. Python research/prototype layer
- The logic/ directory contains standalone Python implementations of related analytic ideas, including reverse-period detection and adelic/koopman-inspired helpers.
- This looks like a research sandbox rather than the main runtime path, useful for experimentation, validation, or alternative signal derivations.
11. End-to-end data flow
- The likely live path is: broker/market feed → realtime ingestion → candle construction → strategy/state computation in continuum/ipda/types → routing decision → execution through broker adapters.
- The core architecture is therefore a tight in-memory streaming pipeline, not a service-oriented system with databases or message brokers visible in the tree.
12. What to draw as boundaries
- Separate the diagram into four main boxes: Market Data Ingestion, Strategy/State Engine, Routing & Execution, and Broker/Venue Adapters.
- Put the Python logic/ folder off to the side as an auxiliary analysis/prototyping track, and treat src/types.rs as the shared contract layer that connects the whole system.
Main entry points: continuum.rs Hamiltonian engine · mod.rs Broker hub · lib.rs Rust crate · realtime.rs Realtime feed
Components 20
Market Data Ingestion
Realtime feed normalization and candle/frame construction.
- Realtime feed · Normalizes incoming live market data into internal events.
src/data/realtime.rs - Candle builder · Aggregates realtime events into candles and price frames.
src/data/candle_builder.rs
Strategy / State Engine
Shared domain model and regime detection logic.
- Shared types · Core market and strategy data structures shared across the engine.
src/types.rs - Hamiltonian engine · Core strategy engine for consolidation, expansion, retracement, reversal, and stasis.
src/continuum.rs - IPDA logic · Price-delivery and market-structure assumptions feeding signals.
src/ipda.rs - Kill zones · Session and time-window logic used by the strategy.
src/kill_zone.rs - UROL · Liquidity-oriented strategy heuristics and targeting rules.
src/urol.rs - AECABI · Additional strategy analysis and signal support.
src/aecabi.rs
Routing & Execution
Signal handoff, order state, and trade execution.
- Order router · Decides how trade actions should be split or dispatched.
src/routing.rs - Execution layer · Turns routing decisions into broker-facing actions.
src/engine/execution.rs - Runtime state · Maintains current position, order, and regime bookkeeping.
src/engine/state.rs
Broker / Venue Adapters
Exchange-specific integration layer.
- Broker hub · Shared module that exposes venue adapters.
src/brokers/mod.rs - Bitget · Bitget exchange integration.
src/brokers/bitget.rs - Bybit · Bybit exchange integration.
src/brokers/bybit.rs - MEXC · MEXC exchange integration.
src/brokers/mexc.rs - OKX · OKX exchange integration.
src/brokers/okx.rs
Python Research Layer
Prototype and analytical implementations outside the main Rust runtime.
- Hybrid runner · Python-side prototype or orchestration entrypoint.
main_hybrid.py - Research logic · Standalone Python implementations of related signal and detection ideas.
logic/reverse_period_detector.py
Other components
- Rust crate · Primary Rust library and executable entrypoints.
src/lib.rs - Main entry · Rust executable entrypoint.
src/main.rs
Connections 20
- Main entry → Rust crate: starts · Binary uses the shared Rust library.
- Rust crate → Shared types: shares model · Core modules depend on the shared market contract.
- Rust crate → Realtime feed: ingests · Library pulls live market data into the pipeline.
- Realtime feed → Candle builder: builds · Realtime events are aggregated into candles and frames.
- Candle builder → Hamiltonian engine: feeds · Constructed market frames drive regime analysis.
- Shared types → Hamiltonian engine: structures · Strategy state machine works over shared market types.
- Hamiltonian engine → IPDA logic: uses · Regime logic incorporates IPDA-style assumptions.
- Hamiltonian engine → Kill zones: filters · Session windows constrain actionable signals.
- Hamiltonian engine → UROL: consults · Liquidity heuristics inform signal quality.
- Hamiltonian engine → AECABI: augments · Additional analysis supports the core engine.
- Hamiltonian engine → Runtime state: updates · Strategy transitions are persisted into runtime state.
- Runtime state → Order router: guides · Current state influences order routing decisions.
- Order router → Execution layer: dispatches · Routing results are handed to execution.
- Execution layer → Broker hub: adapts to · Execution targets the broker integration layer.
- Broker hub → Bitget: includes · Broker hub exposes Bitget adapter.
- Broker hub → Bybit: includes · Broker hub exposes Bybit adapter.
- Broker hub → MEXC: includes · Broker hub exposes MEXC adapter.
- Broker hub → OKX: includes · Broker hub exposes OKX adapter.
- Hybrid runner → Research logic: runs with · Python entrypoint uses the research sandbox.
- Research logic → Hamiltonian engine: mirrors · Python logic prototypes similar analytical ideas.