Company: Unicult_8oct
Difficulty: medium
Node.js: Stock Trades API Problem In the original assessment you implement a REST service (Node.js + Express, SQLite3 through a read-only Sequelize model) that manages a collection of stock trades through the /trades endpoint. This offline version keeps the same endpoint rules, but there is no server: the requests arrive on standard input, one after another, and your function returns the response to each of them. The store starts empty and every request sees the effect of the requests before it. Each trade is a JSON object with these properties: id : unique trade identifier (integer), assigned by the service type : the trade type, either "buy" or "sell" (string) user_id : unique user identifier (integer) symbol : stock symbol (string) shares : number of shares traded, between 10 and 30 inclusive (integer) price : price per share at trade time (integer) timestamp : epoch time of the trade in milliseconds (integer) Example trade object: {"id":1,"type":"buy","user_id":23,"symbol":"ABX","s