An automated market maker, otherwise known as an AMM, is a means of offering cryptocurrency trading without the need for an intermediary. AMMs combine Smart Contracts and incentives for liquidity provision to automate cryptocurrency trading and disrupt the traditional centralised exchange model, replacing it with the DEX.
A DEX is an abbreviation for Decentralised Exchange. It is a Peer-to-Peer online marketplace for buying and selling cryptocurrency that functions without a central authority and without taking custody of users’ funds.
Decentralised Exchanges instead rely on AMMs running on blockchains like Ethereum to set the prices of asset pairs and maintain sufficient liquidity.
DEX’s are a core component of DEFI - decentralised finance - generating 24hr trading volume in excess of $2bn, according to Coingecko.
Automated Markets & Traditional Markets
Any exchange, whether trading crypto, commodities or stocks, is designed to match the demand from traders wanting to buy an asset at a specific price with someone willing to sell at that price, and to automate the process within a user-friendly interface such as a website or App.
The traditional model for doing this is known as a Centralised Exchange, or CEX. It is described as centralised because there is a single point of control for the service - from both a technology and management perspective - with which the user has to establish trust by supplying KYC.
The technology within a CEX establishes the price for tradable asset pairs such as EUR/BTC through what is known as an order book.
The order book is essentially a list of offers from customers to buy or sell a specific amount of Bitcoin at a specific price in Euros. Order books automate price discovery through the wisdom of the crowd.
The exchange doesn’t decide the price, it simply provides the means for the market to arrive at the price based on the relative demand from buyers and sellers.
In order for an automated order book to provide an accurate price, it needs sufficient liquidity - the volume of buy/sell order requests. If liquidity is weak then there will be big gaps in the price that users are prepared to buy and sell at. This is known as price inefficiency or Slippage - where the price that a trade is placed at differs from the executed price because there is insufficient liquidity to cover the whole order.
What is Market Making in Crypto?
A centralised cryptocurrency exchange will try and create efficient markets for coins and tokens by acquiring customers to generate liquidity. They might do this through a mixture of marketing and product features:
- Offering the widest range of tradeable pairs
- Competitive fees charged per transaction
- Promoting its credibility & regulated status
- Making depositing/withdrawing fiat (on-off ramps) as easy as possible
- Using a native token to discount trading fees
But the main mechanism that centralised exchanges employ to generate liquidity is through external market makers. These are B2B financial services that are paid to artificially generate trading demand for a specific coin, generally ones that are newly listed.
The magic that enables a decentralised exchange to automatically create markets without relying on the traditional intermediary is a combination of maths and code.
Automated Market Maker Equation
Where a CEX has an Order Book managing offers from buyers and sellers through a centralised system a DEX uses an Automated Market Maker (AMM). An AMM combines Smart Contracts and algorithms to incentivise crypto holders to provide liquidity for trading pairs and automatically adjusts prices based on the changing liquidity ratio.
In its simplest form, the AMM model works on the equation x*y=k. We can illustrate for an example trading pair of BTC/USDT
x = the BTC proportion of the total pool
y = the USDT proportion of the total pool
k = the total liquidity in the pool (x*y)
Automated Market Maker Algorithm
The job of the algorithm is to keep k constant by adjusting the prices of x and y in proportion to trades and incentivising Liquidity Providers (LPs).
If traders buy BTC they diminish that side of the pool and increase the pool of USDT increasing the relative price of BTC. This also incentivises LPs to provide more BTC because liquidity provision is based on the proportion of the overall pool you add, not the specific price at the time.
Price within a DEX doesn’t move based on knowledge of price externally -- through an Oracle, for example -- but simply because traders will profit from any differentials between the price offered on the DEX and the price elsewhere, for example on a centralised exchange. Exploiting price differential is known as arbitrage and is essential for efficient markets of any sort.
Even with arbitrage helping keep the price offered by a DEX in line with the broader market this doesn’t guarantee that a trade will also be executed efficiently because the size of the trade relative to the volume of the liquidity pool will determine price slippage.
Automated Market Makers (AMM) Examples
The AMM model is the default for decentralised exchanges but given the composability of DEFI different applications have emerged.
Uniswap uses AMMs to incentivise liquidity provision of pairs of Ethereum-based tokens (generally in a 50/50 ratio) which enable other users to swap those tokens for a fee without an intermediary, custody of funds or the need for KYC.
Uniswap has traded over $1 trillion in volume and executed close to 100million trades. It has its own governance token that is paid to LPs (liquidity providers) in addition to fees from transactions and gives them a say in the future of the platform.
Version 1 of Uniswap was launched in November 2018 and quickly became the template for Automated Market Making within crypto with copycat Decentralised Exchanges like Sushiswap adding more features or replicating the model for different blockchains, such as PancakeSwap on the Binance Smart Chain.
Curve Finance applies the AMM model to Ethereum-based tokens but specifically to low-risk Stablecoin pairs or pairs of coins with equal or similar value. 50% of the fees generated from swaps go to the Liquidity Providers while the other half goes to holders of the underlying governance token CRV with rewards increasing depending on how long CRV is locked for.
Ethereum’s use of standards enables composability, the building of new applications on top of existing ones, in order to generate additional user value. This has enabled the creation of DEX aggregators like 1Inch that will automatically search across individual decentralised exchanges to find and execute the best price swap for you.
Balancer adapted the Uniswap model for Liquidity Provision without the requirement to provide asset pairs in a 50/50 ratio. You deposit liquidity to Balancer and traders look to earn arbitrage in order to continually rebalance your portfolio. The traders gain and you earn fees from their transactions.
This turns the traditional asset management model on its head where the customer pays a financial service provider to maintain a specific portfolio balance.
What is the best automated crypto trading platform?
If you are looking for the best automated crypto trading platform there are a few key considerations which should look out for:
The depth of the particular market you want to trade into - the available liquidity - will determine any slippage in the price as you execute an order. You can use crypto price aggregators like Coinmarketcap or Coingecko to get a sense of the market depth available for swapping a particular coin.
The Market Depth metric is often described as the volume required to move the price +/-2%. The higher that volume the greater confidence you can have that your trade won't move the price away from your desired entry or exit.
If you are concerned about moving the market and price slippage on a DEX you can consider breaking your trades into smaller chunks, waiting for the liquidity pools to rebalance. This, however, needs to be balanced against paying higher fees for more transactions.
Decentralised exchanges are blockchain-based with all transactions committed to the chain paid for by fees calculated in relation to the specifics of the consensus mechanism and network congestion. Ethereum is by far the most popular chain for DEFI but it has become a victim of its own success struggling to scale with fees rising to exorbitant levels. If you are considering using a DEX you need to incorporate fee comparison into your decision-making process.
Ethereum’s scaling issues have become an opportunity for other chains to compete. Solana, Avalanche and Fantom have emerged with alternative consensus mechanisms and lower fees, but have their own disadvantages either in terms of smaller ecosystem, lack of decentralisation or reliability.
Those DEX that are built on layer 2 Ethereum applications - like Metis or Arbitrum - are popular because of the cheaper fees and ease of bridging from Ethereum though there are some significant drawbacks.
- Layer applications aren’t interoperable
- They may not offer significant liquidity
- Onboarding/confirmation times can be significant
Automated Market Maker FAQs
Why are AMMs popular?
Choice of tokens - There is a huge and growing number of cryptocurrencies but only a tiny proportion are supported by centralised exchanges. AMMs fill the gap in the market as there are no restrictions on what coins can be listed so long as liquidity can be incentivised.
No KYC - The DEX model requires no KYC because it doesn’t touch the traditional banking system, and only offers trading in crypto pairs.
Non-Custodial - Decentralised exchanges do not take custody of funds which is why they are described as Peer-to-Peer. A user connects directly with a Smart Contract through their non-custodial wallet e.g MetaMask granting access privileges for as long as they want to interact with the Contract.
What are the risks and limitations of AMMs?
One of the specific problems of the AMM approach to decentralised exchanges is that for very liquid pools much of the funds are sat there doing nothing. This is because the majority of the time price moves in a relatively narrow range, and the pool will quickly rebalance.
It would take a significant price shift to absorb the majority of liquidity so the majority of capital within the AMM model is deployed inefficiently, essentially doing nothing. Despite this everyone still earns fees in proportion to what they contribute to the overall pool.
Smart Contract Vulnerability
The automated nature of AMMs - functioning via Smart Contracts - is both their key strength and a potential source of weakness. Smart Contracts are deterministic; if conditions are met they execute in full or not at all, but because they are written by humans those conditions - expressed as computer code - can contain explicit mistakes or miscalculations of logic that hackers will look to exploit and abuse.
If a DEX is exploited you could lose your funds with no guarantees that you will get anything back. Chainalysis reported that DEFI accounted for $2.3bn of crypto-related crime in 2021.
Impermanent Loss is the unrealised loss in the value of funds added to a liquidity pool due to the impact of price change on your share of the pool. It's a factor of the automated nature of DEFI and the volatility of the price of asset pairs.
It’s impermanent because it is only realised when withdrawing funds. Users can claim the proportion of assets added to a lending pool rather than the equivalent amount of value they added to the pool. Impermanent loss can positively and negatively impact liquidity providers depending on market conditions.
Though impermanent loss might sound confusing, it is just the tip of the iceberg regarding the complexity and risk of DEFI. Flash loans are the clearest example of how deep the DEFI rabbit hole can go.
A flash loan is a way to borrow crypto funds from a lending pool without collateral, provided the liquidity is returned within the space of one block confirmation.
If the funds are not returned within one block, all the associated actions are reversed as if they never happened.
However, if funds are returned within the space of one block, the lending pool the funds were borrowed from doesn’t lose out because the funds are returned. The person who took out the Flash Loan then gets to keep whatever value they were able to generate across a complex series of transactions, net of the transaction costs associated with each step in the chain.
Flash Loans use custom-written Smart Contracts to exploit arbitrage within the DEFI ecosystem - market inefficiencies across tokens and lending pools. Arbitrage is a natural part of how financial markets mature. Still, Flash Loans are also being used to manipulate and distort crypto asset prices and generate massive returns for those with the skills to understand the dark side of DEFI.
Chainalysis reported that $364million was stolen via Flash Loan attacks on DEFI protocols in 2021.
- See this separate article outlining the risks posed by DEFI
The Future of Automated Market Makers
Automated Market Makers are evolving to address specific functional issues such as the problem of capital inefficiency. Uniswap 3.0 allows users to set price ranges where they want their funds to be allocated. This is creating a far more competitive market for liquidity provision and will likely lead to greater segmentation of DEXs.
The options will likely range from the simple lazy LP approach where funds sit in a pool without any price matching criteria, and those that are geared towards strategic capital allocation, essentially mirroring an Order Book-style approach, which will appeal to experienced DEFI users.
At the same time as AMM functionality improves and innovates the user experience of decentralised exchanges that sit on top, which is a clunky and confusing experience, will rapidly evolve to reduce the friction that limits adoption.
More broadly innovation in the DEFI sector is addressing concerns around loss of funds through the emergence of insurance services, trying to reduce the incidence of code exploits through better auditing and finding ways to flag price manipulation faster and minimise any potential loss.
The issue of fees and scalability within AMMs and decentralised exchanges is a function of the wider battle among Smart Contract compatible chains. Ethereum’s imminent merge is being closely watched given the impact it might have along with the development of Layer 2 rollups which potentially reduce fees to pennies.
At the same time, proponents of alternative layer 1 blockchains like Solana, Cardano and Avalanche make the case for faster transactions and lower fees attracting users and creating diverse applications which naturally include AMM powered decentralised exchanges. More competition gives users more choice which can only be a good thing.
This article does not contain investment advice or recommendations. Every investment and trading move involves risk, and readers should conduct their own research when making a decision.