gordon-domain
Purpose
Shared domain crate for the Gordon platform. Holds every business type that crosses a service boundary — market primitives, order lifecycle types, intents, trades, events, deploy and reconcile records, strategy state, overlay decisions — plus the ExecutionModel trait implemented by both gordon-strategy's backtest engine and gordon-executor's live submission path. Carved out of gordon-contracts at the 7.0 split (2026-05-15). Isolating domain from the bus wire crate (gordon-protocol) and the infra kernel (gordon-kernel) is what keeps the latter two stable while domain churns with business changes.
Version + status
1.1.0 — active churn. Drift ceiling: 2 minors max. Churns weekly with business changes. Lean type roster after Wave 2.5 cleanup.
Public surface
types/
Cross-service domain types, exported as gordon_domain::types::<Name>:
- market —
Symbol,Timeframe,Side,PositionSide,OrderType,Kline,Pair,Candle - intents —
OrderIntent,IntentType,EntryType,Network - orders —
Order,OrderRole,OrderState,OrderStatus,BinanceOrderType - trades —
Trade,TradeSide - events —
BotEvent,BotCommand,DataEvent,SourceCommand,FlattenScope,FlattenStrategy,BreakGlassOutcome - bot —
BotConfig,BotConfigHistoryRecord,DesiredState,StrategyParamsError - deploy —
BotDeploy,DeployState,AbortReason - reconcile —
ReconcileRun,ReconcileOutcome - strategy_state —
BotStrategyState - overlay_decisions —
OverlayDecision,OverlayDecisionPayload - error_response —
ErrorResponseHTTP body EventEnvelope<T>— generic cross-service event wrapper (v,ts,trace_id,payload)
execution/
The ExecutionModel trait surface plus supporting types:
ExecutionModel—async_traitwithsubmit_order,close_position,modify_stop_price,flatten_all. Implemented bygordon-strategy::BacktestExecution(backtest) and gordon-executor's live path (live). Same trait, two impls — structural backtest = live.ExchangeOrderAck,FillEvent,FillKind,Position,ExecutionError,AckState— lifecycle types the trait surface uses.
Bus mirror discipline
OrderIntent lives here; OrderIntentEvent (the bus-wire mirror) lives in gordon-protocol. They are deliberately separate types: the wire type evolves additive-only with schema_version: u16; the in-process type is free to gain non-serialisable fields. Same pattern for FillEvent — the executor's lifecycle FillEvent lives in execution/, while the bus delivery payload lives in gordon-protocol::bus::trading.
Dependencies of note
gordon-kernel(^2) —GordonError/ErrorKindforResult<_, GordonError>returns andExecutionModelerror surfaces.sqlx—FromRowderives onOrder,Trade,BotConfig,BotStrategyStateso service consumers reuse the canonical struct.utoipa—ToSchemaderives on every public wire type so OpenAPI bodies are generated without redefining shapes.rust_decimal— quantity / fee precision.
Invariants
- Cross-service vocabulary only. Types internal to one service stay in that service.
- No I/O. No DB, no HTTP, no async beyond the
async_traitveneer onExecutionModel. - Zero
#[allow(...)]. - When adding a type that rides a NATS subject, mirror it additive-only into gordon-protocol — do not share the in-process type with the wire.
Where it lives
- Repo:
gordon-domain/ - kellnr:
https://kellnr.lepaux.com/crates/gordon-domain(LAN-only)
Related
- gordon-kernel — error taxonomy consumed by domain results.
- gordon-protocol — bus-wire mirrors of domain types.
- gordon-strategy — implements
ExecutionModelasBacktestExecution.