DXtrade XT Equities Futures Options Retail Broker About the Client Business Challenge Solution Results About the Client The client is one of the fastest-growing Indian brokers with about 11 million registered users as of July 2023. The broker’s platform allows users to trade Indian stocks, IPOs, mutual funds, derivatives, exchange-traded funds (ETFs), digital gold, currencies, commodities, futures, and options. The client’s mission is to simplify trading and investing in India. Business Challenge The client was preparing for the multiplication of their platform’s users as a result of carefully conducted marketing campaigns and curated partnerships with several Indian cricket organizations. To facilitate user growth, the client needed horizontally scalable order and risk management systems that could handle 20 million users and 35 million orders daily. Horizontal scaling also needed to be elastic. This means that OMS/RMS instances should be able to quickly create/kill OMS/RMS instances on demand. The need for elasticity is explained by an uneven distribution of trading activity across trading hours when around 40% of all trades occur in the first and last 30 minutes of a trading session. If a system has a fixed number of processing nodes tailored to an average workload, most likely, it’ll be impacted in the most critical minutes: at the very beginning and the very end of the busiest business days. If the number of nodes is chosen to handle the peak performance, most of the time, these infrastructure functions are not fully needed but the client would still have to pay quite a bit for unused cloud resources. Elastic scale-out can help the client save up to 40% on cloud costs. With that in mind, the client had started negotiations with a software vendor that developed order and risk management systems for their existing platform. However, the vendor didn’t believe the current system could handle such explosive growth: the client’s hardware was reaching its limits, and the results of the latest stress tests didn’t look too promising. The client decided to look for a new software provider, and their choice fell on Devexperts. The broker’s leadership had previously worked with Devexperts and remained pleased with the quality of software development, as well as the depth of its expertise in the capital markets domain. Solution The main goal of the project was to develop an OMS that: Supports three major Indian exchanges: National Stock Exchange (NSE), Bombay Stock Exchange (BSE), and Mumbai Commodity Exchange (MCE). Scales according to the client’s needs: Devexperts’ OMS must be able to roll out a new instance on demand to take over the excessive load. Handles the beginning of the day (BoD) reconciliation without considerable downtime: users should be able to log into their accounts with minimal delay, essentially it means 24/7 access for clients to log in and view their portfolio and orders. Handles target load: the target amount of accounts is 25M, orders—35M daily. Figure 1. System design These targets for the OMS are tall tasks on their own, so it was highly improbable to develop a new solution from scratch within tight deadlines. That’s why Devexperts decided to reuse its existing products: the DXtrade platform with OMS and RMS engines. The team created a synchronous fork of the main DXtrade repository to retain the ability to quickly get product updates on one hand and to be able to customize it quickly according to the current client’s needs on the other hand. With that process established, it took literally a few hours for the project team to get major product updates (~1k commits a month) without any conflict resolution problems. The first stage of the project’s custom work was the development of the infrastructure and direct connections to three Indian exchanges. The entire scope of the first stage included: Building connectors to three Indian exchanges: National Stock Exchange (NSE), Bombay Stock Exchange (BSE), and Mumbai Commodity Exchange (MCE). Each of them uses its own proprietary binary protocol Implementing a Binary TCP protocol with ZIP compression for CM/FO segments Connecting an exchange gateway to multiple exchange lines Making the exchange gateway support trading connections between multiple OMS instances. Figure 2. The OMS and database sharding The next stage involved setting up integrations and processes, and order and risk management: NSE SPAN margining Metrics calculation Risk monitor BoD reconciliation NSE-specific additional order types/fields Position conversion Figure 3. Trading workflow The Devexperts team needed to: Build an event-driven system. The exchanges don’t guarantee the delivery and sequence of the messages, so the system should manage it itself. Integrate the client’s brokerage solution with the DXtrade platform. To minimize time to market and increase cost-efficiency, Devexperts took the existing brokerage solution and adjusted it according to the client’s requirements. It facilitated quick delivery and smooth management of the infrastructure over the code. Figure 4. High-level design and deployment diagram “Creating a stable and scalable system capable of handling over 35 million orders per day was no small feat. Our role was to design and develop a complex solution tailored specifically to the client’s needs. The challenge was to build an infrastructure that could seamlessly process such a massive volume of orders while maintaining the utmost reliability. Through meticulous planning, innovative thinking, and a deep understanding of the broker’s requirements, we crafted a solution that not only met their immediate needs but also laid a strong foundation for future growth. Leveraging cutting-edge technologies and robust architecture, we developed a system that not only handled the immense load but also ensured minimal downtime and maximum performance.” — Mikhail, Devexperts solution architect Results Within a few months, in close collaboration with the client, the Devexperts team made the client’s solution scalable and flexible to handle explosive growth. “We appreciate your commitment to providing a solution that efficiently handles our order volume. The Devexperts team’s expertise, advanced technologies, and strong architecture have revolutionized our operations and set industry standards. On behalf of the company, I express my sincere gratitude to the solution architect and the entire team for their outstanding work and unwavering commitment.” — Program Manager, the client