
Stock Market Simulation
Built a multi-threaded stock market simulator with autonomous trading bots, real-time GUI visualization, and configurable market dynamics.
- ▸Concurrent architecture with thread-safe order book and matching engine
- ▸Multiple autonomous trading bot strategies (mean reversion, momentum, market making)
- ▸Real-time GUI with live price charts, order book depth, and portfolio tracking
- ▸Configurable market parameters for studying different market microstructure scenarios
Overview
A multi-threaded stock market simulator in Java — an order-matching engine, autonomous trading bots with different strategies, and a real-time Swing GUI showing everything as it happens. Built to explore concurrent programming patterns while also being a fun way to learn about market microstructure.
What I Built
- Thread-safe order book supporting both limit and market orders
- Price-time priority matching engine
- Autonomous trading bots (mean reversion, momentum, random walk, market making)
- Real-time Swing GUI with candlestick charts and order book depth visualization
- Configurable market parameters for experimenting with different scenarios
Technical Details
The interesting part was the concurrency: multiple trading bots submitting orders to a shared order book simultaneously, each running in its own thread. Getting the synchronization right without killing performance was the main challenge — you need locks to prevent race conditions, but too much locking and the whole thing grinds to a halt.
What I Learned
This was my first real encounter with concurrent programming beyond textbook exercises. Lock ordering to prevent deadlocks, the actual cost of synchronization, and learning to reason about what can go wrong when multiple threads touch shared state — all of that clicked during this project.