Bitfinex releases new distributed matching engine for crypto trading

Bitfinex, popular bitcoin and cryptocurrency exchange this past week initiated a major performance update that was focused around the deployment of Hive — a distributed, multi-threaded and multi-process matching engine built around speed, stability, and scalability.

A matching engine is the core software behind an electronic, computer-driven trading platform like Bitfinex. Cryptocurrency trading (and that of most other financial instruments) is now almost entirely enabled by electronic matching engines and the software supporting this.

Matching engines work by matching up trades on a platform, allocating bids and offers amongst competing traders by means of a certain set of rules (algorithms). Through an increasingly efficient order allocation process, electronic matching engines have worked to drive down transaction fees to pennies whilst improving market quality (lower spreads, improved order book depth).

As a by-product of this, the speed at which one can receive, interpret and react to market information, in both relative and absolute terms, is now a fundamental consideration for both traders and exchanges seeking a competitive advantage.

Bitfinex introduce ‘Hive’

Recent platform updates on Bitfinex have focused on transitioning away from a single-threaded matching engine towards a distributed, high-performance, multi-process system.

Referred to as Hive, this system allows for increasingly efficient order execution & improved scaling capabilities by separating workloads amongst multiple ‘instances’, or workers. Instances communicate via Grenache to allocate and execute trades, spawning new workers in times of high load (and vice versa).

Engine performance improvements

Due to improvements brought on by Hive, traders on Bitfinex now react more quickly to price movements and changing market conditions. The new architecture enables Bitfinex to maintain high performance in the face of a growing user base, new tradable assets and unforeseen spikes in trading activity.

The distribution of the matching engine ensures that order matching capacity (and latency) remains unaffected by periods of high order throughput. This minimizes chances of order rejection due to system overload, even under heavy load.

In internal testing, Hive has scaled up to 100x the number of orders handled in the current market. The deployment of Hive has resulted in a complete order execution time of 14ms, down 10x relative to pre-deployment. This includes the pre-risk check (heaviest part), order matching (microseconds) and execution reporting. These results are based on initial tests and are likely to improve further as we work to optimize Hive integration.

Hive also comes with full support for new order types (e.g. position reduce-onlymarginorders), order level flags to prevent self-trading, FX virtual books and support for a number of additional gateways, including Ethfinex DEX gateway and FIX.

ETHFinex

The Bitfinex team says that Hive puts the preliminaries in place for the decentralization of its ERC20 platform Ethfinex. Through adding support for expiry times for orders into the engine — a necessary component for the matching of 0x format, non-custodial orders — as well as adding several other flags, the road is paved for the launch of the Ethfinex non-custodial API and decentralized trading portal.

A new gateway API will allow these Ethereum based order promises (signed and authenticated using a trader’s private key) to be submitted into Hive and treated agnostically like any other order, up until the point of execution when they are settled with atomic swaps on Ethereum.

Exit mobile version