Cryptocurrency Markets and Quant Trading › Market Structure

Michael BrenndoerferJanuary 5, 202610 min read
Quantitative FinanceAll chapters
Part 13 of 15Machine Learning and Alternative Data
Chapter 72Cryptocurrency Markets and Quant Trading › Market Structure
Reading section 3 of 11 · Market Structure · 10 minSection 3 of 11 · 10 min

Book contents

Section 3 of 11 · 10 min read

Cryptocurrency Markets and Quant Trading › Market StructureOne section · Sections in this chapter3 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Cryptocurrency market structure differs fundamentally from the traditional exchange models we discussed in earlier chapters. Understanding these differences is essential for developing effective trading strategies.

Centralized Exchanges (CEX)

Centralized exchanges function similarly to traditional exchanges, maintaining order books and matching buyers with sellers. However, there are critical differences:

  • Custodial model: When you deposit assets on a centralized exchange, you transfer ownership of those assets to the exchange. The exchange maintains an internal ledger of your balance, and you must trust them to honor withdrawals. This creates counterparty risk that simply does not exist when trading equities through a regulated broker.
  • Global fragmentation: Unlike equities, where a single exchange typically dominates trading in each stock, cryptocurrency trading is fragmented across hundreds of exchanges worldwide. This fragmentation creates arbitrage opportunities but also complicates execution.
  • Variable fee structures: Exchange fees typically follow a maker-taker model, with fees ranging from 0.01% to 0.5% depending on the exchange and trading volume. This is significantly higher than equity markets, where institutional traders might pay fractions of a basis point.

Major centralized exchanges include Binance (the largest by volume), Coinbase (the most prominent US-regulated exchange), and Kraken. Each exchange has different trading pairs, fee structures, and liquidity profiles.

Decentralized Exchanges (DEX)

Decentralized exchanges represent a fundamentally different approach to trading. Instead of a central order book, most DEXs use automated market makers (AMMs) that provide liquidity through smart contracts.

The concept of an automated market maker emerges from a simple but powerful question: what if we could replace human market makers with mathematical formulas? In traditional markets, market makers are sophisticated firms that continuously quote bid and ask prices, managing their inventory and adjusting quotes based on market conditions. An AMM encodes this behavior into an immutable smart contract, removing the need for human intermediaries entirely. The mathematical formula determines prices automatically based on the current state of the liquidity pool, and anyone can trade against this formula at any time.

Automated Market Maker (AMM)

An automated market maker is a smart contract that holds reserves of two or more tokens and allows traders to swap between them at prices determined by a mathematical formula. The most common is the constant product formula:

x⋅y=kx \cdot y = k

where:

  • xx: quantity of the first token
  • yy: quantity of the second token
  • kk: invariant constant

This ensures that as one token is bought, its price increases automatically.

The elegance of this formula lies in its simplicity and self-correcting nature. The product of the two reserves must remain constant before and after every trade (ignoring fees for the moment). This constraint creates a hyperbolic relationship between the reserves: as one decreases, the other must increase to maintain the constant. The result is a smooth, continuous pricing curve that never reaches zero for either asset, meaning the pool can always quote a price, albeit at increasingly unfavorable rates for large trades. This constant availability of liquidity, even in extreme market conditions, represents a fundamental departure from order-book markets where liquidity can completely disappear during stress.

The AMM pricing mechanism creates unique dynamics derived from the constant product formula x⋅y=kx \cdot y = k. To understand how prices emerge from this simple equation, let us walk through the mechanics step by step. When you want to swap token X for token Y, you add Δx\Delta x units of X to the pool. The pool's X reserve increases to x+Δxx + \Delta x, but the constant product constraint demands that kk remain unchanged. This means the Y reserve must decrease to compensate. Solving algebraically, the new Y reserve must equal y′=k/(x+Δx)y' = k/(x+\Delta x), and you receive the difference between the old and new Y reserves.

The price impact measures the percentage deviation of the effective execution price PeffP_{\text{eff}} from the spot price PspotP_{\text{spot}}. We derive this by first calculating the amount of tokens received Δy\Delta y (based on the constant product k=xyk = xy), then comparing the effective price to the spot price. This derivation reveals why large trades face increasingly unfavorable prices, a phenomenon that will shape our understanding of execution costs in decentralized markets:

Δy=y−xyx+Δx=y(1−xx+Δx)=yΔxx+ΔxPeff=ΔyΔx=yx+ΔxPrice Impact=Pspot−PeffPspot=y/x−y/(x+Δx)y/x=1−xx+Δx=Δxx+Δx\begin{aligned} \Delta y &= y - \frac{xy}{x+\Delta x} = y \left(1 - \frac{x}{x+\Delta x}\right) = y \frac{\Delta x}{x+\Delta x} \\ P_{\text{eff}} &= \frac{\Delta y}{\Delta x} = \frac{y}{x+\Delta x} \\ \text{Price Impact} &= \frac{P_{\text{spot}} - P_{\text{eff}}}{P_{\text{spot}}} \\ &= \frac{y/x - y/(x+\Delta x)}{y/x} \\ &= 1 - \frac{x}{x+\Delta x} \\ &= \frac{\Delta x}{x + \Delta x} \end{aligned}

where:

  • Δx\Delta x: the trade size (amount of token being sold)
  • xx: the current reserve of the token being sold in the pool
  • yy: the reserve of the other token in the pool
  • PspotP_{\text{spot}}: the theoretical market price (y/xy/x) before the trade
  • PeffP_{\text{eff}}: the realized average price of the trade

The final expression Δxx+Δx\frac{\Delta x}{x + \Delta x} provides a remarkably intuitive result: the price impact equals your trade size as a fraction of the post-trade reserve. A trade of 10 units into a pool with 100 units would face approximately 9% price impact (10/110), while a trade of 1 unit would face only about 1% impact (1/101). This formula demonstrates that execution price worsens non-linearly as trade size increases relative to liquidity. The relationship is concave, meaning the first units traded suffer relatively little impact, but marginal impact accelerates as the trade size grows. This means large trades face significant price impact, and the market has no concept of a "best bid" or "best offer" in the traditional sense. The following function constant_product_amm implements this pricing logic, calculating the new reserves resulting from a trade and deriving the price impact by comparing the effective execution price to the initial spot price:

In[4]:
Code
def constant_product_amm(reserve_x, reserve_y, delta_x):
    """
    Simulate a trade on a constant product AMM.

    Parameters:
    -----------
    reserve_x : float
        Reserve of token X (token being sold)
    reserve_y : float
        Reserve of token Y (token being bought)
    delta_x : float
        Amount of token X to sell

    Returns:
    --------
    tuple : (amount_y_received, price_impact, effective_price)
    """
    k = reserve_x * reserve_y
    new_reserve_x = reserve_x + delta_x
    new_reserve_y = k / new_reserve_x

    amount_y_received = reserve_y - new_reserve_y

    # Spot price before trade
    spot_price = reserve_y / reserve_x

    # Effective price achieved
    effective_price = amount_y_received / delta_x

    # Price impact as percentage
    price_impact = (spot_price - effective_price) / spot_price * 100

    return amount_y_received, price_impact, effective_price


# Example: ETH/USDC pool with $10M liquidity each side
reserve_eth = 5000  # ETH
reserve_usdc = 10_000_000  # USDC
spot_price = reserve_usdc / reserve_eth  # $2000 per ETH

# Simulate trades of different sizes
trade_sizes = [1, 10, 50, 100, 250, 500]
results = []

for size in trade_sizes:
    usdc_received, impact, eff_price = constant_product_amm(
        reserve_eth, reserve_usdc, size
    )
    results.append(
        {
            "ETH Sold": size,
            "USDC Received": usdc_received,
            "Effective Price": eff_price,
            "Price Impact (%)": impact,
        }
    )

df_amm = pd.DataFrame(results)
Out[5]:
Console
AMM Price Impact Analysis
============================================================
Pool: 5,000 ETH / 10,000,000 USDC
Spot Price: $2,000.00 per ETH

 ETH Sold  USDC Received  Effective Price  Price Impact (%)
        1       1,999.60         1,999.60              0.02
       10      19,960.08         1,996.01              0.20
       50      99,009.90         1,980.20              0.99
      100     196,078.43         1,960.78              1.96
      250     476,190.48         1,904.76              4.76
      500     909,090.91         1,818.18              9.09

Nonlinear price impact makes AMM execution costs highly sensitive to order size. A 100 ETH sell order in this pool faces approximately 2% price impact, compared to the sub-basis-point impact you might see for equivalent notional in liquid equity markets. This difference arises because AMM liquidity is passive and formulaic, whereas order-book liquidity in traditional markets reflects the active decisions of many sophisticated participants who compete to provide tight spreads. For you, accustomed to equity markets, this magnitude of execution cost requires a fundamental rethinking of strategy capacity and trade sizing.

The mechanics of the constant product formula are best understood visually. The hyperbola x⋅y=kx \cdot y = k defines all possible reserve states. A trade moves the pool's state along this curve. The difference between the slope of the curve at the starting point (spot price) and the slope of the chord connecting the start and end points (effective price) represents the slippage or price impact.

Out[6]:
Visualization
Hyperbolic constant-product curve with start and end reserve states, a highlighted trade path, a dashed chord between the states, and shading between the curve and chord.
Constant-product AMM mechanics. Selling 1,500 ETH moves the simulated pool along the $xy=k$ curve from 5,000 to 6,500 ETH in reserve. The dashed chord represents the trade's average execution rate; the shaded gap from the nonlinear curve visualizes slippage relative to that average.

Key Parameters

The key parameters for the Constant Product AMM are:

  • x: Reserve of the first token (e.g., ETH). High reserves reduce price impact because the same trade size represents a smaller percentage of the pool.
  • y: Reserve of the second token (e.g., USDC). The ratio y/x determines the spot price at which infinitesimally small trades would execute.
  • k: The constant product invariant (x⋅yx \cdot y). This remains fixed during a trade (ignoring fees), serving as the fundamental constraint that generates the pricing curve.
  • Δx\Delta x: The trade size. Larger trade sizes relative to reserves cause exponential price impact because each marginal unit must be purchased at an increasingly unfavorable price along the hyperbolic curve.

24/7 Trading and Global Access

Perhaps the most operationally significant difference for you is that cryptocurrency markets never close. Trading occurs 24 hours a day, 7 days a week, 365 days a year. This creates challenges across multiple dimensions:

  • Infrastructure requirements: Systems must run continuously without maintenance windows. Unlike equity trading where you can perform updates over weekends, crypto systems require redundancy and hot-swappable components.
  • Staffing and monitoring: Human oversight cannot follow the markets continuously. This places greater emphasis on automated risk controls and alerting systems.
  • Volatility timing: Some of the largest price moves occur during what would be "off-hours" in traditional finance, often during weekend periods when liquidity is thinner.
  • Funding and margin: Positions must be monitored for margin requirements at all times, not just during market hours.