Ever wondered how decentralized exchanges (DEX process trades and discover prices? Unlike traditional exchanges, a DEX uses an automated market maker (AMM) to enable a fluid trading system that borders on autonomy, liquidity and automation. Continue reading to understand the concept of an automated market maker and how it powers decentralized exchanges.
Market Making: What Is It?
Before we dive into the technicalities associated with AMMs, it is crucial to understand the concert of market making in the financial landscape.
As its name implies, market making connotes the process involved in defining the prices of assets and simultaneously providing liquidity to the market. In other words, a market maker does create liquidity for a financial asset. It must find a way of meeting the selling and buying requests of traders, which in turn plays into the pricing of the said asset.
For instance, a Bitcoin exchange uses an order book and an order matching system to facilitate Bitcoin trades. Here, the order book records and showcases the prices at which traders desire to buy or sell Bitcoin.
The order matching system, on the other hand, matches and settles sell and buy orders. At every given time, the most recent price at which Bitcoin was bought will automatically feature as the market price of the digital asset.
In some cases where there are not enough counterparties to trade with, the market is said to be illiquid or prone to slippage. Slippage occurs when the processing of large order volumes drives the prices of an asset up or down.
To mitigate this occurrence, some crypto exchanges employ the services of professional traders — in the form of brokers, banks and other institutional investors — to continuously provide liquidity. These liquidity providers ensure that there are always counterparties to trade with by providing bid-ask orders that would match the orders of traders. The process involved in providing liquidity is what we call market making, and those entities that deliver liquidity are market makers.
Now that you understand what market making is, it is easier to grasp the workings of an automated market maker.
What Then Is an Automated Market Maker?
From the explanation above, it is clear that crypto market makers work around the clock to reduce price volatility by providing the appropriate level of liquidity. What if there was a way to democratize this process such that the average individual could function as a market maker? This is where automated market makers enter the fray.
Unlike centralized exchanges, decentralized trading protocols do away with order books, order matching systems and financial entities acting as market makers: some examples are Uniswap, Sushi, Curve and Balancer. The goal is to eliminate the input of third parties so that users can execute trades directly from their personal wallets. Hence, a majority of the processes are executed and governed by smart contracts.
In other words, AMMs allow traders to interact with smart contracts programmed to enable liquidity and discover prices. While this summarizes the concept of AMM, it doesn’t explain the underlying processes and systems that make this possible.
How Do AMMs Work?
First and foremost, have it at the back of your mind that AMMs use preset mathematical formulas to discover and maintain the prices of paired cryptocurrencies. Also, note that AMMs allow anyone to provide liquidity for paired assets. The protocol allows anyone to become a liquidity provider (LP).
To explain this further, let’s take Uniswap as a case study. The protocol uses the popular x*y=k equation where X denotes the value of Asset A and Y represents that of Asset B. K is a constant value. Hence, regardless of changes in the value of assets A or B, their product must always be equal to a constant.
Note that the equation highlighted as an example is just one of the existing formulas used to balance AMMs. Balancer uses a more complex formula that allows its protocol to bundle up to eight tokens in a single pool.
While there are a variety of approaches to AMMs as exemplified by Uniswap and Balancer, the fact remains that they require liquidity to function properly and negate slippages. As such, these protocols incentivize liquidity providers by offering them a share of the commission generated by liquidity pools and governance tokens. In other words, you get to receive transaction fees when you provide capital for running liquidity pools.
Once you stake your fund, you will receive liquidity provider tokens that denote your share of the liquidity deposited in a pool. These tokens also make you eligible to receive transaction fees as passive income. You may deposit these tokens on other protocols that accept them for more yield farming opportunities. To withdraw your liquidity from the pool, you would have to turn in your LP tokens.
Another thing that you should know about AMMs is that they are ideal for arbitrageurs. For those that are unfamiliar with this term, arbitrageurs profit off inefficiencies in financial markets. They buy assets at a lower price on one exchange and sell them instantly on another platform offering slightly higher rates. Whenever there are disparities between the prices of pooled tokens and the exchange rate of external markets, arbitrageurs can sell or buy such tokens until the market inefficiency is eliminated.
Although AMMs offer significant returns to LPs, there are risks involved. The most common is impermanent loss. This phenomenon arises when the price ratio of assets in a liquidity pool changes. LPs who have deposited funds in affected pools automatically incur an impermanent loss. The larger the shift in the price ratio, the larger the loss.
However, this loss is called impermanent for a reason. As long as you do not withdraw deposited tokens at a time that the pool is experiencing a shift in price ratio, it is still possible to mitigate this loss. The loss disappears when the prices of the tokens revert to the original value at which they were deposited. Those who withdraw funds before the prices revert suffer permanent losses. Nonetheless, it is possible for the income received via transaction fees to cover such losses.
Over the last couple of years, AMMs have proven to be innovative systems for enabling decentralized exchanges. In this time, we have witnessed the emergence of a slew of DEXs that are driving the ongoing DeFi hype. While this does not mean that the approach is flawless, the advancements recorded in the last 12 months are indicative of the several possibilities that AMMs provide. It remains to be seen where we go from here.