Idempotent Trade Booking Endpoint That Survives Client Retries

Last updated: November 29, 2026

Quick Overview

Design and implement a POST trade booking API so that a client retrying after a timeout never books the same trade twice, and a reused key with a different payload is rejected.

Point72
Software Engineering Fundamentals
Software Engineer
Point72
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Design and implement a POST trade booking API so that a client retrying after a timeout never books the same trade twice, and a reused key with a different payload is rejected.

Order management and booking services at Point72 sit between execution systems and the books of record, and network timeouts are routine. A duplicated trade means wrong positions, wrong risk, and a reconciliation break. The interviewer checks API contract design, transactional thinking, and whether the dedupe record and the trade are committed atomically.

What the Interviewer Expects
  • Use a client-supplied idempotency key and define the replay response
  • Store the key, a hash of the request, and the result in the same transaction as the trade
  • Return the original result on a replay and a conflict when the payload differs
  • Explain the race between two concurrent retries and how the transaction or unique constraint resolves it
  • Discuss key retention, expiry, and status codes
Key Topics to Cover
idempotency keys
database transactions
unique constraints
retry semantics
API design
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • What if the request is still in progress when the retry arrives?
  • How long do you keep idempotency keys, and what breaks if you expire them too early?
  • How does this change if the trade must also be published to Kafka for downstream risk?
  • Why not dedupe on (book, symbol, qty, price) instead of a key?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

POST /trades with header Idempotency-Key and body {book, symbol, qty, price}. First call books and returns 201 with a trade id. Any retry with the same key and body returns 200 and the same trade ...

High-Level Design

Deduplicating on trade fields is wrong because a PM can legitimately buy 500 NVDA at the same price twice. The client generates a UUID per logical trade and resends it on retry. The server stores (key...


Submit Your Answer
Markdown supported