engineswap/orderbook — reverse-engineered prompt
Reverse engineered prompt
Build me a simple C++ program that behaves like a tiny trading exchange order book. I want to be able to enter buy and sell orders from the terminal, including both market orders and limit orders, and have them matched in first in first out order at each price level. It should handle full fills and partial fills correctly, update the book after every trade, and show a clear visual view of the current bids and asks in the console so I can see what happened.
Please make the main flow easy to try by running it from the command line, and include a small set of unit tests to prove the matching logic works. If there is already benchmarking support, keep that too so it is obvious the matching is fast. I would also like a basic demo experience, something like placing a few orders and seeing fills print out in a readable way. You can look up current docs online if you need to.
Want more depth? Deep Reverse