Implementing the decorator pattern for trading infrastructure
This is an easy coding problem that asks you to implement the decorator design pattern—a structural pattern that lets you attach new behavior to an object dynamically by wrapping it. In quantitative trading systems, decorators are widely used to layer cross-cutting concerns (logging, metrics, rate limiting) onto core functionality without modifying the original implementation.
Your task focuses on a practical scenario: wrapping an order-execution interface to measure latency. You'll need to compose an existing ExecutionVenue inside a new wrapper class, forward method calls correctly, and use standard timing utilities to record elapsed time. The solution rewards clean separation of concerns and proper use of C++ or Python language features for delegation and timing.
- Composition over inheritance
- Virtual method delegation and polymorphism
- Timing and duration measurement
- Managing lifetime of wrapped objects