Project Description for Stocks

Get a brief introduction to "Stocks" and learn which features we'll be building in this project.

We'll cover the following


Stocks represent companies and individuals’ claims of the shares of public companies. These shares’ prices vary depending on various factors, including inflation, demand, and reputation. There are a lot of trading firms, which deal in the buying and selling of these stocks. These firms are always on the lookout for new traders to join their company.

The scenario and the problems discussed in this chapter also relate to the onboarding process and how we can improve it.


Assume you are a developer in a stock trading company, and you’re working on their online trading platform. The company wants you to add functionalities to their onboarding feature for new hires.

The company has noticed that a lot of rookies mess up the buying and selling prices while making stock trades. Therefore, we need a validator in place to inform them of their probable mistakes. After a trade is made, we need to make sure the settling period is over before someone tries to make another trade. We also want to know whether everyone completed their assigned trading goals for the day or not. The rookies can make as many trades as they want but their daily minimum goals should be met. We also need to obtain the day and week these brokers reached specific trading milestones. All this data will eventually help us in decide their promotions at the time of performance evaluation.


We will need to introduce the following features to implement the functionalities we discussed above:

  • Feature #1: Validate the price for buying and selling stocks according to the defined company’s criteria.

  • Feature #2: Stock of the same company should not be traded again until the settling period is over.

  • Feature #3: Store the trades for every rookie and evaluate whether everyone met their minimum criteria or not.

  • Feature #4: Determine the day and week when a broker reached specific trading milestones.

  • Feature #5: Determine the top brokers based on their frequency of trades.

  • Feature #6: A total of N stock transactions need to be carried out by K brokers. We need to assign transactions to each broker that need to be carried out in the same order in which they arrived.

  • Feature #7: In a stock trading company, several transactions are performed every day. All these transactions are recorded in a log file. Process one line of the log file and return the integer at the beginning of the line.

  • Feature #8: Price predictions of a stock over a future time window are given. We are interested in making profit by selling stock at a higher price. Find the minimum number of intervals, after an ith interval, when the price will become higher.

Understanding these feature requests and designing their solutions will help us implement the requested functionality into the trading platform.

In the next few lessons, we’ll discuss the recommended implementations of these features. The solutions to these problems will also be applicable to other common coding interview questions.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.