/ Tools · 2022

Stock Trading Simulator

C++ multi‑stock exchange simulator with order matching, median pricing, and profit maximization.

Stock Trading Simulator

Overview

A sophisticated stock market simulator implementing realistic order matching logic, median price tracking, and algorithmic profit maximization strategies. Uses advanced data structures including priority queues for order books, hash maps for fast lookups, and balanced BSTs for median calculation.

Key Features

  • Realistic order book with bid/ask matching
  • Real-time median price tracking
  • Profit maximization algorithms
  • Support for limit and market orders
  • Multi-stock portfolio management
  • Transaction history and analytics

Technical Challenges

Maintaining O(log n) median updates on large datasets, ensuring fair order matching, and optimizing data structure selection for various operations.

Outcome

Simulator handles 1M+ orders with sub-millisecond latency per operation. Algorithmic trading strategy achieved 23% returns in backtesting.

Technologies

  • C++
  • Algorithms
  • Priority Queues
  • Hash Maps
  • BST