← AkunaCapital Interview Insights
This one took me a while to even mentally decompose.
Start by clarifying the requirements and constraints, then outline the class design with clear separation of concerns: pricing logic, order state management, and exchange interaction. Emphasize the state machine for per-side order lifecycle and the validation rules (min offset, tick alignment, BBO crossing). Finally, discuss trade-offs and potential edge cases.
Pro tip: Demonstrate awareness of real-world exchange behavior: orders can be rejected or partially filled, so the state machine must handle asynchronous confirmations and failures gracefully. Also, mention that tick alignment and offset checks should be applied in the correct order to avoid unnecessary rejections.
Ask questions to understand the exact meaning of 'minimum offset', 'theoretical price', 'tick size', and 'BBO'. Confirm whether the class is responsible for sending orders or just managing state, and how it receives market data updates.
Define public methods (e.g., updateTheoreticalPrice, updateBBO, placeBid, placeOffer, onOrderConfirmed, onOrderRemoved) and internal state per side (e.g., enum: Idle, PendingNew, Active, PendingRemove). Ensure no new order is sent until removal is confirmed.
For a desired price, first apply the minimum offset from the theoretical price (e.g., bid <= theo - offset, offer >= theo + offset), then align to the nearest tick (round bid down, offer up). Finally, check against BBO to avoid crossing (bid < bestOffer, offer > bestBid).
Implement callbacks for order confirmations, rejections, and removals. On removal confirmation, transition the side to Idle and allow new orders. Handle errors by logging and possibly retrying or alerting.
Talk about trade-offs: e.g., aggressive vs. passive quoting, handling of stale theoretical prices, and race conditions. Mention edge cases like tick size changes, BBO updates while order pending, and partial fills.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.