Skip to content

Charles30-ux/MarketSimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Fidelity Market Microstructure Simulator (C++)

Executive Summary

This project is a high-performance Limit Order Book (LOB) and Matching Engine developed to bridge the gap between financial regulation theory and computational execution. It is designed to simulate how different regulatory mandates (from ANTIC in Cameroon or the FCA in the UK) impact market liquidity and price discovery.

Research Context (DPhil Focus)

As markets move toward AI-driven execution and "Sovereign Cloud" infrastructures, the "physics" of the matching engine becomes a legal battleground. This simulator allows for:

  • Latency Stress-Testing: Simulating the impact of 1ms–10ms network delays on market fairness.
  • Algorithmic Regulation: Testing "Order-to-Trade" ratios and minimum resting time mandates as code.
  • Price-Time Priority Analysis: Observing how the "Spread" behaves under different liquidity conditions.

Technical Architecture

  • Language: C++17 (Optimized for low-latency execution).
  • Data Structures: std::map with custom comparators for $O(\log n)$ price-level access, std::list for $O(1)$ order insertion/deletion to maintain strict time priority.
  • Build System: CMake + MinGW/GCC.

Features

  • Limit Order Book: Separate Bid/Ask trees with deterministic sorting.
  • Matching Engine: Automatic execution when Buy Price $\geq$ Sell Price.
  • Live Market Feed: Real-time calculation of "Best Bid," "Best Ask," and "Market Spread."
  • Regulatory Gateway: (In Development) Logic to block "spoofing" or high-frequency cancellations.

Build Instructions

To build and run the simulator on Windows (MinGW):

  1. mkdir build && cd build
  2. cmake -G "MinGW Makefiles" ..
  3. cmake --build .
  4. .\MarketSimulator.exe

About

High-fidelity Limit Order Book (LOB) and Matching Engine in C++ for simulating market microstructure and testing regulatory frameworks (UK/OHADA).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors