I wanted to learn more about how programs can be asynchronous and execute multiple different tasks at once, and I thought C++ was the best way to learn that. Additionally, I am interested in finance and particularly the stock markets so this project served me best.

This project simulates traders placing sell/buy orders and the algorithms that match together these orders. It also simulates volatility in stocks through their prices asynchronously and randomly changing. Lastly, it implements a distributed rate limiter which means that traders are only allowed to place a certain amount of trade requests per minute.

I built this application entirely using C++.

The most prominent challenge I ran into was dealing with the threads and handling race conditions. I had to think critically about where to put mutexes and such so that different threads did not interfere with one another.

This was my first time using threading in any program so I feel as though it is a big milestone.

I learned a lot about the C++ language as a whole and in particular the std::future, std::chrono, and std::thread libraries that primarily allowed me to complete the project. I also learned that solo hacking is super fun and underrated.

What's next for Market Emulator? I want to add more functionality and efficiency to the Market Emulator using more advanced C++ concepts such as curiously recurring template patterns, special pointers and heap allocation, and others.

Built With

Share this project:

Updates