How sultanrayan/orderflow-tooling works
OrderFlow Engineer turns market trades and order-book data into structured order-flow evidence, then packages it for an AI-generated trading signal. The main path runs from ingestion through primitives, pattern detection and market context to a compact payload and validated response. The CLI also exposes collection, replay and backtesting. The README documents the layer relationships; sampled source confirms key orchestration points. Some subsystem internals were not excerpted, so their edges rely on documented relationships rather than inferred calls.
Main entry points: pipeline.py Analysis pipeline · hub.py Ingestion hub · client.py AI client · cli.py CLI commands
Components 24
Market ingestion
- Ingestion hub
src/orderflow_ai/ingestion/hub.py - Feed adapters
src/orderflow_ai/ingestion/feeds - Market data models
src/orderflow_ai/core/models.py - Candle construction
src/orderflow_ai/ingestion/candle_builder.py
Order-flow analysis
- Primitive engine
src/orderflow_ai/primitives/engine.py - Primitive results
src/orderflow_ai/primitives/models.py - Pattern engine
src/orderflow_ai/patterns/engine.py - Fallback scoring
src/orderflow_ai/patterns/fallback.py - Pattern results
src/orderflow_ai/patterns/models.py - Analysis pipeline
src/orderflow_ai/core/pipeline.py - Analysis snapshot
src/orderflow_ai/core/analysis.py
Market context
- Context builder
src/orderflow_ai/context/builder.py - Context models
src/orderflow_ai/context/models.py - Timeframe utilities
src/orderflow_ai/core/timeframes.py
Signal generation
- Payload formatter
src/orderflow_ai/output/formatter.py - Prompt builder
src/orderflow_ai/output/prompt.py - AI client
src/orderflow_ai/ai/client.py - AI providers
src/orderflow_ai/ai/providers.py - Response validation
src/orderflow_ai/output/schema.py
Interfaces and evaluation
- CLI commands
src/orderflow_ai/cli.py - Backtest engine
src/orderflow_ai/backtest/engine.py - Optional cache
src/orderflow_ai/storage/cache.py
Other components
- Exchange feeds
- Trading signal
Connections 27
- Exchange feeds → Ingestion hub: supplies market data
- Ingestion hub → Feed adapters: orchestrates feeds
src/orderflow_ai/ingestion/hub.py - Ingestion hub → Market data models: normalizes into
src/orderflow_ai/ingestion/hub.py - Ingestion hub → Analysis pipeline: streams trades to
src/orderflow_ai/core/pipeline.py - Analysis pipeline → Candle construction: builds closed bars
src/orderflow_ai/core/pipeline.py - Analysis pipeline → Primitive engine: computes primitives
src/orderflow_ai/core/pipeline.py - Primitive engine → Primitive results: returns results
src/orderflow_ai/primitives/engine.py - Analysis pipeline → Pattern engine: detects patterns
src/orderflow_ai/core/pipeline.py - Pattern engine → Fallback scoring: scores fallback
src/orderflow_ai/patterns/engine.py - Pattern engine → Pattern results: returns matches
src/orderflow_ai/patterns/engine.py - Analysis pipeline → Context builder: builds context
src/orderflow_ai/core/pipeline.py - Context builder → Context models: creates context
- Context models → Timeframe utilities: uses timeframe types
src/orderflow_ai/context/models.py - Analysis pipeline → Analysis snapshot: assembles analysis
src/orderflow_ai/core/pipeline.py - Analysis pipeline → Payload formatter: builds payload
src/orderflow_ai/core/pipeline.py - Payload formatter → Analysis snapshot: summarizes evidence
src/orderflow_ai/output/formatter.py - Analysis pipeline → Prompt builder: builds prompt
src/orderflow_ai/core/pipeline.py - Prompt builder → Payload formatter: formats payload
src/orderflow_ai/output/prompt.py - AI client → Prompt builder: prepares request
src/orderflow_ai/ai/client.py - AI client → AI providers: dispatches request
src/orderflow_ai/ai/client.py - AI client → Response validation: validates response
src/orderflow_ai/ai/client.py - AI client → Trading signal: returns accepted signal
- CLI commands → Analysis pipeline: runs analysis
src/orderflow_ai/cli.py - CLI commands → Backtest engine: runs backtests
- CLI commands → Ingestion hub: collects market data
src/orderflow_ai/cli.py - Backtest engine → Analysis pipeline: reuses analysis
src/orderflow_ai/backtest/engine.py - Ingestion hub → Optional cache: may cache data