Decentralized Exchanges

Ian Robinson
Chief Investment Officer
August 16, 2023

At the beginning of 2019, Ken Griffin purchased what was on record to be the most expensive home ever purchased in the United States. Coming in at an astounding $238 million, the home is situated on one of New York City’s most iconic streets alongside Central Park.

Who’s Ken Griffin?

Ken Griffin is the founder, CEO, and Co-CIO of Citadel LLC, one of the largest multi-national hedge funds in the world. Citadel is also the largest market maker in the United States.

What’s a market maker?

Well, it’s an individual, but usually, an entity or company, whose job is to provide liquidity to the market so that buyers and sellers can come together and trade financial products at ease without much difference in the bid-ask prices. Chances are when you want to buy/sell 100 shares of Apple, Inc. ($AAPL), there isn’t someone immediately on the other side looking to do the opposite. This is where market makers come in advantageously.

What are bid-ask prices?

The bid price is the price that an investor is willing to pay for a certain security (stock) while the ask price is the price that the seller is willing to sell the certain security (stock) for.

The difference between these two prices is most commonly known as the bid-ask spread. You can think of this spread (difference in price) as the kickback that the brokerage and market makers receive for providing their respective services.

Citadel LLC raked in $6.7 billion of revenue from market-making alone in 2020.

You can think of what they do as whole-selling. They purchase large amounts of popular securities directly from the exchanges where they are listed at a discounted price (bid) and sell them to retailer investors like you and I at a slight premium (ask). This is why when you place an order with your brokerage, it almost never goes directly to the exchange but rather ends up as a private sale e.g. retail investor to Citadel and vice versa.

Citadel works closely with popular brokerages such as Charles Schwab, TD Ameritrade, and most controversial, Robinhood in order to create the perfect money-making machine. More volatility means more trades which means more kickbacks for both the brokerage and market maker(s).

To clarify, the reason why brokerages such as Robinhood, and now the rest of the industry, are able to provide “commission-free” trades is because of the kickback that they are getting by routing retail orders through these market makers. These market makers are then of course providing part of the revenue that they get from these bid-ask spreads to these brokerages.

The reason why I went over a brief lesson on how market makers work is that in order to understand what comes next, it helps to have a bit of knowledge on how the traditional finance system works with regards to buying and selling securities, at least on the retail side.

If you’ve ever purchased cryptocurrency, chances are you have done so on a centralized exchange. Popular exchanges include Coinbase, Binance, Kraken, etc. These exchanges work the same way as there are market makers in play that help facilitate the exchange of various cryptocurrencies.

However, there exists a world outside of these third-party exchanges. A world where individuals like you and me can become market makers ourselves and capture revenue in the same way that big players such as Citadel and other market makers do in the traditional markets.

Enter: Decentralized Finance (Defi)

Sometimes I like to think that the term “Defi” stands more for defy, as in defying the current traditional financial system. This is because, in Defi, we are able to have efficient markets without the need for third parties such as those discussed at the beginning of this substack. The beauty is all in the brilliant code that developers have integrated into these protocols that exist in Defi. Think of brokerages as protocols when in Defi land.

Without getting too deep into the details on how all of this code works (quite frankly I don’t even fully understand how all the code works), I am going to go over the basic formula that allows these types of protocols to exist.

First, the name of this formula is called the Constant Product Automated Market Maker, and very basically it uses the formula X * Y = K where X and Y are the amounts of two different types of assets being traded and K is a constant that never changes (duh!).

Just how Citadel purchases (sells) different types of securities so that they’re ready to be sold (bought) via retail investors (Security A to $USD and vice versa), individuals who contribute to these Automated Market Makers (AMM’s) pool together two different types of frequently traded tokens i.e. Ethereum and USDC (ETH/USDC) and collect trading fees whenever a buyer (seller) utilizes the protocol and this specific liquidity pool.


Let’s say a Defi user comes along and hears about a brand new protocol that offers its users the ability to create liquidity pools so that they can collect fees whenever users trade the two tokens pooled by this user (and eventually many other users as well). They decide to provide:

X: 5,000 USDC ($5,000)

Y: 1.79 ETH ($5,000)

K: 5,000 * 5,000 = 25,000,000

Remember, when liquidity is being provided to these pools, an equal amount of both tokens in $USD terms has to be provided each time. Also, we now have our constant K uniquely identified for this liquidity pool.

The depositor of these tokens will now receive 25,000,000 LP tokens as a receipt that can be redeemable at any time in the future. Now, whenever someone uses this protocol and this pair specifically i.e. wants to trade USDC for ETH or ETH for USDC, the liquidity provider (you) will receive 0.03% of the total trade value. If someone swapped 1000 USDC for $1000 worth of ETH, the pool would accrue $0.30 worth of value (0.03% * $1000). This value would be split into each pair i.e. $0.15 of USDC and $0.15 of ETH. When the liquidity provider decides to remove liquidity the LP tokens will be burned and they will receive $5,000.15 worth of USDC and $5,000.15 worth of ETH.

This is an extremely basic example of how Automatic Market Makers and Liquidity Providing works. There are many more moving parts to this that would take a few more posts to fully explain. My goal was to provide a basic example of how value is accrued in decentralized finance via automatic market makers i.e. the code being the middle man whilst the fees go to you and me rather than centralized entities such as Citadel.

But wait… How are the prices of these assets (tokens) determined?

Remember the constant K in our equation? This is what helps determine the prices of our pooled assets. Say a user comes along and wants to swap $100 of USDC for $100 of ETH. Some quick math:

The price of ETH at the time of this writing is currently hovering around $2,800. Now, the algorithm will need to figure out how much ETH to give to the user.

There is now $5,100 worth of USDC (5,100 USDC) and still $5,000 (1.79 ETH) worth of ETH.

If we divide 25,000,000 (K) / $5,100 we get: $4,901.96

$4,901.96 is the amount of ETH that should be left in the pool once this transaction is settled.

There is currently $5,000 worth of ETH, so we need to give the user the difference ($5,000 — $4,901.96) of $98.04.

The reason why the user didn’t receive $100 of ETH but rather a bit less was because as their $100 bought more and more of ETH, the price of ETH started to rise.

We need to keep $5000 worth of ETH / $5,000 worth of USDC as constants that need to remain in the liquidity pool.

Since there is now $5,100 worth of USDC (5,100 USDC) in the pool, we can divide $5,100/1.79 and arrive at a new ETH price of $2,849.16.

We can do the same to calculate the new USDC price by dividing $4,901.96/5,000 to get $0.9803 as the new price of USDC.

If you noticed, there is a slight problem. USDC, a stablecoin that is supposed to be pegged to USD is worth $0.9803 and not $1.00. This is where arbitrators (investors who take advtange of differences in prices across markets) step in to make pools more efficient (and make a profit).

In another pool, or even on a centralized exchange such as coinbase, ETH could still be trading around that $2,800 level. Remember, the only reason why ETH skyrocketed in this pool is because the $100 purchase had a large price impact on the assets in the pool (low liquidity). What an arbitrator would do is purchase ETH at the lower price and then swap it for USDC in this pool. They would purchase $100 worth of ETH somehwere else for $2,800 and then sell it for $2,849.16 to this pool.

$100 / $2,800 = 0.0357 ETH

0.0357 ETH * $2,849.16 = $101.76

The arbitrator comes out with a 1.76% profit — trading fees (0.03%) = 1.73%.

This would bring the peg closer to $1.00 as well as the ETH price closer to the market average of $2,800 via the same process illustrated above swapping ETH for USDC instead of USDC for ETH. Now, it’s time to talk about impermanent loss.

What is impermanent loss?

One of the downsides of becoming a liquidity provider is your risk of impermanent loss. Impermanent loss occurs whenever a pool becomes unbalanced as we illustrated earlier. As there always has to be equal amounts of value on both sides of the pool, a lot of upside can be lost due to this phenomenom. However, your downside can be protected as well.

For example, if you are providing liquidity to the ETH/USDC pool, you are combining a volatile asset with a stable asset (well, stable most of the time). You provide $5,000 worth of USDC and $5,000 worth of ETH. Great, now you are collecting fees. However, these assets are still subejct to price changes (at least ETH is). Were ETH to appreciate by 20%, your ETH that you initially provided would be worth $5,100 ($5,000 + 20%), right? Not so fast. What about about your USDC side? Remember, things always have to be in equillibrium. You’re left with $5,100 worth of ETH but only $5,000 worth of USDC. You still captured unrealized gains but they were muted thanks to the weight of the other asset that your ETH is pooled with. Were you have just held $5,000 worth of USDC and $5,000 worth of ETH outright, you’d be better off. This is because as the price of ETH began to appreciate, it was also being sold off to compensate for the other token in the same pool. So you missed part of the upside. In this example you end up with a total value of ~$10,096.45 instead of $10,100.00. The exact math behind calcualting impermanent loss is quite tricky but I hope this illustration can give you somewhat an idea.

The amount of information that was covered from this substack does not even come close to encompassing what their is to learn about Automated Market Makers and the rest of Decetralzied Finance. Money markets, permissionless lending, under-collaterizlied loans, venture capital for everyone, these products are here and are growing exponentially. My goal was to give you a glimpse of how traditional finance is being disrupted before our very eyes. There is still so much progress that needs to be made before even thinking that these new financial systems could be adopted by the masses. However, traditional finance will continue to be put in check and then eventually check-mate.