Behind the Screens: Crafting the Northwestern Trading Competition from Scratch

When I set out to build the Northwestern Trading Competition, the primary goal was clear: combine the rigor of algorithmic trading with advanced software tools. Let's break down the key components that make this competition run smoothly.

1. The Exchange: The Digital Marketplace

At the center of our trading competition is the exchange, a sophisticated automated marketplace that seamlessly manages the flurry of trade orders. The backbone of this system is a custom-designed matching engine. Not just any matching engine, this one was specifically crafted to handle the high-speed order pairing from diverse algorithms, ensuring every order finds its counterpart with pinpoint precision. Efficiency was the name of the game, and every decision made in its development reflected that commitment.

2. The Algorithm Wrapper: Bridging Two Worlds

For algorithms, built using a standardized Python template, to communicate and operate within our primarily C++ environment, the algorithm wrapper was crucial. By leveraging pybind, we achieved a fluid interface where Python functions responded to RabbitMQ messages like native callbacks. Consider functions such as on_order_update and on_trade_matched. Each is designed to react in real-time to market changes, empowering algorithms to dynamically adjust their strategies. Additionally, the place_market_order function represents the algorithm's capability to actively engage with the market, transforming passive observations into tangible trade actions.

3. The Linter: The Quality Gatekeeper

Maintaining a competitive environment also means ensuring the quality and stability of the participating algorithms. That's where the linter comes into play. Each algorithm, upon upload to the web portal, undergoes rigorous scrutiny. Running on Google Cloud Run, the linter acts as our first line of defense against potential code discrepancies or inefficiencies. This not only preserves the integrity of the competition but also ensures a consistent, hiccup-free experience for all participants.

4. The Web Portal: Beyond a Simple Interface

While a competition's technical prowess is crucial, user experience cannot be sidelined. Recognizing this, I designed a web portal using the combined strengths of TypeScript, React, and Next.js. But it's not just about aesthetics or smooth navigation. This portal serves as the primary touchpoint for participants, where they can effortlessly apply, draft profiles, and upload their algorithms. The aim was to make every user's journey, from application to competition, as intuitive as possible.

Highlight: Communication Dynamics

Perhaps one of the most intriguing aspects of this competition is the symbiotic communication between the exchange and the algorithms. Utilizing RabbitMQ and Redis Streams, we've orchestrated a two-tiered communication system. RabbitMQ, with its point-to-point messaging, ensures individualized data reaches its intended recipient. In contrast, Redis Streams functions as a broadcast system, updating all algorithms about pivotal market shifts. This dual approach guarantees that while each algorithm operates on unique strategies and data points, they all share a common understanding of the market's broader landscape.

By establishing a synergy between different technological components, the Northwestern Trading Competition offers participants a platform that's not just about trading but also about innovation and the exploration of fintech's boundaries.

The project is closed-source until the end of the competition, but feel free to reach out if you have any questions or would like to learn more about the project.