Detecting missing security-definition data in a trading system
This is a medium-difficulty coding problem that tests your ability to reconstruct a timeline from sparse, real-world trading data and validate it for consistency. It mirrors a common operational challenge at quantitative trading firms: reconciling external (exchange) identifiers with internal instrument identifiers when ingest pipelines fail silently.
The core task is to infer which calendar days are missing SecurityDefinition records for each critical instrument by examining the trades that were actually executed. You'll need to handle several data-quality issues: duplicate trade IDs, inconsistent security IDs within a single day, and out-of-order timestamps. Each validation failure should flip a flag rather than throw an exception, since invalid data affects only that instrument.
- Grouping and aggregating sparse event logs by identifier
- Inferring gaps in a timeline from observed events
- Multi-criterion data validation with partial failure modes
- Distinguishing between data quality issues (invalid flag) and missing coverage (streak length)
Solutions typically sort trades by timestamp, group by instrument ID, validate each group for the three error conditions, then iterate through the date range to count missing days and longest consecutive streak. Both C++ and Python are suitable; the challenge lies in clean handling of edge cases and efficient date arithmetic rather than language-specific tricks.