Design an order book for a trading exchange. Implement an OrderBook class that:
Write methods:
add_order(order_type, price, quantity): add a buy/sell ordercancel_order(order_id): remove an open orderget_best_bid() / get_best_ask(): return current market pricesUse a max-heap for buy orders (sorted by price descending) and a min-heap for sell orders (sorted by price ascending).
When a new order arrives, iterate through the opposite side's orders and match at their prices.
No results yet
Run your code to check it against the examples, or submit to run every test.