Overview
Manages the full order lifecycle including submission, tracking, amendment, and cancellation. Routes orders to the Execution Simulator in the prototype.
Documents
Order Management System
Responsibilities
Manages the full order lifecycle: creation, tracking, amendment, and cancellation.
- Subscribes to Signal — caches for direction lookup
- Subscribes to RiskDecision — creates Order on approval; publishes ORDER_REJECTED audit on rejection
- Subscribes to Execution — updates order status to FILLED or PARTIALLY_FILLED
Interface
| Method | Description |
|---|---|
get_order(order_id) |
Look up a single order by ID |
amend_order(order_id, qty, limit_price) |
Change qty/price of a PENDING order |
cancel_order(order_id) |
Cancel a PENDING order |
Persistence
| Repository | Description |
|---|---|
MemoryOrderRepository |
In-memory (Milestone 1, default) |
PostgresOrderRepository |
Database-backed (Milestone 2, injectable) |
Event Flow
Signal → OMS (cache)
RiskDecision(approved) → OMS → Order created → published
RiskDecision(rejected) → OMS → AuditEvent(ORDER_REJECTED)
Execution → OMS → Order status updated
Source
src/components/order_management_system.py