Overview
Simulates order execution without live broker connectivity. Implements the Broker/Execution Adapter Interface for the prototype.
Navigation
Architecture
- contains SimulatedBrokerAdapter Design
Contracts
- contains Broker Execution Adapter Interface Interface
Documents
Execution Simulator
Responsibilities
Simulates order execution for paper trading (Milestone 1). Replaces a live broker adapter.
- Subscribes to Order events
- Simulates fill at the last known market price (from most recent MarketTick)
- Publishes Execution events with fill price, quantity, and timestamp
- Subscribes to MarketTick to track current prices per symbol
IBrokerAdapter Protocol
The Execution Simulator implements the IBrokerAdapter interface, making it swappable with a live broker adapter in future milestones.
class IBrokerAdapter(Protocol):
def submit_order(self, order: Order) -> Execution: ...
Event Flow
MarketTick → ExecutionSimulator (price cache)
Order → ExecutionSimulator → Execution (published at last price)
Design Notes
- Paper trading only — no real money or broker connectivity
- Fill price = last MarketTick price for the symbol
- Immediate fill assumed (no partial fills, no slippage model in Milestone 1)
Source
src/components/execution_simulator.py