YoE: 7
Position: SSE in a fintech
Date: November, 2024
Round 1 (LLD / Design)
Design a stock liquidation system. The system will accept userId/holdings detail from a client and process these holdings for liquidation. The actual liquidation criteria might be queried from a third party service which is abstract to our system.
Expectation was to come up with relevant API contracts, DB schemas, handling concurrency.
Round 2 (Machine Coding)
Build a Stock Exchange. Stock exchange takes in Buy and Sell orders and tries to match them based on their prices.
What is an order?
- a order is a request to Buy or Sell a stock at a given price.
What is a trade?
- a trade happens when a Buy order matches a Sell order.
When will a Buy order trade?
- when there is a Sell order in the market with Sell price ≤ Buy price
When will a Sell order trade?
- when there is a Buy order in the market with Buy price ≥ Sell price
(both these conditions are basically the same)
Sequence of events
- exchange receives order,
- checks if a trade is possible for the incoming order
- if yes, remove both orders from exchange, and notify
- else, retain the incoming order in the exchange (to possibly trade later)
In case multiple orders match with the incoming order, order with the better price gets the trade
(Buy order with higher price gets preference, Sell order with lower price gets preference)
When does the user get notified?
- when an order is placed (notify the user)
- when a trade happens (notify both parties)
Notes:
- trade price will be determined by the Buy/Sell order which is already present in the market rather than the incoming order.
- for the sake of simplicity, each order will be of 1 qty.
- there can be many stocks that can be traded.Round 3 (Design)
Design an API hit counter system for our application. There are multiple core APIs in our system which are hit by different customers. The 'Hit counter system' should track and populate an aggregated count for the number of hits received for each API from each customer. These counts will be used for billing the customer on weekly/monthly basis.
The system should also restrict the number of hits being made by any client per API for a unit time period.
Round 4 (HM)
Standard techno-managerial round with focus on past work experiences.
Round 5 (HR / Culture fit)
Standard behavioural.
Thoughts: Although rejected, enjoyed the process! Overall feedback was tending towards -ve as they were expecting more depth on design rounds.