P&L analysis of Uniswap Market MakingThursday, 14th of March 2019 · by Mohamed Fouda
Decentralized finance (DeFi) darling Uniswap has introduced a new model for exchanging ETH and other ERC-20 tokens that differs from previous Decentralized Exchanges (DEXs). As Cyrus Younessi elegantly explains , Uniswap is unique because it acts more like a brokerage than an actual exchange. Users who want to trade an ERC-20 token can simply exchange (swap) their ETH to any ERC-20 token or vice versa with the single click of a button. The experience is seamless due to a very simple and intuitive user interface. Adding to Uniswap's uniqueness is the fact that, although Uniswap is a popular crypto project, investors have no clear way to invest in the protocol.
Uniswap breaks from the traditional DeFi business mold in a few ways. One difference between Uniswap and other DeFi protocols like Maker and Augur is the lack of a token. Additionally, the exchange trading fees don’t go to a company or a relayer. For such reasons, there is no obvious way to make a classical investment through capital allocation in a company or through buying the protocol token. Tokenless DeFi protocols like Uniswap and Dharma are unique in that the value capture occurs for the protocol users and for the services built on top, not for the companies or the teams that designed them. Uniswap's unique model has allowed it to achieve steady growth since December of last year as evidenced by the exchange volume and liquidity (the number of ETH and tokens locked in the smart contracts).
How to Market Make on Uniswap?
To capture the value generated by the Uniswap Exchange, a user needs to participate in the protocol by providing liquidity to the exchange which is known as Market Making. It is the action of adding liquidity to both sides of an exchange order book to allow traders to buy and sell of the exchange. In traditional exchanges market makers (MMs) gain profits from the price spread. While usually profitable, there is a risk of losing money during directional market moves, i.e., when the asset price increases or decreases significantly in a short period of time.
In Uniswap, the market making process is automated. A user just commits a sum of money to the exchange liquidity pool and the Uniswap smart contract performs automated market making. The committed capital has to be on both sides of the order book. So, if a MM wants to commit a $100 to the ETH-DAI market, half of this amount will be committed in DAI and the other half has to be committed in ETH at the current market price. The committed capital will be added to the Uniswap liquidity pool to increase the amount of ETH and DAI available for trading which can be tracked here. At the time of writing this article, the pool has 5,211 ETH and 710,951 DAI, for a total pool value of ~$1.4MM.
In return of the committed capital, the market maker (MM) receives liquidity tokens that represent their share of ownership of the liquidity pool. The user interface provided by the Uniswap team clearly displays how many liquidity tokens a MM would get. For example, the following picture shows that a MM will receive ~0.29 liquidity for a $100 added liquidity which represents about 0.007% ownership in the Uniswap ETH-DAI liquidity pool. When traders use Uniswap to execute trades between ETH and DAI, a 0.3% trading fee is charged to traders and added to the liquidity pool. Consequently, as trading fees are accumulated to liquidity pool, the MM liquidity tokens will worth more ETH and DAI. In that sense, contrary to a conventional exchange, the trading fees are not going to the exchange itself or to the Uniswap team but instead to the users who provide liquidity to the pool. A user can burn all or some of their liquidity tokens at any time by withdrawing liquidity and cashing the corresponding share of the liquidity pool.
Is Market Making in Uniswap Profitable?
Earning money by market making on Uniswap would sound like a lucrative investment. It even reinforces the narrative of the decentralized finance (DeFi) movement. Uniswap allows individuals and retail investors to act as financial institutions who act as MMs and earn money for their services. An added benefit is that this “business” is performed on a decentralized platform where users’ money is safe from confiscation/censorship and the business can even run anonymously.
While, in the general sense, Uniswap market making is an interesting investment opportunity for retail investors, this doesn’t come without a catch. Market making, in general, is a complex activity which has the risk of losing money (compared to just hodling) in the case of big directional moves of the underlying asset price. This is also true for the Automated Market Making (AMM) protocol used by Uniswap. It uses a method known as Constant Product Market Maker which keeps the product of ETH and DAI in the pool constant. The price of ETH/DAI pair is determined as the ratio between the ETH pool size and the DAI pool size in the smart contract. For example, if the contract has 130,000 DAI and 1000 ETH, the ETH price is 130 DAI. If the market price of ETH increased to say $150, the Uniswap smart contract won’t be aware of the price change and will keep offering ETH at the 130 DAI price. Arbitragers will then jump to the Uniswap exchange to buy ETH using DAI (decreasing ETH pool size and increasing DAI pool size). In the process, they gladly pay the 0.3% trading fees and the Ethereum network gas fees. This arbitrage opportunity is what attracts volume to the Uniswap exchange. The question here is whether MMs are making money out of this trading activity.
This question has been explored before in a couple of Pintail articles. The articles have discussed how MM profitability is affected by price changes but haven’t considered the effect of accumulated trading fees. To calculate percentage P/L including the effect of the exchange trading fees, it is more convenient to use a numerical model. Using this model, I have performed an analysis to estimate what is the P/L of providing liquidity on Uniswap at an initial market price of $130 per ETH. The analysis assumes a MM who is providing a $100 of liquidity (50% as ETH and 50% as DAI) and calculates the P/L as the difference between the dollar value of the MM’s liquidity tokens after a certain amount of time and the dollar value of initial ETH/DAI without market making. To calculate the former, the model:
- Estimates the final ETH and DAI pool sizes after a price movement using the constant product formula of Uniswap AMM.
- Estimates the fees that are added to the liquidity pool due to the trading activity. These are simply 0.3% of the trading volume. The model assumes a uniform trading volume over the period of the price movement.
- Calculate the MM share of the ETH/DAI liquidity pool based on the ratio of their liquidity tokens to the total number of liquidity tokens. For simplicity, it was assumed that the liquidity pool size didn’t change, by adding or removing liquidity, during the price move.
The first observation to make is that that a certain percentage increase or decrease in ETH price has almost the same effect, e.g., a 20% increase or decrease in ETH price will lead to about 2% of profit in the case of $8MM of trading volume. This leads to the second observation that the most profitable scenario is when the final asset price (ETH in this case) is identical to the price at which the MM has provided liquidy. When there is a significant price change, the market making activity can leave the MM in loss compared to just holding the coins especially when the trading volume is low. A final observation is that, as predicted, higher trading volumes lead to higher fees and hence increased profits from the market making operation.
To give a real-world example, we can use on-chain data to track a random ETH address that added liquidity to the Uniswap ETH/DAI liquidity pool and calculate the P/L for that address. For example, on Feb 14, a MM has provided liquidity and received 0.763 liquidity tokens in return of 1 ETH and 123 DAI of added liquidity. On Mar 4, After more than two weeks of the liquidity provision and about $5.2MM of trading volume, the liquidity tokens are worth 0.99 ETH and 128 DAI for a total combined value of ~$256. Without market making, that user would have 123 DAI and 1 ETH for a total combined value, on that date, of ~$251. If that user decided to withdraw their liquidity, they would realize a ~2% profit on their money in about two weeks. As the final ETH price in this example is very close to the price at the time of the liquidity provision, the realized profit percentage represents the best case scenario.
It is possible for MMs to apply more sophisticated strategies like the gradual increase or decrease of the provisioned liquidity as prices change to realize bigger profits. This is possible because the Uniswap smart contract allows MMs to add or withdraw liquidity at any time. Many companies and funds will eventually utilize such strategies to realize additional gains using the ERC-20 token balances under their management. Other players who could benefit from such financial products are custody providers and token projects with substantial ETH reserves. DeFi tools allow these players to realize a small passive income through engaging with decentralized and trust-minimized smart contracts without intermediaries.
In sum, DeFi protocols like Uniswap will lead the emerging wave of innovative approaches to capital deployment and management. However, it should made be clear that while DeFi offers a unique opportunity for retail investors to play bigger roles as financial service providers, these investors need to be aware of the underlying risks. They need to spend enough time researching the activities they are undertaking to recognize risks and build strategies to mitigate those risks and maximize profits.