Loading repository data…
Loading repository data…
parth-9876 / repository
Built a C++17 exchange simulator with microsecond-precision order matching, segment tree range queries, and graph-based market analysis. Designed a REST API layer in Python and a responsive web dashboard for real-time order management and analytics visualization.
Market-Exchange-Engine is a high-performance exchange simulator and market analytics engine. It features a blazing-fast C++17 core for order matching and data crunching, paired with a sleek, modern, web-based fintech dashboard built in Python and Vanilla HTML/CSS/JS.
This project was built from scratch to showcase clean architecture, optimal time complexities, robust edge-case handling, and a premium user experience.
Market-Exchange-Engine features a beautiful, responsive web interface that communicates with the native C++ engine via a lightweight Python bridge.
AlgoExchange.exe is in the executable/ directory.python server.py
http://localhost:8000.AlgoExchange is divided into several independent modules, each leveraging specific data structures to achieve optimal performance:
The core exchange matches limit and market orders using Price-Time Priority.
std::unordered_map coupled with std::set and custom comparators.Rapid symbol lookup (e.g., typing "GO" returns "GOOG" and "GOOGL").
Fast range queries over historical price data (MAX, MIN, SUM, AVG, VOLUME).
Real-time tracking of Top Gainers, Top Losers, Highest Volume, and Most Active stocks.
std::priority_queue).Tracks supplier and correlation dependencies between tickers to find shortest paths.
Finds the cheapest way to break down a massive block order (e.g. 10,000 shares) into standard lot sizes, balancing fixed trade fees vs. quadratic market impact costs.
If you prefer the command line, you can run the engine directly without the web dashboard.
executable/ folder.AlgoExchange.exe.cd executable
.\AlgoExchange.exe
Note: The executable/ folder already includes the necessary data/ files (like stocks.txt, prices.txt, etc.) for the engine to run out of the box.
If you prefer to compile the engine yourself, the project uses CMake and is designed to build on Windows with MSVC.
Open a Developer PowerShell for VS and run:
# 1. Create a build directory
mkdir build
cd build
# 2. Generate build files
cmake ..
# 3. Compile in Release mode
cmake --build . --config Release
# 4. Run the newly compiled executable
cd ..
.\build\Release\AlgoExchange.exe
If using the engine via the command line (or the Web Dashboard's Terminal), try these commands:
Order Management
BUY AAPL 100 190.00 # Place limit buy
SELL AAPL 50 189.50 # Place limit sell
MARKET BUY TSLA 50 # Place market buy
CANCEL 1 # Cancel order by ID
MODIFY 2 BUY 100 200.00 # Modify an existing order
Market Views
SHOW_ORDERBOOK AAPL # View the orderbook for AAPL
SHOW_TRADES # View trade history log
SEARCH_SYMBOL MS # Find stocks starting with 'MS'
Analytics & Testing
MARKET_SUMMARY # View total volume, gainers, losers
PRICE_HISTORY MSFT # See historical prices
RANGE_QUERY MSFT MAX 0 5 # Query max price in a specific timeframe
DEPENDENCY_PATH AAPL NVDA # Find supplier/correlation path
OPTIMIZE_ORDER BUY AAPL 5000 # DP calculation for order splitting
STRESS_TEST 10000 # Run native C++ in-memory speed test
General
HELP # Show available commands
EXIT # Close the program
DROP_EXIT # Wipe generated stress test logs and close
The engine is resilient against invalid inputs, handles extreme edge cases (like market orders crossing market orders), and avoids floating-point exceptions.
To run the automated test suite natively, pipe the provided test file into the executable. Using the pre-compiled version:
Get-Content executable\test_comprehensive.txt | .\executable\AlgoExchange.exe
(If you built from source, use Get-Content data\test_comprehensive.txt | .\build\Release\AlgoExchange.exe)