DEV Community

Cover image for Creating a Market Simulator at Work
Seth T.T
Seth T.T

Posted on • Updated on

Creating a Market Simulator at Work

Cover image: Koondaiira on DeviantArt

Our team optimized and rebuilt a simulator for the futures and options (F&O) exchange.


What?

The F&O exchange is a massive software product with many moving parts. Cloud computers run multiple copies of the exchange simultaneously: some make up the real exchange that customers use, but most are just simulations. Software engineers often use simulations to verify their work and try new things.

Computers run code to simulate a program.

Simulations are VERY useful for lots of reasons. We'll explore one in particular.

Quality Assurance

All customers hate buying shitty software, so it's mission-critical to fix every bug before selling your app or service. But the futures&options exchange is massive, and we're updating it all the time! How do you manage to catch all the bugs in such a big piece of software?

Automated testing is the answer.

A series of testing suites validates market behavior using simulations.

The F&O exchange is rigorously vetted by automated testing suites. Each suite is powered by its own simulation, like in the picture. Suites interact with the simulation and watch its behavior for defects. This process automatically catches bugs, and it works quite well.

My role was to build a testing suite that behaves like a trader. The pretend-trader reads English descriptions of expected market behavior, then it trades on the simulated F&O exchange to ensure it's behaving as described.

Simulations for Sale

The process of creating simulations has been automated for quite some time, since so many of them are needed for automated testing. This production process is very intricate and brittle.

Here is the visualized production line for mass-producing F&O simulations:

A long and convoluted process to creating one simulation for the F&O exchange

These simulations are bulky and expensive since producing one is complicated. Developers spend a very long time reading deployment strategies, just trying to understand how simulations are made. Part of our team's work is to de-clutter the process of deploying a simulation. That way, (a) simulations are cheaper to produce, and (b) it's easier for devs to understand them.

What's Next

I have hopes, goals, and aspirations for the project, but it's technically company property so I don't want to accidentally get in trouble. With that being said, a one-click deployment process would be sick. Just push a single button, and bam! - you have a live, running F&O exchange allllllll to yourself. Kinda like a poke-ball for the F&O exchange.

Find me on github

Top comments (0)