January 28, 2022

Matchmakers vs eHarmony

Market makers and order books are at the beating heart of markets. They're how we ensure there's a buyer for every seller and a seller for every buyer. They're how modern financial exchanges work. It's a model that works well in big markets. Automated Market Makers change the game. They can operate - profitably - in small markets. It's a powerful new invention that's beginning to transform markets as we know them.

Hey friends -

Welcome to all of the new subscribers! Every week, I go deep on a topic from fintech to crypto to money. I wrap up each letter with some cocktail talk and a recipe for my cocktail of the week.

You can join me and my good friend, recently minted (!) top analyst Steven Dickens, the following week as we discuss the topic in depth. Find the full letters archive here and sign up for the podcast here.

This week we're looking at the innovation shaking up the beating heart of markets - how to ensure there's a buyer for every seller and seller for every buyer.

In this week's letter:

  • Reinventing markets: order books, making markets, and automated market makers
  • Hard work as a competitive advantage, The Federal Reserve publishes its first paper on digital currency, and more cocktail talk
  • The author bastardizes a classic cocktail with the Uncultured Debonair

Total read time: 16 minutes, 59 seconds.

Matchmaking with Buyers and Sellers

Markets are simple concepts at their core - a place for buyers to buy and sellers to sell. Despite their simplicity, they are wonderfully powerful.

Well-functioning markets mean that you have known prices for known quantities of goods. I can exchange something I have for something I want. Markets are so fundamental to how the entire economy works that we often overlook just how extraordinary they really are.

The simplest way to facilitate transactions is for buyers and sellers to meet directly. Let's say I have money and the seller has bananas. I meet the seller, they tell me it's $5 per banana1, and I purchase 10 bananas.

It's a great start, but this basic matchmaking model breaks down pretty quickly. What if...

  • I want to buy many more bananas than the seller has in stock?
  • I want to buy the bananas at a different price?
  • I also want to sell bananas?
  • We both want to transact, but we're separated by time or space?

Our simple model won't work. Order books will.

Order books

Like markets generally, order books are relatively simple. Don't let that simplicity fool you. They're one of the greatest inventions of all time.

An order book is a record of purchase and sale interests by market participants. They're typically hosted by an exchange that is responsible for updating the order book and matching orders. Every entry has four key inputs:

  • The asset pair to be exchanged - dollars for bananas
  • The price expressed as the asset pair - $5 per banana
  • The direction of the order - I have dollars and I want bananas
  • The quantity willing to be exchanged at that price - I'll buy up to 10 bananas

We can flip all four of the examples to get the entries to sell bananas:

  • bananas for dollars
  • 0.2 bananas per dollar
  • I have bananas and I want dollars
  • I'll sell up to 10 bananas

The order book allows us to aggregate all of the buy and sell orders - regardless of price or quantity - in a single location. That's hugely powerful. It lets us know the quantity of a good we can purchase or sell at any point in time, a dynamic that becomes evident when we turn the order book into a graph.

The height of the curve shows you how much you could buy at a given price.

Here we have a market where I can buy and sell Litecoin (LTC) for USD. The y-axis indicates the quantity of LTC and the x-axis indicates price. The green represents all of the outstanding buy orders. The red represents all of the sell orders. The place where the two overlap is the current market price for LTC.

So what happens if I try to sell 909 LTC at the current market price? The price for LTC will fall! It's supply and demand. I'm quite literally adding LTC supply to the order book and removing the supply of dollars. The market price will shift to a new midpoint of $62.83. This trade is a market order - an order sent to the order book to be executed at whatever the best available price is at that moment.

All of the other orders on the order book are limit orders - only buy or sell below or above a specific price. When we talk about liquidity in financial markets, this is at the core of what we mean. How much of the good can I sell right now without the price moving too much?

Market orders use up available liquidity - they remove orders from the order book. Limit orders supply liquidity - they create new orders on the order book.

You can actually build entire businesses supplying liquidity to order books. These businesses - called market makers - buy when people want to sell and sell when people want to buy.

Market makers are critical to healthy, functioning markets. They're the middlemen that help bridge buyers and sellers. It's the same role played by importers who sit between goods manufactured abroad and the store you buy them from.

Making markets

Market makers' job is to take the opposite side of every trade - buy when market participants are selling, sell when they are buying. How can that be a profitable business?

Modern markets move very fast. Market makers exploit the very short-term price fluctuations to make money. They generally hold for no more than a few seconds and more often for a couple hundred milliseconds. Remember - they're just trying to make money as middlemen, not predict the longer-term changes in price.

There are many more parties involved but that’s for another letter.

In modern stock markets, market makers are regulated entities who are required to maintain two-sided limit orders - a buy and a sell - within a designated percentage range around the current market price. In return, market makers are given privileges including special access to the order book not allowed to most other market participants. It's a role mostly performed by high frequency trading firms. They compete to build ever faster systems that can both rapidly ingest new price information and send orders to the order book.

One of the major information inputs is the order book itself - all the trades that other market participants have posted. Exchanges that maintain order books and match trades jealously guard order book data. The cost to access order books is high and regularly increases. It's one of the reasons that professional traders have major advantages over retail.

A high frequency trading firm acting as a market maker might submit 100,000 orders a day. The firm might cancel 98% of them - removing them from the order book - before they're ever executed. The market maker is trading to exploit short-term price movements. As new information comes in, they reprice their orders accordingly.

This a law of large numbers business. The goal for a market maker isn't to make money on every single trade, but to make many small trades and make money 51%+ of the time. Jane Street, one of the largest and most successful market makers, transacted $17 trillion in 2020 and generated $1.6 billion in revenue. While that's a lot of revenue, it represents just a 0.009% margin.

While powerful, this is the Achilles heel of the order book model - market makers have to do a huge volume of trades to generate meaningful revenue.

When order books fail

If huge volumes of trades in a market aren't possible, market makers won't operate because they won't be able to generate enough revenue.

Huge volumes aren't possible in many markets. Take the market for shares of Schmitt Industries for example. They're a public company (ticker: SMIT), but the entire company is only worth $20 million. On an average day, about 35,000 shares trade hands. At their current $5 per share price, that's $175,000 of SMIT shares being bought and sold per day.

Jane Street probably can't be a profitable market maker in SMIT. If they tried with their 0.009% revenue margin, they'd make just $15.75 per day. It wouldn't justify the costs.

This creates problems for many markets. Liquidity doesn't improve linearly with market size, it improves step-wise. A big market may have 1000x the liquidity of a market just half its size. The liquidity acts as a lubricant in big markets - buyers can buy and sellers can sell without affecting the price too much. But smaller markets are left to struggle.

That is, until recently.

Everyone's a market maker!

There is tremendous innovating happening in cryptocurrency markets. For those of you readers less than enthusiastic about crypto, I ask of you to put those thoughts to the side momentarily. We're focused here on a new way to match buyers and sellers. Objecting to new mechanisms for match-making simply because you're not interested in what is being exchanged is a bit like preferring cars to airplanes because you don't like where airplanes travel to - it misses the point.

Cryptocurrency startups invented an entirely new way to create markets called an automated market maker (AMM). If you've heard the term Decentralized Finance - or DeFi for short - AMMs are at the heart of how it works.

AMMs flip the traditional market maker model on its head. In the existing market maker model, a single large firm acts as a middleman. AMMs are instead powered by liquidity pools that many people can contribute to. The AMM itself is a software program that uses the pool to buy assets that sellers are selling and sell assets that buyers are buying. The pool plus the software program replaces the traditional market maker firm.

Sitting underneath all of this is a blockchain. It makes this possible.

liquidity pool is a new term to describe the "pooled" assets that power the AMM, similar to how a fund manager "pools" investor assets to invest on their behalf. Just like with an order book, the pool will always contain at least two assets such as dollars and bananas.

The startups who developed AMMs faced real challenges to make them work as intended. The solutions to those challenges resulted in tradeoffs - AMMs are not a good fit for all markets. A deeper understanding of how AMMs work will allow us to better understand when AMMs are useful and when they fall short.

There were three critical challenges to solve for AMMs to work:

  • Who manages the pool?
  • The pool always needs to contain two assets - bananas and dollars. How do you prevent someone from buying all of the bananas or all of the dollars?
  • How do you incentivize many small contributors to all pool their assets?

We'll solve each challenge in turn.

Managing the liquidity pool

No one manages the pool. It's also just software.

This is part of the magic of blockchain. A program running on the blockchain, known as a smart contract, can do everything. It can hold onto contributors' assets and transact with other market participants. It can also return contributors' assets when they no longer want to participate in the pool. It replaces multiple roles in traditional markets including fund manager and custodian.

If the concept of a smart contract is new, I recommend watching this short Youtube video to get acquainted.

Keeping the pool balanced

The software prevents market participants from emptying the pool of one asset by dynamically managing the relative price of the assets in the pool based on supply and demand.

That's a mouthful.

What it means in practice is that as the bananas in the pool are purchased, the price goes up. The cost of the last banana in the pool is infinite - you can't buy it. The price-supply dynamic is typically achieved through a constant product AMM.

In a constant product AMM, the product of quantities of the two assets is always equal to a fixed constant. The equation looks as follows:

Uh oh. Math notation.

Each incremental asset we buy from the pool gets more expensive relative to the other asset. The reverse happens as we sell assets to the pool - they get cheaper relative to the other asset.

Imagine the two assets are bananas and dollars. As we purchase bananas from the pool, the supply of bananas decreases, and the price per banana increases. As we sell bananas to the pool, the supply increases, and the price per banana decreases.

We could flip the asset ratio on its head and express it as bananas per dollar. The dynamic would stay the same. As dollars become scarce in the pool, the bananas-per-dollar increase. As dollars become plentiful, the bananas-per-dollar decrease. The graph below displays how the incremental price change per banana purchased or sold to the pool.

Supply and demand at work!

You'll notice from the shape of the chart that the prices change exponentially, not linearly. The last banana in the pool quite literally costs an infinite number of dollars to purchase. Or, in reverse, the last dollar in the pool costs an infinite number of bananas. That stops buyers and sellers from emptying the pool.

Incentivizing Liquidity Pools

AMMs require liquidity pools full of assets to work. Those pools pay fees to incentivize market participants to contribute assets. That presents a new problem - how to generate fees.

Liquidity pools charge fees to the buyer or seller on every transaction. The fee is in addition to the price paid for the assets in the pool. Think of it similar to a sales tax - there's a price for the goods you're purchasing and then an additional fee.

The fees are collected by the liquidity pool and paid out to whoever contributes liquidity to the pool. Contributors are known as liquidity providers. If there are a lot of transactions with the pool, it can generate substantial fees.

How does contributing liquidity actually work? Let's start with a banana-dollar pool of 10 bananas and 50 dollars.

Let's say I want to add $20 worth of liquidity to the pool so I earn a cut of the fees. If I just try to add 20 dollars and no bananas, the price-per-banana will balloon from $5 per banana to $7 per banana. If someone can still purchase bananas elsewhere - outside the pool - for $5, they can arbitrage the two prices. They can buy the cheap $5 bananas and sell them to the pool until the price in the pool decreases from $7 back to $5. They'll pocket the profit at my expense.

Most of the time, when liquidity providers contribute assets to the pool, they keep the ratios of the two assets in the pool the same to prevent such arbitrage. To add $20 of value to the pool, I actually add 10 dollars and 2 bananas. That keeps the price at $5 per banana.

Once I add liquidity to the pool, I can collect fees. Fees are paid pro-rata, a fancy term that just means the fees are proportional to how much of the assets a liquidity provider contributed to the pool. If you added 10% of the assets, you get 10% of the fees.

While these fees can be paid out regularly, more often they're paid when the liquidity provider removes their liquidity from the pool. That makes the math easier and reduces transaction costs. When liquidity providers redeem their liquidity, they receive their proportional share of the fees and the assets in the pool.

Bringing it home

It's a lot of moving parts. In short:

  • Automated market makers (AMMs) are software programs running on blockchains.
  • They operate as middlemen between assets - they stand ready to buy what people are selling and sell what people are buying.
  • They're powered by liquidity pools - a collection of assets contributed by many small liquidity providers.
  • When AMMs transact with market participants, they exchange some of the assets in the pool for assets that the buyer or seller has.
  • The AMM keeps the product of the two assets in the liquidity pool constant. When a buyer purchases one of the assets from the pool (i.e. reduces the supply), the price of that asset goes up relative to the other asset in the pool.
  • The AMM collects a fee on every transaction. The fee is paid out to the liquidity providers.

The Power and Shortcomings of AMMs

Why are automated market makers so interesting?

It's the first at-scale mechanism to create a market maker in any market. There are far fewer constraints on how small the market can be. AMMs can operate profitably in markets much, much too small for traditional market-making firms to consider.

What this means is that there can be a market price - a price at which you can buy or sell - for any asset at all times. You can avoid the problem that many small markets encounter - sellers want a price too high for the buyers, buyers want a price too low for the sellers, and it's unprofitable to be a middleman to bridge the gap. AMMs are now that middleman. They solve a very real problem traditional order books simply can't.

The first real experiment with AMMs is happening right now in the cryptocurrency world. They allow people to trade thousands of different tokens. It would never be profitable for an exchange to maintain order books for every possible pair of tokens. Even if they did, it wouldn't be profitable to operate a market maker for most of the markets. AMMs fill the gap.

In the first 10 months of 2021 alone, AMMs handled over $1.1 trillion in transactions.

Decentralized trading platforms are powered by AMMs.

Like with traditional market makers, the market-making activity generated substantial revenue - over $4 billion in the same period.

This industry didn’t even exist in 2019.

Cryptocurrency startups allow anyone to click-button start a new AMM and liquidity pool for any pair of assets. A dollar stablecoin for Ether. Ether for MATIC. MATIC for LINK. LINK back to the dollar stablecoin. If you just want to trade and there's no pool for the two tokens you want to exchange, new smart contracts will string together multiple pools into a single transaction. Among other future uses, AMMs are a solution to a well-known problem in currency markets - how do I go between bespoke currency pairs like the Mexican Peso to the Thai Baht when there aren't liquid markets.

That doesn't mean that AMMs are a perfect solution for market making. They come with a major constraint.

Impermanent loss

Impermanent loss is the loss by the changing ratio of the assets in the liquidity pool. It's possibly the worst-named concept in finance.

Impermanent loss is easiest to understand by example. Let’s reset our banana-dollar pool back to 10 bananas and 50 dollars, $100 of value.

A bunch of market participants transact with the pool. We now want to redeem our assets from the pool. The end state of the pool when we redeem our assets is 13 bananas and 38.46 dollars.

At the pool price per banana of $3.21 ($38.46 / 13), my redemption includes $41.73 worth of bananas and 38.46 dollars. I put in $100 of value and got back out $80.19. The $19.81 difference is my impermanent loss.

The math of liquidity pools is that almost any change in the ratio between bananas and dollars in the pool will result in impermanent loss. I take a loss even when the price of bananas in the pool goes up because bananas have been purchased out of the pool. Even though the value of my assets is higher when I redeem, the value would have increased even more if I simply held onto my bananas rather than put them in the pool.

% lost is symmetrical with respect to price. A doubling price creates the same percentage loss as a halving. You can do the math.

There are two scenarios where I don't take an impermanent loss - when the price of both assets decreases as more liquidity providers join the pool and when the ratio stays the same. The latter is where the "impermanent" term stems from - if you leave your assets in the pool, the loss is only temporary until the ratio returns back to where it was when you originally joined.

The fees the AMM collects on every transaction help offset the loss. When I contribute liquidity to the pool, I'm hoping the fees more than offset the loss.

That creates a tradeoff between fees and impermanent loss. It's the fundamental constraint for AMMs.

  • Higher fees increase the fee-per-transaction
  • Higher fees also decrease the number of transactions
  • More volatile assets - ones where the prices change a lot - create larger impermanent losses

Each AMM tries to optimize the fee rate so that it is high enough to cover the impermanent losses but not so high that no one transacts. That optimization is one of the most active areas of innovation in cryptocurrencies today.

The Future of Market Making

We are still very, very early in understanding just how and where AMMs will be useful. As their designs improve, as we invent new ways to solve the fee-loss constraint, we'll find ever more uses for them.

Diving into the ongoing innovations is a full letter in and of itself. A quick highlight will give you a sense of the breadth of just how much experimenting is happening.

  • Uniswap V3 allows liquidity providers to specify the exact price ranges in which their liquidity will be used - only use the bananas and dollars I supply between $3 per banana and $7 per banana. The closest analogy to this is the limit order on order books. The crypto world calls it concentrated liquidity.
  • CrocSwap enables AMMs that use both concentrated liquidity and the "all prices" liquidity pools we explored at length.
  • Bancor provides impermanent loss insurance for the AMMs they host. Their liquidity pools have a novel structure where liquidity providers can put in just one of the two assets - just banana or just dollars.
  • Balancer enables AMMs with up to 8 assets in the liquidity pool.

For the time being, exchanges with traditional order books and traditional market makers reign supreme for most markets. The current designs for AMMs simply cannot compete with the efficiency and effectiveness of the existing providers and their approaches. AMMs dominate the long tail of smaller markets where order books and traditional market making fail.

New AMMs with new models for match-making will slowly but surely encroach on the traditional models. This isn't just idle speculation. Jane Street and Citadel, two of the largest traditional market makers, have both launched crypto teams in recent weeks. Some of their former employees figured it out first - CrocSwap's founder is formerly of Citadel and FTX's founder is formerly of Jane Street. The existing market makers see what's on the horizon and are making investments accordingly.

This is an area I will personally be paying very close attention to. We've seen an explosion of markets in recent years including trading cards, watches, shoes, and shares in startups. All of them suffer from a lack of effective middlemen. AMMs are a hugely promising solution and they're just getting started.

Cocktail Talk

  • Doing the hard work no one else wants to do can be a tremendous competitive advantage. Eddie Duszlak illustrates this brilliantly with his approach to investing in banks. Bank balance sheets are notoriously difficult to understand. The additional data you need to understand a bank's prospects is available but a real pain to aggregate. Duszlak's built an investing moat doing the hard work. (Verdad)
  • The Federal Reserve published their long-awaited paper on central bank digital currencies. While light on specifics, the authors critically included privacy considerations. A digital currency can unlock much good but not if it comes at the expense of a new surveillance state. Don't get your hopes up about anything happening immediately. Any new digital currencies will move at the pace of government - the industry has 120 days to provide comments. (Federal Reserve)
  • SoFi, a digital personal finance company, finally received approval to become a national bank. The approval highlights an important trend in the industry and challenges to doing so. Much of what fintech startups want to do requires a banking license. Expect more of them to try to become banks, but also expect many of them to fail. It cost SoFi $22 million to acquire a bank and then took a full year - and an additional $750 million in capital - to get regulatory approval. Few startups have the patience or funding to do the same. (Business Wire)
  • Don't put Nintendo Switch games in your mouth. As one unfortunate podcaster discovered, the game cartridges are coated in one of the most bitter substances known to humanity to prevent children from accidentally ingesting them. The video and write-up are an amusing insight into consumer safety. (Polygon)

Your Weekly Cocktail

A bastardization of a modern classic.

Uncultured Debonair

2.5oz Laphroaig 10 Year Single Malt Whisky
1.0oz Barrow’s Intense Ginger Liqueur
Lemon peel for garnish

Pour all of the ingredients into a mixing glass. Add ice until it comes up over the liquid. Stir for ~20 seconds until the glass is frosted, ~50 times. Strain the drink into a cocktail glass. Squeeze the lemon peel over the drink to express the oils and drop in.

Uncultured Debonair

First, an apology. Gary “gaz” Regan invented the original Debonair in the 1990s. It called for Speyside single malt scotch. With complete and utter disregard for geography and canon, I replaced it with Islay single malt. And not just any Islay, but one that used to print “Like kissing a mermaid that had BBQ for dinner” on the bottle. My apologies to gaz for bastardizing the cocktail that first opened the doors to using single malts in the modern cocktail canon.

But I have no ragrets. As raw and unsophisticated as this cocktail might be, it suits me perfectly well. The uncompromising peatiness from Laphroaig is just barely held in check by a ginger liqueur with equally brash boldness. You might say there’s no excuse for visiting Disneyland Paris, but I’m enjoying it all the same.



That banana inflation sneaks up fast.

Join 1000+ subscribers to get the inner workings of finance delivered straight to your inbox.