A strong trading platform is built around an efficient orders allocation algorithm also known as a matching engine. Because this algorithm functions as the core of any exchange, we need to develop one that matches and upholds our values. This is why since day one, we have been focused on developing a fair and powerful matching engine.

As we continue to evolve and grow, more and more talented people are joining the LGO family. We have recently taken on Arnaud Lemaire as our Head of Research Development. He brings an in-depth knowledge of blockchain technologies and prioritizes trade processing and optimization on the exchange, which has been integral during the development of our matching engine.

As our exchange has been designed for both institutional and retail investors, we need to strike a balance between the expectations from all market participants along with our objective to restore consumer confidence in the market. We cannot propose a solution that will not uphold the fundamental values of LGO. The matching engine is unquestionably a key component to “build trust” in our new generation trading platform. We have been investing a great deal of our time and resources to improve our current matching engine algorithms and to provide the best possible orders allocation to our client at the fairest price.

We are currently benchmarking and evaluating a set of rules that may be supported on the LGO exchanges.

Matching Engine

Before diving into the specifics of the most common matching engine algorithms, let’s explain briefly how an exchange allocates the incoming orders:

“The process for executing securities trades by pairing buy orders with sell orders. Matching orders utilize algorithms which determine how orders are matched and in what order they are filled, which subsequently differ based on the venue to which the trade is routed.” -Investopedia

Matching engine overview

To get a general idea of a matching engine, you can consider it as a function that takes an order (1) and an “order book” (2) as input parameters, and gives back a list of trades (2) plus all the remaining orders (3). The remaining orders will become the “order book” for the next order received by the matching engine.

The orders are processed in a sequential way:

- Best price offer default strategy

By default, a matching engine will always try to find the best price available (2) for a given order (1).

On a side note, this kind of order (1) that consumes orders from the order book are called “aggressor orders” because they remove liquidity from the market.

- Partially filled order

If an order cannot be fulfilled entirely in one transaction, the remaining lots become a “resting order” which is included in the order book (1).

In order to minimize the market exposure, only limit orders can be included in the order book.

- No match

In the same way where there is no match, the order becomes a resting order and is directly included in the order book.

- Multiple orders with same price

I becomes a bit trickier when more than one counter order could match with the current order. This is where the matching engine allocation algorithm comes into play.

The algorithm applied by the matching engine is the key element in what behaviour we want to incentivize in the exchange. In the following sections, we are going to discuss the two most popular implementations of theses algorithms.

FIFO

The most used algorithm is time/price priority, commonly called First In First Out (FIFO).It will give the priority to the oldest counter order that matches at the best available price. Of course, the orders’ position is lost if any changes occur on it.

First In First Out

Pure Pro-rata

Pro-rata algorithm fills orders according to price, order lot size and time. An incoming order from a market participant is evenly split among matching counter orders proportionally to their size.

Pure Pro-rata

Other forms of pro-rata matching

In order to incentivize specific behaviors among market players, the pro-rata algorithm is often mixed with other allocation strategies.

For example, one of the most popular strategies associated with pro-rata is pro-rata with top-order. In this case, the oldest counter order is fully filled, and then a pro-rata allocation is performed with all the remaining counter orders, as shown in the illustration below:

Other popular choices includes strategies like:

Time sensitive allocation: only counter orders that are older than a certain time are selected for the pro-rata, and/or you can weight the distribution based on the time an order has remained in the order book.

Volume sensitive allocation: you can select counter orders through a minimum volume and/or establish a cap on how much a given order can receive.

And of course, all of theses different strategies can be intermixed and combined, giving traders and investors a wide variety of pro rata based matching algorithms.

Many leading experts in the field conducted studies about orders prioritization and allocation. Field and Large suggest that pure pro-rata allocation motivates traders to oversize their orders which leads to conditions such as constant bidding or unrealistically large quantities offered which are far larger than they really can handle. But that is contradicted by the fact that a pro-rata system, in some cases, has led to a reduction in market depth and a significant reduction in liquidity available.

LGO takes this concern very seriously. According to our values, obtaining a maximum trade execution does not have to lead to irrelevant practices and inequitable prioritization. Therefore, we work hard to provide a powerful and fair trading platform that reflects our values. The matching engine algorithm will create a balanced environment by leveraging various criteria such as time, price and volume. We believe this is crucial in order to build a framework that will attract investors with rational behaviors who want to trade efficiently.

In the 2nd article of this serie, we’ll see how matching engine algorithms can be used to manipulate the market and led to unfair situations.