Market making in DeFi

Profits and perils: An in-depth exploration of market making in DeFi.

August 12, 2021

Under the Hood

In this piece we pull back the curtain on market making: we cover what market making is and what makes a sophisticated market maker. In analyzing where DEX trading volumes are concentrated, we demonstrate a simple but powerful framework that can help us understand which liquidity models work best for which kinds of markets, and where 0x RFQ fits in.

The world of decentralized exchanges (DEXes) kicked off in earnest in 2020: starting at $666 million in January 2020, monthly trading volume exploded to $68 billion by January 2021, about a 100x increase. Needless to say, the industry is still undergoing a maturation process. DEXes are innovating on their liquidity models, traders are experimenting with new trading venues including aggregators, and liquidity providers and market makers are chasing each new way to maximize their profits. In this piece, we will explore one dimension of this process: how DEX market making is continuing to evolve.

How Much Market Could A Market Maker Make If A Market Maker Could Make Markets? (or “Market Making, Simplified”)

  • Imagine a centralized exchange that only two traders will visit today: Alice and Bob.
  • Alice arrives at the exchange willing to sell 1 ETH for as little as 2000 USDC at 12:00 pm today.
  • Bob will arrive at the exchange willing to buy 1 ETH for as much as 2001 USDC at 12:01 pm today.
  • The market maker (“MM”) is willing to buy ETH for 2000 USDC from Alice at 12:00 pm, hold it for one minute, and sell it to Bob at 12:01 pm for 2001 USDC.
  • Without the MM, Alice would not be able to sell her 1 ETH at the time she arrived at the exchange, and Bob would not have anyone to buy his 1 ETH from at the time he arrived at the exchange.

The presence of sophisticated market makers means there’s always someone to sell to and to buy from, so that markets are liquid. Sophisticated market makers, in short, help resolve the coincidence of wants problem.

Easy money for the MM, right? Not exactly. The MM has two main “costs”, which make this a difficult enterprise: (1) inventory risk and (2) execution costs. The MM takes on the “inventory risk” of holding that 1 ETH for one minute: if Bob wasn’t willing to pay as much as the MM paid (2000 USDC), the MM would take a loss. In addition, the MM has to pay for the technological infrastructure to execute the transaction and must pay transaction fees and costs (“execution costs”) associated with it. In exchange for inventory risk and execution costs, the MM is compensated with the difference between the price it bought at and where it sold at, the “spread”, which in this example is 1 USDC.

For a successful MM, the following must be true on average:

Compared to our example, in practice the spread is much smaller - usually a few basis points (1 bp = 0.01%) - and so is the time between trades (usually milliseconds). There’s millions of traders and trading pairs. That’s market making in a nut-shell. It’s a necessary component to any modern, well-functioning exchange.

There’s one especially important missing piece to this puzzle: how does the MM know when the spread will outweigh the inventory risk and execution costs? Essentially, how does the MM know that Bob will appear and be willing to pay 2001 USDC for 1 ETH? How the MM manages to successfully predict this is at the core of market making. It’s why unsophisticated parties typically cannot be profitable MMs in traditional financial markets; MMs usually need some predictive ability to take on these risks profitably.

Market Makers As Fortune Tellers (or “The role of predictive ability in market making”)

Sophisticated strategies that predict the short-term price movements of a trading pair are necessary because if the market is trending up or down for a given pair, as it often is, either the firm’s bids or its asks will be filled but not the other. The firm would then hold inventory against the market, which can create large losses.

We can tweak our example a bit to see this more clearly:

  • Imagine there were many Alice’s and many Bob’s, so that the MM was buying 1 ETH constantly at 2000 USDC and selling 1 ETH constantly at 2001 USDC after some small increment of time.
  • In this scenario, the MM would have frequent ‘bids’ at 2000 USDC per ETH, and frequent ‘asks’ at 2001 USDC per ETH.
  • Now imagine that at some point, the buyers in the market were suddenly no longer willing to pay 2001 USDC per ETH, and instead only willing to pay 1999 USDC per ETH. Basically, the price of ETH dropped.
  • The MM’s bids just prior to that drop were hit so that it had purchased some ETH at 2000 USDC, but now its asks (which were set at 2001 USDC), are not being hit since buyers don’t want to pay so much.
  • All of the ETH that the MM held at that given moment would now have to be offloaded at a 1 USDC loss, or held by the MM which could cause even larger losses later.

The firms with the best predictive strategies have some insight into which way the market is heading in the short term, and are therefore able to mitigate this inventory risk by moving their quotes ahead of the market. This would prevent the above scenario.

Again going back to our example, a very good MM might be able to see just far enough in advance to know (probabilistically) that the price buyers are willing to pay will drop shortly, and therefore would move its own bids down to, say, 1998 USDC per ETH so that it’s not taking a loss even after the price moves. By lowering inventory risk, highly predictive strategies allow MMs to offer tighter spreads to traders while remaining profitable.

Taking this a step further, it’s critical to realize that by offering tighter spreads (i.e. lower prices on trades), traders will consistently prefer to trade with this MM instead of others, and therefore the MM will come to dominate trading volume for that pair.

In short, if the MM manages its inventory risk and execution costs efficiently, that will enable it to offer better prices, which in turn will mean more market share for the MM.

Yet, to-date exchanges without these sophisticated MMs and their predictive prowess have dominated the DEX landscape. Uniswap and Sushiswap alone, the two-largest automated market makers (AMMs), regularly account for 70 - 80% of all DEX trading volume. Somehow, the most heavily-used DEXes are powered by “passive” liquidity that doesn’t leverage any advanced predictive ability. How are these AMMs able to offer competitive prices, and how is it that they’ve gained so much market share? This is where things get interesting, and we can start to break down what’s really happening underneath the surface in the DEX landscape.

The Long Tail Tells The Wrong Tale (or “DEX Trading Volume: A Breakdown”)

The following bar chart breaks down the trading volume on the top 50 pairs on all DEXes over the last 90 days:

Last 90 days - Stablecoin-only pairs grouped to left

Stablecoin-only pairs (e.g. USDC-DAI) are grouped to the left, followed by a ranked list of the other top 50 pairs, with one bar at the very-right representing the sum of all other trading pairs ranked 51 or below (there are tens of thousands).

We can start to consolidate the graph and shorten that tail by lumping all but ten pairs into the “All Others” category:

Last 90 days - Stablecoin-only pairs grouped to left

Here we can see a bit more clearly that the top five non-stablecoin-only pairs (e.g. WETH-USDC) comprise about $125Bn in trading volume. Let’s consolidate the graph further:

Last 90 days
Top 5 stablecoin-only pairs: USDT-USDC, USDT-DAI, USDC-DAI, sUSD-DAI, and FEI-USDC
Top 5 non-stablecoin-only pairs: WETH-USDC, WETH-USDT, WETH-DAI, WETH-WBTC, and WETH-FEI

Taking the above and reworking it into pie chart form:

Last 90 days

Highlighting what this pie chart tells us:

  • Just 5 pairs accounted for half of all DEX trading volume (WETH-USDC, WETH-USDT, WETH-DAI, WETH-WBTC, and WETH-FEI)
  • The top 5 stablecoin-only pairs made up a substantial fraction of all DEX trading volume
  • All other trading pairs combined made up less than 40% of DEX trading volume. The “long tail” is indeed long, but it’s very thin.

Why is this important? Because market making tends to look very different depending on which of these categories of trading pairs we’re talking about.

Correlation Correlates With Sophistication (or “Mapping DEX Liquidity Models To Token Pairs”)

We can think of the categories of trading pairs as falling on a correlation spectrum:

Category 1 is made up of stablecoin pairs like USDC-DAI, USDT-USDC, etc. These assets are nearly perfectly correlated by design.
Category 2 is made up of some of the most highly traded pairs - the “household names”: WETH-DAI, WETH-WBTC, etc. These assets are frequently in price discovery.
Category 3 is our long tail. It’s made up of the rest of the lesser-known assets.

Generally speaking, each category is best served by different liquidity models. Before going further, let’s recap those quickly: AMMs and orderbooks are well-understood, but the new guys on the block are RFQ (“Request for Quote”) systems. 0x launched its RFQ system in late 2020. The 0x RFQ system is available through Swap API. Every time a trader requests a quote on a Swap API-powered dapp, the Swap API pings the MMs in the 0x RFQ system and in parallel, checks the prices of the 50+ on-chain DEXes it aggregates. The 0x API takes the quote provided by the sophisticated MMs in the 0x RFQ system and it uses it, alone or in combination with other sources, to serve the trader if it is the best possible price for the trader. The additional advantages are that this quote is ‘custom’ for the trader, meaning that there will be no price impact/slippage, and it is MEV-resistant.

Between AMMs, orderbooks, RFQ, and other more niche liquidity models, it turns out that different liquidity models work best for different types of token pairs because of their correlative or non-correlative nature. Let’s go back to our original formula for successful market making and focus in on how predictive ability impacts inventory risk for each of these three categories:

Remember: sophisticated MMs’ predictive ability helps them mitigate inventory risk, which helps them provide traders with better prices, which earns them market share. In short, sophisticated MMs bank on their predictive ability. Ironically, this is exactly why AMMs are extremely well-suited to serve categories 1 and 3, so let's talk about those 2 first...

Category 1 (highly correlative/stablecoin-only pairs like USDC-DAI) lends itself especially well to AMMs for an interesting reason: because these pairs are designed to correlate nearly perfectly, sophisticated market makers have no edge in their predictive ability as compared to the average retail trader. Anyone can mitigate their inventory risk (which, in the case of stablecoin pairs, is minimal) just as easily as a sophisticated MM could. Therefore, AMMs with basic price functions offer retail liquidity providers (LPs) an opportunity to market make just as effectively as a sophisticated MM could. It’s an even playing field - there isn’t enough risk to take to earn a reward. Looking to the last bit of our successful market-making formula (execution costs), an AMM has the added benefit of having extremely low execution costs: retail LPs passively provide liquidity for relatively low returns, and an on-chain contract executes trades according to basic parameters.

Category 3 (long-tail asset pairs) is made up of asset pairs that no market maker can develop sufficient predictive ability for yet, because of their extremely non-correlative nature. Not even the most sophisticated market-makers can know with sufficient certainty which way $UDT-$YFI (for example) is going to move in the short-term. An easy way to understand this is to think of a securities product from traditional finance: catastrophe bonds. These are risk-linked securities that pay out only in the case that a specific, unpredictable natural disaster occurs, such as a tornado or an earthquake. Market makers in traditional financial markets shy away from these types of assets because it is very difficult to evaluate that risk. Similarly, in DeFi this category 3 (long-tail asset pairs) is extremely difficult for MMs to develop sufficient predictive ability for. They are unable to mitigate their inventory risk, and therefore they don’t want to play in those markets yet. AMMs, then, are well-positioned today to capture market share for category 3 pairs.

Category 2 encompasses low-correlation trading pairs often in price discovery. This category is where sophisticated MMs compete heavily with AMMs. It also happens to be where the meat of all DEX trading volume is (~50%), as shown above.

We can begin to map out our understanding for what types of liquidity models lend themselves best to which kinds of trading pairs:

Additionally, we can factor in a structural advantage favoring sophisticated MMs: AMMs suffer from price impact (a.k.a. slippage), sandwich attacks, and more, which makes them undesirable for large trades. RFQ, it turns out, works especially well on these large trades because it avoids these drawbacks. Taking this into account, we can see a more complete picture of liquidity models that are conducive to trades of each type of token pair:

Sophisticated MMs, then, will play a large role in the following area:

How does this understanding map to the reality we see represented in the data? Are sophisticated MMs competitive on category 2 pairs?

Maybe RFQ Should Stand for Really Freaking Quality (or “How 0x RFQ Fares in Category 2 Pairs”)

Below is a graph of 0x RFQ’s share of overall Swap API volumes for each of the three categories of token pairs over the last 90 days. For category 1 (stablecoin-only pairs), we've isolated the top 5 stablecoin-only pairs (USDT-USDC, USDT-DAI, USDC-DAI, sUSD-DAI, and FEI-USDC) for demonstrative purposes. For the purposes of this essay, we've defined category 2 as the top 5 non-stablecoin-only pairs (the "household names": WETH-USDC, WETH-USDT, WETH-DAI, WETH-WBTC, and WETH-FEI), although this definition is likely somewhat constrained and will probably expand over time. Category 3 encompasses all other trading pairs.

RFQ share of trading volume via Swap API for the three categories of token pairs

The graph demonstrates that for category 2 pairs (WETH-USDC, WETH-USDT, WETH-DAI, WETH-WBTC, and WETH-FEI), 0x RFQ is providing 37% of all liquidity served via Swap API over the last 90 days. Another way to think about this is that the sophisticated MMs using the 0x RFQ system are providing the best price to traders between about 37% of the time for category 2 pairs, beating out all other AMMs and other liquidity sources. Comparatively, sophisticated MMs are using RFQ to serve less than 1% of all volume on the top 5 stablecoin-only pairs. RFQ’s share of trading volume on all other pairs falls somewhere in the middle, but is still relatively low. This maps very well to our matrix: RFQ tends to perform best on category 2 (“Low” correlation) pairs, and not so well on category 1 or 3 (“High” or “Zero” correlation) pairs.

Next, we can look to our data to confirm whether our matrix is correct in presuming a bias in favor of RFQ for larger trades. Below you will find a graph of RFQ’s share of all Swap API trading volume on just the category 2 pairs (WETH-USDC, WETH-USDT, WETH-DAI, WETH-WBTC, and WETH-FEI), segmented out by trade size.

Last 90 days (WETH-USDC, WETH-USDT, WETH-DAI, WETH-WBTC, and WETH-FEI only)

Again, the data confirms our matrix. RFQ has served 39% of all volume on large trades (>$10K) of the category 2 pairs over the last 90 days, 7.1% of volume on trades between $1k and $10k, and 0.5% of volume on trades under $1k. In short, RFQ works very well for large trades, and progressively underperforms as trade size decreases.

In light of this data and our insights into where sophisticated market makers are focusing their energies, we believe that sophisticated MMs will continue to operate most profitably in this category 2, particularly on larger trades, by using RFQ (and order books in the long-run).

AMMs will likely continue to operate profitably, but will likely have lower risk-adjusted returns and will therefore be better suited for less-sophisticated LPs and smaller trades.

With more sophisticated MMs entering DeFi, we see RFQ gaining steam. RFQ’s share of all trading volume driven through the Swap API has exploded from less than 5% in early February. Having peaked at above 30% in early June, the positive trend has stabilized in the 15 - 20% range. It’s useful to reiterate here that Swap API selects, in an un-opinionated fashion, from over 50 liquidity sources to provide the best blended price to the trader. Our data shows that RFQ is gaining real traction.

Last 6 months

Ready to tap in RFQ liquidity?

If you’ve already integrated Swap API, turning on RFQ liquidity is as simple as providing a takerAddress in your /swap query. Check out our quick tutorial to get access to RFQ liquidity in less than 5 minutes.

New to 0x? Sign-up for an account on the 0x Dashboard to tap into RFQ liquidity today.

Contents

Subscribe to newsletter

By submitting you're confirming that you agree with our Terms and Conditions.
Yay! You’re signed up.
Oops! Something went wrong, but it's not your fault.

Up next

Fundamentals: Bridges

Dec 20, 2024

Fundamentals: Intents

Dec 12, 2024

Fundamentals: SocialFi

Nov 26, 2024

Unlock powerful onchain insights with 0x Trade Analytics API

Nov 5, 2024

Fundamentals: Smart Contract Wallets

Oct 15, 2024

Compliance made easy with 0x Address Screening

Sep 26, 2024

0x's next-gen pricing engine is now live

Sep 25, 2024

Introducing state-of-the-art Buy/Sell Tax support

Sep 4, 2024

Take control of your balance sheet with 0x v2

Aug 15, 2024

0x v2 bug bounty program

Jul 30, 2024

What does the "best price" in DeFi really mean?

Jul 23, 2024

Eliminate allowance risk with Permit2

Jul 17, 2024

Introducing 0x's next-gen pricing engine

Jul 15, 2024

0x Dev Digest: May 2024

May 31, 2024

Frame spotlight: Paycaster

May 21, 2024

Frame spotlight: Airstack

May 9, 2024

Power up your Farcaster Frames with 0x swaps

May 2, 2024

0x Dev Digest: April 2024

Apr 30, 2024

Introducing 0x Trade Analytics

Mar 12, 2024

Coinbase Case Study

Jan 30, 2024

Introducing gasless swaps and approvals with Gasless API

Jan 22, 2024

Bitcoin ETFs have arrived

Jan 12, 2024

Building in the open: 0x pricing update

Dec 11, 2023

Matcha leverages Gasless API to bring users the most frictionless trading experience in DeFi

Nov 30, 2023

0x Dev Digest: October 2023

Nov 2, 2023

Monetize crypto trading in your app with Swap API

Oct 26, 2023

0x Dev Digest: September 2023

Oct 3, 2023

A comprehensive analysis of RFQ performance

Sep 26, 2023

Unlock optimal trades in Swap API with 0x RFQ liquidity

Sep 20, 2023

0x Dev Digest: August 2023

Aug 31, 2023

Portal launches swaps in its white label MPC wallet powered by 0x

Aug 16, 2023

0x Swap API is now live on Base

Aug 9, 2023

Introducing paid plans for Swap API

Jul 24, 2023

Decreasing Frictions in DeFi hackathon recap

Jul 12, 2023

0x's pricing principles

Jul 3, 2023

0x Dev Digest: June 2023

Jun 30, 2023

App spotlight: tastycrypto

Jun 27, 2023

App spotlight: 31Third

Jun 22, 2023

0x 101: Intro to gasless API

Jun 13, 2023

Inspiration for building with Swap API

Jun 8, 2023

0x Dev Digest: May 2023

May 31, 2023

Fundamentals: What are gas fees?

May 25, 2023

Decreasing Frictions in DeFi Hackathon

May 12, 2023

Swap API liquidity management

May 18, 2023

0x 101: Getting started with Swap API

May 16, 2023

0x 101: Intro to Swap API

May 9, 2023

0x 101: Intro to 0x Orders

May 4, 2023

0x 101: Intro to 0x Protocol

Apr 27, 2023

A new home for 0x Protocol

Apr 24, 2023

Say hi to the new 0x

Apr 20, 2023

0x Year in Review 2022

Jan 5, 2023

0x Swap API expands to Arbitrum

Sep 22, 2022

Managed liquidity

Apr 23, 2020

0x Smart Order Routing

May 19, 2020

App spotlight: Taho

Mar 8, 2022

Fundamentals: What is a Layer 2 chain?

Apr 19, 2023

Fundamentals: What is the difference between quoted, executed, and adjusted prices?

Apr 19, 2023

Fundamentals: What is price impact?

Apr 19, 2023

Fundamentals: What is slippage?

Apr 19, 2023

Fundamentals: What is an automated market maker (AMM)?

Apr 19, 2023

Fundamentals: What is market making?

Apr 19, 2023

Fundamentals: What is a DEX aggregator?

Apr 19, 2023

Fundamentals: What is liquidity?

Apr 19, 2023

Fundamentals: What is a decentralized exchange (DEX)?

Apr 19, 2023

0x at ETHDenver 2023

Mar 21, 2023

The 0x Mission and Values

Jun 7, 2018

Announcing support for new testnets

Aug 10, 2022

0x Swap API expands to Binance Smart Chain

Mar 17, 2021

Scaling DeFi — Layer One

Sep 1, 2021

Introducing Slippage Protection

Jul 14, 2022

San Francisco Blockchain Week 2022 Recap

Nov 21, 2022

0x Swap API adds new liquidity sources

Jul 11, 2022

Review of slippage performance

Sep 14, 2022

Phuture case study

Oct 20, 2022

Measuring the impact of hidden DEX costs

Apr 14, 2022

Introducing 0x Labs

Jun 22, 2020

Introducing 0x Explorer

Oct 26, 2022

Growing DeFi with professional market makers

Aug 26, 2020

0x 101: How to Access 0x Data

Apr 25, 2023

GameStop chooses 0x Swap API

Jul 8, 2022

Build on Base with 0x

Feb 23, 2023

A comprehensive analysis on DEX liquidity aggregators’ performance

Oct 1, 2020

Announcing 0x Swap API v1

Oct 1, 2020

Access all DEX liquidity through 0x Swap API

Jan 28, 2020

Announcing the 0xpo Summit 2022

Aug 24, 2022

0x Protocol, a preview of what’s to come

Mar 16, 2023

Update to our Privacy Policy

Mar 14, 2023

Price Impact Protection has arrived

Dec 14, 2022

0x Limit Orders Go Multi-Chain

Dec 23, 2021

0x Labs raises $70M Series B led by Greylock to continue expanding Web3’s core exchange infrastructure

Apr 26, 2022

0x launches Tx Relay API in beta, with Robinhood Wallet as first partner

Mar 1, 2023

0x Labs raises $15M Series A to bring decentralized exchange markets to a global audience

Feb 5, 2021

App spotlight: Zerion

Jun 22, 2022

App spotlight: Matcha

Nov 24, 2021

App spotlight: DexGuru

Jun 17, 2021

App spotlight: DEXTools

Sep 23, 2021

App spotlight: DODO

Aug 10, 2021

App spotlight: DappRadar

Dec 16, 2021

App spotlight: DeFi Saver

Jul 20, 2021

0x + Brave partner to make crypto and DeFi more accessible to everyone

Jul 7, 2021