Preparing your design workspace

Loading the problem and your saved attempt…

Design a Trade Ticket for Booking Executed Trades

Model what a trade ticket holds, the checks it must pass before booking, and corrections and cancels that keep every earlier version.

For this exercise, assume a trading desk records every stock trade it executes as a trade ticket in an internal booking tool. A ticket says what was traded and with whom: the stock, buy or sell, the number of shares, the price, the desk's internal account, the counterparty, the trade date and the settlement date.

Tickets come from two places: the execution system creates one for each completed trade, carrying that execution's ID, and one execution may never have two tickets that are not cancelled; an operations person can also type one in by hand.

Money is in US dollars with whole cents, each stock ticket carries a commission of half a cent per share, and settlement is one business day after the trade date (weekends and listed exchange holidays are not business days).

Before a ticket is booked it must pass checks: every field is present, the quantity and price are positive, the account and counterparty exist, the settlement date is right, and the price is within 5% of that day's reference price for the stock.

A ticket that fails stays unbooked, with the reasons shown, until someone fixes it. Once booked, a ticket is used by settlement and by the desk's position reports, so it is never edited in place: a correction or a cancellation must keep the earlier version and record who changed what, when and why.

Design the trade ticket and the objects around it: what a ticket holds, how its checks run, how it moves from entered to booked, corrected or cancelled, and how its history is kept.

Confirming trades with the counterparty, the settlement process itself, other currencies and asset classes other than stocks are out of scope; one follow-up adds bonds.