Process a stream of trades and price updates and, on request, report the trade on an instrument with the largest loss per lot.
Unlock detailed company stats for this questionUpgrade
Process a stream of N instructions: TRADE (tradeId, instrument, buy/sell, price, volume), PRICE (instrument, new fair value) and WORST_TRADE (instrument). For a WORST_TRADE query output the id of the trade on that instrument with the largest loss per lot, valuing each trade against the latest price update; break ties by the most recent trade and print NO BAD TRADES if no trade is losing. Implement a class with ProcessTrade, ProcessPriceUpdate and OutputWorstTrade; N and the ids/prices/volumes go up to 10^6.
Community answers
No answers contributed by the community yet.
Related courses

Course
