-
Notifications
You must be signed in to change notification settings - Fork 12
Execution Service
tien.nguyen edited this page Jul 30, 2026
·
1 revision
The Execution Service is the automated order routing and algorithmic execution engine of the Emporia Trading Platform. It consumes immutable order domain events, evaluates routing strategies (DMA, SMART, VWAP), decomposes parent orders into child slices, and interfaces with market execution venues (including exchange matching engines and FIX gateways).
-
Directory:
execution-service -
HTTP Port:
8087 -
Database Boundary: Stateless (Stores checkpoint snapshots in
ExchangeCoreCheckpointStoreand recovers active strategy state dynamically). -
Primary Roles:
- Algorithmic order routing (
DMA,SMART,VWAP). - Best execution under National Best Bid and Offer (NBBO) rules via
BestVenueSelector.java. - Intraday VWAP volume-weighted time-slicing via
VwapSchedule.java. - Execution venue gateway integration (
ExchangeCoreExecutionVenueGateway,FixExecutionVenueGateway). - Publishing execution commands (
FILL,REJECT,CANCEL) toemporia.execution.commands.v1.
- Algorithmic order routing (
flowchart TD
subgraph InboundEvents ["Order Domain Input"]
K1[["Kafka: emporia.orders.v1"]] -->|OrderDomainEvent| EEC["ExecutionEventConsumer"]
end
subgraph StrategyRouter ["Routing & Strategy Engine"]
EEC --> SelectDestination{"Order Destination?"}
SelectDestination -->|DMA| GatewayRouter["ExecutionVenueGateway"]
SelectDestination -->|SMART| SmartEngine["BestVenueSelector (SOR)"]
SelectDestination -->|VWAP| VwapEngine["VwapSchedule Algorithmic Slicer"]
end
subgraph Venues ["Execution Venues"]
GatewayRouter --> ExchangeCore["ExchangeCoreExecutionVenueGateway (Disruptor RingBuffer)"]
GatewayRouter --> FixGateway["FixExecutionVenueGateway (FIX 4.2/4.4 Protocol)"]
GatewayRouter --> SimGateway["SimulatedExecutionVenueGateway"]
end
subgraph AlgorithmicSlices ["Parent-Child Algorithmic Orders"]
SmartEngine -->|Publish Child Slice| K2[["Kafka: emporia.order.commands.v1"]]
VwapEngine -->|Publish Scheduled Slice| K2
end
subgraph OutboundExecutions ["Execution Outcome Stream"]
ExchangeCore -->|Publish ExecutionCommand| K3[["Kafka: emporia.execution.commands.v1"]]
FixGateway -->|Publish ExecutionCommand| K3
SimGateway -->|Publish ExecutionCommand| K3
end
- Mechanics: Bypasses algorithmic slicing and routes the order directly to the designated venue gateway.
-
Venue Gateways:
-
ExchangeCoreExecutionVenueGateway: Ultra-low latency interface to in-memory LMAX Disruptor matching engine (exchange-core). -
FixExecutionVenueGateway: Institutional FIX protocol (FIX 4.2/4.4) gateway. -
SimulatedExecutionVenueGateway: In-memory venue simulator for testing.
-
-
Engine:
BestVenueSelector.java -
Mechanics:
- Evaluates real-time Level-1 quotes across all listings for the instrument.
- Applies NBBO Best Execution rules: routes BUY orders to the lowest Ask price and SELL orders to the highest Bid price.
- If a single venue does not have sufficient depth, it splits the parent order into multiple child slice orders and produces them back to
emporia.order.commands.v1.
-
Engine:
VwapSchedule.java -
Mechanics:
- Decomposes large parent orders into historical volume-weighted time buckets (
buckets,durationMinutes,participationRate). - Uses
TaskSchedulerto periodically release child orders intoemporia.order.commands.v1across the specified trading window.
- Decomposes large parent orders into historical volume-weighted time buckets (
On application startup (ApplicationReadyEvent), ExecutionEventConsumer.recover() runs automatically:
- Calls
TradingDataClientto fetch all un-cleared direct orders and active strategy states fromorder-management-service. - Resubmits direct orders to venue gateways.
- Reschedules active SMART and VWAP strategy runtimes seamlessly without dropping active child order slices across service restarts.
- Trading Terminology Glossary
- Order Lifecycle & Validation
- Order Routing & SOR
- Market Data & Pricing
- Portfolio & Risk Management
- Architecture & Order Flow
- Static Data Service
- Market Data Service
- Order Command Service
- Order Management Service (OMS)
- Execution Service
- Portfolio Service
- Design Patterns
- Microservices Overview
- Exchange-Core Integration
- Testing & Verification
- Deployment & Operations
- Repository: emporia
- Tech Stack: Java 21 | Spring Boot 4.0.7 | React 19 | Kafka | gRPC
- Coverage: 91.95% JaCoCo