Implementing trade ID generation for a futures exchange
This is a medium-difficulty coding problem that tests your ability to parse structured input, perform time arithmetic, manipulate strings, and compose a multi-part output. It mirrors the kind of backend work junior quant developers handle when building trading infrastructure—here, the focus is on correctness across three distinct transformations and careful handling of edge cases.
The problem requires you to extract and combine information from order timestamps, order identifiers, and instrument names into a single trade ID. Each component involves a different type of processing: time-difference calculation, string permutation with a randomness requirement, and character-to-numeric encoding. Pay close attention to input formats (variable-length timestamps) and the precise rules for each segment. Testing your solution thoroughly against boundary conditions—short IDs, single-digit time differences, alphanumeric instruments—is essential.
- Time parsing and arithmetic
- String slicing and random permutation
- Character mapping and encoding
- String composition and formatting