of_runtime
of_runtime is the orchestration layer for live, replay, and external-ingest workflows.
It wires adapter events into analytics, applies quality-aware signal logic, and exposes health/metrics snapshots.
Runtime Responsibilities
- Connect and supervise a
MarketDataAdapter. - Process normalized
RawEventstreams. - Update analytics using
of_core. - Evaluate signal modules from
of_signals. - Gate risk-sensitive output using
DataQualityFlags. - Optionally persist event streams via
of_persist.
Main Types
- [
EngineConfig] - runtime, adapter, audit, and retention config. - [
Engine<A, S>] - generic runtime over adapter and signal module. - [
DefaultEngine] - boxed adapter + default delta signal. - [
RuntimeError] - lifecycle/config/adapter/io errors. - [
ExternalFeedPolicy] - stale and sequence policy for non-adapter ingest mode.
End-to-End Example (Adapter Polling)
use MockAdapter;
use ;
use ;
use DeltaMomentumSignal;
let adapter = default;
let signal = new;
let mut engine = new;
engine.start?;
engine.subscribe?;
let _processed = engine.poll_once?;
engine.stop;
# Ok::
External Ingest Example (Broker Bridge)
use MockAdapter;
use ;
use ;
use DeltaMomentumSignal;
let mut engine = new;
engine.start?;
engine.configure_external_feed?;
engine.ingest_trade?;
let health = engine.health_json;
assert!;
# Ok::
Health and Metrics Contracts
- [
Engine::metrics_json] exposes runtime counters and adapter status. - [
Engine::health_json] exposes connectivity/degradation/reconnect state and active quality flags. - [
Engine::health_seq] increments on meaningful health transitions for cheap external polling.
Config Loading
Use [load_engine_config_from_path] to load TOML config files and [validate_startup_config] to fail fast
on missing credentials or invalid startup settings before going live.
Operational Guidance
- Call [
Engine::start] before subscribe/poll/ingest operations. - Use
configure_external_feed+external_health_tickwhen ingesting from non-adapter bridges. - For deterministic simulation, pair
MockAdapterwith replayed events and fixed timestamps.