of_adapters
of_adapters defines the provider boundary between venue-specific feeds and the normalized Orderflow runtime.
It standardizes lifecycle, subscription, polling, and health reporting while keeping provider protocol details isolated.
Core API
- Trait: [
MarketDataAdapter] - Factory: [
create_adapter] - Events: [
RawEvent] (Book,Trade) - Config: [
AdapterConfig], [ProviderKind], [CredentialsRef] - Health: [
AdapterHealth]
Provider Strategy
The crate is built around a feature-gated provider model:
- Always available:
Mockprovider - Optional:
Rithmic,CQG,Binance(enable via Cargo features)
This keeps the default build deterministic while allowing production adapters where needed.
Create an Adapter
use ;
let cfg = AdapterConfig ;
let mut adapter = create_adapter.expect;
adapter.connect.expect;
assert!;
Mock Adapter for Tests and Replays
[MockAdapter] is useful for deterministic tests and simulation pipelines:
use ;
use ;
let symbol = SymbolId ;
let mut adapter = default;
adapter.connect.expect;
adapter.subscribe.expect;
adapter.push_event;
let mut out = Vecnew;
let n = adapter.poll.expect;
assert_eq!;
assert_eq!;
Error Handling
All adapter operations return [AdapterResult<T>] with [AdapterError], covering:
- disconnected state
- missing configuration
- provider feature not enabled at build time
- provider-specific operational errors