Matching Engine and Orderbook

When you place an order on the front end it is immediately pushed through to our Matching Engine. The Matching Engine is responsible for matching trades that come in, checking appropriate balances and trade parameters, and placing orders into the order book if there are no trades that match.

The matching engine is also responsible for additional security checks and procedures.

Matching Logic

When an order comes into the matching engine the order parameters will tell the matching engine what side of the book the trade is in (Buy or Sell), what type of trade it is (Market, Limit, or Stop), if the trade is a regular spot trade, if its a short or on margin, the size of the trade and the price of the trade.

Depending on all of the parameters the trade will go through a variety of different checks, balances, and procedures.

Price Bands

In order to prevent asset prices from being manipulated on the exchange, Evo Exchange's matching engine incorporates price bands. To do this, the matching engine takes inputs from a variety of sources in regards to each asset's spot price. If the price of the trade being matched in the matching engine is outside of a set range compared to our different sources, the trade will not be matched and instead will be placed on the orderbook. Only trades within the price bands will be allowed to execute. This will help in cases where somebody would like to manipulate the price of an asset on the exchange compared to its actual value.

Balance Checks

On every order, the Matching Engine will check each user's asset balance in the smart contract to ensure that they have the available balance to complete that trade. In the case of Margin and Shorts, the matching engine will instead check the "Total Portfolio Balance", "Initial Margin Requirement", and "Aggregate Maintenance Margin Requirement" parameters.

Only after all of these parameters pass will a trade be matched. All matched orders will be batched together and subsequently passed to the Exchange smart contract to execute in one trade.

Last updated