A high-performance, real-time stock price simulator using a multithreaded C++ backend and a modern React frontend.
The backend leverages a thread pool and a producer-consumer model to efficiently generate and broadcast live stock price updates. The frontend consumes this data over WebSockets and displays it in a beautiful, responsive dashboard with interactive charts.
This is the final user interface, featuring a "glassmorphism" design with live-updating charts.
- π High-Performance C++ Backend
- Thread Pool Architecture to efficiently manage hundreds of stock simulations.
- Producer-Consumer Model for clean separation of data generation and broadcasting.
- Thread-safe queue using mutexes & condition variables to guarantee data integrity.
- π¨ Modern Glassmorphism UI
- Instant-loading dummy graphs that seamlessly transition to live data.
- Beautifully styled charts from Recharts with live price-change indicators.
- Fully responsive design built with React and Tailwind CSS.
- β‘ Real-Time Communication
- Low-latency data streaming from backend to frontend using WebSockets.
- C++17
- Multithreading (
std::thread,std::mutex,std::shared_mutex,std::condition_variable) - Thread Pool Design Pattern
- WebSocket++ Library
- React + Vite
- Tailwind CSS for styling
- Recharts for interactive charts
- WebSocket Client (
useReffor stable connection)
ββββββββββββββββββββββββββ
β Scheduling Thread β
β(Submits tasks per stock)β
βββββββββββββ¬βββββββββββββ
β Tasks
βΌ
βββββββββββββ ββββββββββββββββββββββββββ
β Task Queueβ<--β Thread Pool (Workers)β
βββββββββββββ β (Run simulation tasks) β
βββββββββββββ¬βββββββββββββ
β StockEvents
βΌ
ββββββββββββββββββββββββββ
β Event Queue (Thread-Safe)β
βββββββββββββ¬βββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Consumer Threads β
β (Broadcasts via WebSocket)β
βββββββββββββ¬βββββββββββββ
β
βΌ
ββββββββββββββββββββ
β React Frontend β
ββββββββββββββββββββ

