Implement Order Modification Feature
Hudson River TradingSoftware Engineer · OnsiteLast updated
This question evaluates a software engineering competency in modifying and extending a C++ client/server trading system, focusing on state management, input validation, API integration, and maintaining invariants for order lifecycle.
You are given an existing C++ trading system with a client/server architecture. The current system already supports two request types:
AddOrder(order_id, symbol, side, price, quantity)CancelOrder(order_id)
The server keeps all active orders in memory, keyed by order_id.
Add support for a new request:
ModifyOrder(order_id, new_price, new_quantity)
Requirements:
- If the order does not exist or has already been canceled, the modification must be rejected.
symbolandsidecannot be changed by a modify request.- A successful modification updates only
priceandquantityfor the existing order. new_priceandnew_quantitymust both be positive; otherwise reject the request.- The order must remain associated with the same
order_idafter modification. - Integrate the new request into the existing client/server flow in the same style as the existing add/cancel functionality.
Implement the feature and explain what parts of the codebase you would inspect or reuse before making changes.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.