Image for post
Image for post

Overview

With the transformation of the financial services market, the demand for core technology for conducting financial transactions has grown. The financial transaction model has changed from traditional manual bidding to matchmaking orders through an electronic transaction system. This article aims to give a detailed background on the changing financial transaction, and the matchmaking technology that is driving these changes.

Background: The Evolving Financial Transactions

The traditional financial transactions mainly occur in the tangible financial market. The contracting parties of financial transactions reach an agreement through bidding, price negotiation, and other methods. Meanwhile, the transaction is complete upon making a physical delivery at the designated point as stipulated in the trade order.

Financial Transactions: Overall System Design

Hierarchical Design

The financial transaction matchmaking system includes the following core modules:
●User: the end user is entrusted with providing the quotation and quantity, with the next being order generation, and sending the order to the transaction platform.
●Gateway: collects and distributes the user’s order to the matchmaking engine.
●Matchmaking engine: it is the core of the transaction system. It receives and fulfills the order by following the business logic, matches and generates the transaction record, and feeds the transaction results back to the user.
●Database: used to save order and transaction data in the transaction process, and realize data persistence.

Hierarchical Design 1: Matchmaking Transaction Algorithm

As shown in Figure 1, the core business module of a matchmaking engine is the matchmaking transaction algorithm. Its goal is to execute the matchmaking function for the customer’s order, and to ensure fairness, high efficiency and expandability of the algorithm. Since the matchmaking business varies for different financial transaction systems, this section outlines the commonly used algorithms.

Image for post
Image for post

Hierarchical Design 2: Order Queue

An important part of transaction matchmaking is the sale or purchase of orders. Creation of transaction records occurs by matching the selling and buying orders. Therefore, if the orders are not matched immediately, the system should save the data in a buying queue and a selling queue. The queue shall adhere to the principle of “price first,” and “time first” in the case of the same price. The buying queue arrangement follows the sequence from low to high according to the entrusted prices, and the selling queue arrangement follows the sequence from low to high according to the assigned prices as shown in the figure below.

Image for post
Image for post

Matchmaking Sequence

When receiving a new buying order, the matchmaking engine will search from the beginning of the selling queue to confirm if any selling orders comply with the price discipline. All orders with a selling price lower or equal to the buying price are extracted from the queue and matched into a transaction. If the selling queue is empty or the queue head fails to meet the price relationship, the system inserts the buying order into the buying queue. It will then arrange and sort the newly inserted order in the buying queue.

Image for post
Image for post

Hierarchical Design 3: Memory Matchmaking

The poor performance of the database matchmaking technology is due to excessive interactions with the database, which leads to high I/O transactions. Meanwhile, the database transaction logic seems to restrict the overall processing speed of the system.

Image for post
Image for post

Hierarchical Design 4: Multi-Machine Hot Standby

The multi-machine hot standby technology improves fault tolerance because memory matchmaking shows indigent reliability and consistency when the matchmaking engine is abnormal. Furthermore, the financial transaction system has extremely low tolerance for interrupted service and data loss due to business operations being affected.

Image for post
Image for post

Hierarchical Design 5: Memory State Machine Replication

Since several mutual hot standby matchmaking engines are involved, it is necessary to ensure data consistency among servers according to the matchmaking system design and logic requirements. Therefore, consistency among several servers is essential.

Key Technologies

Following are the major technology divisions of the matchmaking system:
1.The state machine service for the certainty matchmaking algorithm is often deployed into several independent engines.
2.Received gateway orders serve as the input of the state machine for the certainty matchmaking algorithm.
3.According to its demand, you should select the order sorting method.
4.Each engine will match the order already sorted.
5.The transaction record output by the state machine for certainty matchmaking algorithm will serve as the response to the user or the database.
6.Monitor the status or output difference of the engine copy.

Implementation Scheme

To implement the matchmaking system replicated based on the memory status, the following schemes help realize the key technologies of state machine replication:

Hierarchical Design 6: System Architecture

System Hardware Architecture

Figure 6 illustrates a standard performance matchmaking model’s hardware architecture. The system is composed of N server sets, N gateway sets, X product clusters (each cluster consists of between 2 to 3 matchmaking engines, and responsible for response processing of product orders), one transaction record database and optional monitoring system. The client has an established connection to the corresponding gateway. The gateway is responsible for receiving orders submitted by the client and forwarding them to the relevant product cluster according to the financial product category of the order. All engines in the project cluster will receive the order sent by the gateway, match the order according to the matchmaking business rules, and relay the feedback message to the gateway and the client. Meanwhile, the transaction record generated by matchmaking will become part of the transaction record database.

Image for post
Image for post

System Software Architecture

Image for post
Image for post

Matchmaking Engine Architecture

Image for post
Image for post

System Interface

The matchmaking system mainly provides ordering and inquiry service, real-time feedback function of the exchange quotation and monitoring and checking service for the system status. As such, the reserved interfaces that the system ought to realize mainly include the ordering interface, order inquiry interface, quotation inquiry interface, system control interface, and operating state inquiry interface.

Conclusion

Starting with the overall design, the system transfers the matchmaking transaction processing from the database into the memory. Meanwhile, the multi-machine hot standby technology solves the volatility problem of memory matchmaking technology. Finally, a different approach suggests that the memory state machine replication scheme can serve as the route to realizing a high-reliability and high-performance matchmaking system.

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store