Represent Futures Prices as Integer Ticks Instead of Floats
Last updated: November 29, 2026
Quick Overview
Write a small instrument class that converts decimal price strings into integer tick counts, rejects prices that are not on the tick grid, converts back to strings, and computes exact notional in cents. Explain why trading systems avoid binary floating point for prices.
DRW
November 29, 20260
0
0 solved
Write a small instrument class that converts decimal price strings into integer tick counts, rejects prices that are not on the tick grid, converts back to strings, and computes exact notional in cents. Explain why trading systems avoid binary floating point for prices.
Correct price representation is a basic but critical skill in DRW's trading infrastructure, where one rounding error can create a wrong order price or a P&L break. The interviewer checks that you understand binary floating point limits and can design a clean, exact representation.
What the Interviewer Expects
- Explains why 0.1 cannot be represented exactly in binary floating point
- Stores prices as integer ticks with a per instrument tick size
- Parses from strings via Decimal, never via float
- Rejects off tick prices explicitly
- Keeps notional in integer minor units
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you handle instruments whose tick size changes with price level?
- What about negative prices, as in crude oil in April 2020?
- How do you represent prices in a binary wire protocol to keep it compact?
- When is floating point acceptable, for example in a pricing model?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Each instrument has a tick size (0.25 index points for ES) and a contract multiplier (50 dollars per point). We need string to ticks with validation, ticks to string, and exact notional. No floats any...
High-Level Design
Prices live as Python ints (in C++ an int64_t) counting ticks. Integers are exact, compare cheaply, hash consistently, and index arrays directly, which an order book loves. Conversion uses Decimal...