Data Model: Order Management and Matcher
Scopeβ
This state defines data model impact relative to 007-pricing-awareness-market-data.
Entity Changesβ
- Added:
Orderentity persisted in shared runtime database (OrderBooktable).orderId(string/uuid, primary key)accountId(int)security(string ticker)side(Buy/Sell)quantity(int)remainingQuantity(int)limitPrice(decimal(18,3))status(NEW|PARTIALLY_FILLED|FILLED|CANCELED|REJECTED)createdAt(timestamp)updatedAt(timestamp)lastExecutionPrice(decimal(18,3), nullable)lastFillQuantity(int, nullable)
- Added: in-memory matcher telemetry counters (exported via
/metrics) for lifecycle and auto-fill behavior. - Changed: none in existing trade/position schema required by this state (fills remain integrated through current trade/position flow).
- Removed: none.
Compatibility Notesβ
- Backward compatibility requirements should be reflected in:
requirements/functional-delta.mdrequirements/nonfunctional-delta.mdcontracts/contract-delta.md
- Open order count semantics:
openmeans status inNEW|PARTIALLY_FILLED.unfilledmeans order hasremainingQuantity > 0.- These semantics drive required metrics and dashboard interpretation.
- Auto-fill policy semantics:
Buyorder is in-the-money whenmarketPrice <= limitPrice.Sellorder is in-the-money whenmarketPrice >= limitPrice.- remaining
< 1000: full fill, otherwise half fill (rounded up), on each matcher tick.
Traceabilityβ
- Data shape links to FR-01301..FR-01304 and NFR-01302..NFR-01304 in
spec.md.