Skip to main content

Concepts behind the Matrix Market Maker

Definition

The Matrix Market Maker (MMM) is a new model of Market Making developed by Swaap. It is a stochastic, asymmetric, oracle-guided, multi-asset constant geometric mean product market maker. Its function is to enable passive investing strategies with market-level performance.

Overview

Swaap strongly reduces Impermanent Loss by staying market neutral. This means that asset quantities in the pool always remain close to their initial distribution. Put differently: if you deposit 100 BTC and 100 DAI, at withdrawal the pool will give you back as close as possible to 100 BTC and 100 DAI + collected fees, no matter the price of the assets.

To give an example, take a 100 BTC / 100 DAI pool where initially, 1 BTC = 1 DAI. Imagine that the price of BTC rises to 2 DAI on a centralized exchange. In a traditional AMM, there would be a rebalancing effect. The pool would end up with 70 BTC and 140 DAI, and its total value would be 280 DAI. The Swaap pool would keep approximately the initial assets balance of 100 BTC and 100 DAI for a total value of approximately 300 DAI. Thus LPs are much better off.

Consequently, the protocol doesn't need to be rebalanced to operate normally and provide liquidity at market prices. This is a major difference with traditional AMMs, which must constantly be rebalanced by arbitrageurs.

So, how to enable people to trade while maintaining the same ratio of underlying assets?

This works thanks to several features.

Oracle-guided pricing

Swaap uses oracles to compute the mid-price of the assets traded on the platform. The oracles are provided by Chainlink (price feeds), the most secure oracles provider.

Oracles are updated every 27s on the Polygon network, which enables Swaap to strongly reduce the arbitrage possible on the platform, and distribute this value to both LPs and traders.

To avoid potential errors or malicious attacks on the oracle values, Swaap uses two mechanisms:

  • If reserves are imbalanced by more than 2%, trading is paused, which prevents having too much extraction in case of wrong data.
  • If an oracle is not updated at the required time stamp, trading is interrupted on the platform for the said asset.

Dynamic & asymmetric spread

The dynamic & asymmetric spread ensures that people can trade while keeping the pool close to its initial ratio of assets (market neutral).

We inspire ourselves from the algorithms active market makers have been using for years in TradFi. Basically, the idea is that the higher the risk of a trade for the pool, the higher the fees and vice versa.

Dynamic spread depends on:

  • Volatility: we compute, based on stochastic calculation and the last 10 price feeds, the expected volatility for the asset in the next few minutes. Low expected volatility means low fees and high expected volatility means high fees. This protects the pool from selling an asset that increases strongly in price in a short time frame. It also protects the pool against frontrunning of the oracles.
  • Inventory: whenever there is an imbalance within the pool, trades that help rebalance the pool get lower fees. This ensures that the pool’s assets distribution always stay close to what it was at the start.

Trading fees vary depending on assets and market conditions. This provides incentives for traders to keep the pool balanced. For instance, if the pool is slightly imbalanced with too much BTC and too little DAI, a trader might pay 2bps to buy BTC and 30 bps to buy DAI.

These mechanisms ensure that liquidity providers are not exposed to inventory risk and also supply better prices to traders when the conditions are met (which is the case most of the time).

Glossary

Automated Market Maker: Automated Market Makers (AMMs) automate the process of providing liquidity and trading assets through smart contracts.

Impermanent Loss: LPs suffer from impermanent loss when the price of the assets they have supplied to a pool decorrelate. For more information, see section “What is Impermanent Loss” below.

Spread: The bid-ask spread is the difference between the highest price that a buyer is willing to pay for an asset and the lowest price that a seller is willing to accept. The higher the liquidity in the pool, the lower the spread.

Liquidity: Amount of digital assets stored in the pool contract and available for trading.

Slippage: Difference between the expected price for a trade and the price at which the trade is executed. Traders normally look for the lowest possible slippage. On Swaap, you can easily set your slippage tolerance by clicking on the “settings” button on the top right corner of the swap box.

Swap fees: Fees collected by the protocol on asset swaps, which are redistributed to liquidity providers.

Pool: Collection of tokens stored in a smart contract.

Oracle: Oracles are third-party services that allow smart contracts within blockchains to receive external data such as the market price of a token. Swaap relies on Chainlink, which is considered as the most reliable and secure oracle provider on the market.

Liquidity Providers “LPs”: Liquidity Providers deposit tokens into a given liquidity pool. They take on market making risk and are rewarded with trading fees.

Trader: A trader swaps assets in a pool for his own utility.

Arbitrage trader: An arbitrage trader is someone who takes advantage of price differences between pools and/or centralized exchanges to make a profit. For instance, if the price of ETH in a pool is $2500 but ETH trades at $3000 in the market, the traders buys ETH in the pool and re-sells it in the market, making $500 per ETH traded.