Contracts / Interface
Overview
Order produced by OrderManagementSystem and published to the EventBus. Consumed by ExecutionSimulator. Carries full order lifecycle state (PENDING→FILLED/CANCELLED). Defined in src/domain/__init__.py.
Contract
Consumers
- ExecutionSimulator
- AuditLog
- IOrderRepository
Types
| Name | Base | Constraints / Values | Description |
| Order | dataclass | — | Order created by OrderManagementSystem and submitted for execution. |
Referenced By 1
Contracts
Documents
Order Data Contract table repo://graph/nodes/2eb5aab81557fbfee3566eaa8c37628c/artifacts/order-data-contract.md
Order Data Contract
Order produced by OrderManagementSystem and submitted to ExecutionSimulator via IBrokerAdapter.
Status updates published to the EventBus and consumed by PositionManager and RiskManagementEngine.
Source: src/domain/__init__.py — @dataclass class Order
Fields
| Field |
Type |
Required |
Default |
Description |
symbol |
str |
✓ |
— |
Ticker symbol (e.g. AAPL, MSFT) |
side |
Side |
✓ |
— |
BUY or SELL |
qty |
float |
✓ |
— |
Quantity to trade (shares) |
order_type |
OrderType |
✓ |
— |
MARKET or LIMIT |
strategy_id |
str |
✓ |
— |
ID of the strategy that originated this order |
signal_ref |
str |
✓ |
— |
signal_id of the Signal that triggered this order |
risk_ref |
str |
✓ |
— |
decision_id of the RiskDecision that approved this order |
status |
OrderStatus |
|
PENDING |
Current order status |
limit_price |
`float \ |
None` |
|
None |
Limit price (required for LIMIT orders) |
timestamp |
datetime |
|
now() |
UTC timestamp of order creation |
order_id |
str |
|
uuid4() |
Unique order identifier |
Enumerations
OrderType |
Value |
Description |
MARKET |
"MARKET" |
Execute at best available price |
LIMIT |
"LIMIT" |
Execute only at limit_price or better |
OrderStatus |
Value |
Description |
PENDING |
"PENDING" |
Order created, awaiting execution |
FILLED |
"FILLED" |
Order fully executed |
PARTIALLY_FILLED |
"PARTIALLY_FILLED" |
Order partially executed |
CANCELLED |
"CANCELLED" |
Order cancelled before fill |
REJECTED |
"REJECTED" |
Order rejected by broker/exchange |
Consumers
| Component |
Usage |
ExecutionSimulator |
Receives order via IBrokerAdapter; returns Execution on fill |
PositionManager |
Tracks order status changes to update positions |
RiskManagementEngine |
Monitors open orders for exposure tracking |
Notes
order_id is referenced by Execution.order_id to link fills to orders
limit_price must be set when order_type == LIMIT; ignored for MARKET orders
- Full audit trail:
signal_ref → risk_ref → order_id → exec_id
Order Class Diagram diagram repo://graph/nodes/2eb5aab81557fbfee3566eaa8c37628c/artifacts/order-class-diagram.md
