Expand description
Execution adapter scaffolds for Orderflow.
§of_execution_adapters
of_execution_adapters contains optional execution adapter scaffolds for
Orderflow venues, brokers, and execution protocols.
This crate is separate from of_execution so provider-specific dependencies
can remain feature-gated and so the core execution engine does not depend on a
particular broker SDK, FIX stack, REST client, WebSocket implementation, or
native transport.
Current scaffold:
fixfeature: FIX-style execution-report mapping and fail-closed adapter shell.
§First Release: 0.1.0
of_execution_adapters publishes as 0.1.0 inside the broader Orderflow
0.4.0 release. It is a new adapter-scaffold family, not a mature production
provider suite.
Versioning rules:
of_execution_adaptersdepends onof_execution = 0.1andof_execution_core = 0.1;- provider-specific scaffolds stay feature-gated and opt-in;
- fail-closed scaffolds are allowed in
0.1.xas long as README and docs state the production boundary clearly; - production adapters should document certification status, recovery behavior, rate limits, duplicate handling, and latency assumptions.
§Design Goals
- Keep provider-specific code outside the execution core.
- Keep optional transports behind feature flags.
- Map provider reports into canonical
ExecutionEventvalues. - Fail closed until a real transport is wired.
- Expose honest capabilities and health.
- Preserve low-latency typed request/report boundaries.
- Avoid pretending that a scaffold is a production live adapter.
§Feature Flags
| Feature | Default | Purpose |
|---|---|---|
fix | no | Enables of_execution_adapters::fix |
The crate has default = []. Consumers opt in to provider scaffolds explicitly:
[dependencies]
of_execution_adapters = { version = "0.1.0", features = ["fix"] }§Public API Inventory
With the fix feature enabled:
fix::FixSessionConfigfix::FixExecutionReportfix::FixExecTypefix::FixOrdStatusfix::map_execution_reportfix::FixExecutionAdapter
§FIX Scaffold
The FIX module is not a full FIX engine. It does not implement TCP/TLS, logon/logout, heartbeats, resend requests, sequence reset, session stores, message parsing, or exchange-specific certification behavior.
It provides the reusable pieces that are safe to share at this layer:
- session configuration shape,
- normalized execution-report struct,
- FIX-style exec type/status enums,
- mapping into the canonical execution model,
- adapter shell implementing the
ExecutionAdaptertrait, - fail-closed behavior until transport is configured.
§FixSessionConfig
fix::FixSessionConfig describes a FIX session identity:
begin_string: FIX version such asFIX.4.4sender_comp_id: SenderCompIDtarget_comp_id: TargetCompIDheartbeat_secs: negotiated heartbeat interval
The string fields use fixed ASCII identifiers from of_execution_core. This
keeps the same low-allocation and FFI-safe identity discipline as the rest of
the execution model.
use of_execution_adapters::fix::FixSessionConfig;
let cfg = FixSessionConfig::new("FIX.4.4", "BUY_SIDE", "BROKER", 30)?;
assert_eq!(cfg.heartbeat_secs, 30);§FixExecutionReport
fix::FixExecutionReport is the normalized result of parsing a provider FIX
execution report. It is not a raw tag map.
Important fields:
exec_typeord_statuscl_ord_idorig_cl_ord_idorder_idexec_idaccount_idroute_idsymbollast_qtylast_pricecumulative_qtyleaves_qtyaverage_pricets_exchange_nsts_recv_nstext
A real FIX adapter should parse bytes or tag maps into this struct, then call
fix::map_execution_report to produce a canonical ExecutionEvent.
§FIX Exec Type And Status
fix::FixExecType represents FIX-style execution report reasons:
NewCanceledReplacedPendingCancelRejectedTradeExpiredPendingReplaceRestatedStatus
fix::FixOrdStatus represents FIX-style order status:
NewPartiallyFilledFilledDoneForDayCanceledReplacedPendingCancelStoppedRejectedSuspendedPendingNewCalculatedExpiredAcceptedForBiddingPendingReplace
The mapper converts these into canonical ExecutionType and OrderStatus
values from of_execution_core.
§Mapping Semantics
fix::map_execution_report maps normalized FIX reports into canonical
execution events.
Examples:
| FIX concept | Canonical event |
|---|---|
| New | ExecutionType::Ack, OrderStatus::New |
| Trade | ExecutionType::Trade, filled or partially filled status |
| Rejected | ExecutionType::Reject, OrderStatus::Rejected |
| PendingCancel | ExecutionType::CancelPending |
| Canceled | ExecutionType::CancelAck, OrderStatus::Cancelled |
| PendingReplace | ExecutionType::ReplacePending |
| Replaced | ExecutionType::ReplaceAck, OrderStatus::Replaced |
| Expired | ExecutionType::Expired, OrderStatus::Expired |
| Restated | ExecutionType::Restated |
| Status | ExecutionType::Status |
The mapper preserves:
- client order id,
- original client order id,
- venue order id,
- execution id,
- account and route,
- symbol,
- fill quantities and prices,
- cumulative and leaves quantities,
- average price,
- exchange and receive timestamps,
- bounded text.
It does not handle transport ordering, FIX session sequence numbers, resend logic, duplicate suppression, or broker-specific certification rules. Those belong in a real adapter implementation.
§FixExecutionAdapter
fix::FixExecutionAdapter implements of_execution::ExecutionAdapter, but
it is a fail-closed shell.
Current behavior:
connect()returns an adapter error saying transport is not configured.submit(),cancel(),amend(),poll(), andrecover_open_orders()return disconnected errors.capabilities()reports ordinary FIX-style order support.health()reports disconnected/degraded state with protocol info.config()returns the storedfix::FixSessionConfig.
This is intentional. It gives adapter authors a compilable shape and shared mapping contract without implying that a production FIX session is present.
§Implementing A Real Adapter
A production adapter built from this scaffold should:
- Own the provider session or transport.
- Validate lifecycle before accepting commands.
- Translate
OrderRequest,CancelRequest, andAmendRequestinto provider messages. - Parse provider reports into
FixExecutionReportor an equivalent internal normalized report. - Convert reports into
ExecutionEventvalues. - Preserve client-order-id semantics where the venue supports them.
- Implement
recover_open_orderswith restatement reports. - Expose accurate
ExecutionCapabilities. - Expose meaningful
ExecutionHealth. - Keep command and report queues bounded.
- Handle duplicate or out-of-order provider messages explicitly.
- Keep credentials and secrets out of logs and diagnostic text.
§Request Mapping Guidance
Canonical fields should map explicitly:
| Canonical field | FIX-style mapping |
|---|---|
client_order_id | ClOrdID |
orig_client_order_id | OrigClOrdID |
account_id | Account |
route_id | session, destination, or broker route |
symbol | Symbol or provider-native instrument fields |
side | Side |
order_type | OrdType |
time_in_force | TimeInForce |
quantity | OrderQty |
limit_price | Price |
stop_price | StopPx |
Do not silently coerce unsupported order types or TIFs. Return a structured error or let capability checks reject the command before routing.
§Report Mapping Guidance
Provider reports should become canonical ExecutionEvent values:
- provider order id ->
venue_order_id - provider execution id ->
execution_id - last fill quantity/price ->
last_qtyandlast_price - cumulative quantity ->
cumulative_qty - leaves quantity ->
leaves_qty - average price ->
average_price - status and exec reason ->
exec_typeandorder_status - provider text -> bounded
text
If a provider omits a field, use the canonical empty or zero value and document that behavior in the adapter.
§Capabilities And Health
ExecutionCapabilities should be honest:
- set unsupported order types to
false, - set unsupported TIFs to
false, - set
native_client_order_idaccording to provider behavior, - choose a realistic
LatencyClass.
ExecutionHealth should report:
connected,degraded,health_seq,last_error,protocol_info.
Increment health sequence when meaningful lifecycle state changes.
§Low-Latency Guidance
- Parse provider messages into canonical reports quickly.
- Use bounded queues for inbound and outbound reports.
- Avoid string formatting on command and report hot paths.
- Do not call strategy callbacks while holding adapter locks.
- Apply venue throttles before sending.
- Prefer fixed-size IDs and integer-normalized prices/quantities.
- Surface backpressure, disconnects, and degraded states explicitly.
§Testing Checklist
Every real adapter should test:
- connect and health reporting,
- command rejection before connect,
- new-order ack mapping,
- venue reject mapping,
- partial fill mapping,
- full fill mapping,
- cancel pending and cancel ack mapping,
- cancel reject mapping,
- replace pending and replace ack mapping,
- replace reject mapping,
- expired/restated/status reports,
- duplicate provider reports,
- out-of-order provider reports,
- bounded event buffer pressure,
- recovery/open-order restatement,
- capability reporting,
- reconnect lifecycle transitions.
§What This Crate Does Not Do
This crate does not currently provide:
- a production FIX transport,
- a REST execution adapter,
- a WebSocket execution adapter,
- broker authentication,
- exchange certification logic,
- a session message store,
- resend/sequence-reset implementation,
- order throttling by itself.
Use of_execution for the execution engine, simulated execution, journals,
reconciliation, safety policies, throttling helpers, and provider SDK helpers.
§Documentation
Additional project documentation:
docs/handbook/05i-of-execution-adapters-reference.mddocs/handbook/12-provider-adapter-authoring.mddocs/handbook/11-low-latency-design.md
Modules§
- fix
- FIX execution adapter scaffold and report mapper.