Prepping for the 2027 recruiting cycle? Use code 2027RC for 10% off, valid until July 31st! Oh, and check out our members-only recruitment services.

Logo

Implement decorator

What this preview is

Implement decorator is a easy quant coding problem on design patterns in Cpp / Python.

Difficulty
Easy
Topic
Design Patterns
Discipline
Quant development
Languages
Cpp / Python

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

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.