Exercises: Liquidity Provision and Market Making

Part A: Foundations of Market Making (Exercises 1–6)

Exercise 1: Spread Decomposition

A prediction market has the following observed characteristics: - Quoted bid-ask spread: $0.06 - Estimated adverse selection component: 60% of the spread - Estimated inventory component: 25% of the spread - Estimated operational component: 15% of the spread

(a) Compute the dollar value of each spread component.

(b) If the fraction of informed traders increases from 20% to 35%, and the adverse selection component scales linearly with $\alpha$, what is the new total spread (assuming other components remain constant)?

(c) If the platform introduces a maker fee rebate of $0.005 per contract, how does this affect the effective operational cost? What is the new equilibrium spread?

Exercise 2: Realized Spread Calculation

Given the following sequence of trades in a binary prediction market (mid-price at time of each trade and 5 minutes later):

Trade # Side Price Mid at Trade Mid After 5 min
1 Buy 0.520 0.500 0.515
2 Sell 0.480 0.500 0.490
3 Buy 0.530 0.510 0.525
4 Buy 0.535 0.520 0.540
5 Sell 0.475 0.505 0.495

(a) Compute the realized spread for each trade.

(b) Compute the average realized spread for buy trades and sell trades separately.

(c) Which trades show evidence of adverse selection? Explain your reasoning.

Exercise 3: Market Maker P&L

A market maker posts a bid at $0.47$ and an ask at $0.53$ for a binary contract. Over the course of a day, the following fills occur:

  • Buy fill: 100 contracts at $0.47$
  • Sell fill: 80 contracts at $0.53$
  • Buy fill: 50 contracts at $0.47$
  • Sell fill: 120 contracts at $0.53$

The market resolves with the event occurring (contract pays $1.00$).

(a) What is the market maker's ending inventory?

(b) Compute the market maker's total P&L from spread capture (ignoring resolution).

(c) Compute the market maker's total P&L including resolution.

(d) Was the market maker's net position beneficial or detrimental in this case?

Exercise 4: Bid-Ask Spread as a Function of Price

Using the Glosten-Milgrom framework with $\alpha = 0.25$:

(a) Compute the bid, ask, and spread when $\mu = 0.50$.

(b) Compute the bid, ask, and spread when $\mu = 0.20$.

(c) Compute the bid, ask, and spread when $\mu = 0.80$.

(d) Plot the spread as a function of $\mu$ for $\mu \in [0.05, 0.95]$ and verify that it is maximized near $\mu = 0.50$.

Exercise 5: Trader Classification

In a market with $\alpha = 0.30$, the market maker starts with $\mu = 0.50$. The following trade sequence is observed: Buy, Buy, Buy, Sell, Buy, Buy.

(a) Using Glosten-Milgrom updating, compute $\mu$ after each trade.

(b) What is the market maker's posterior probability after all six trades?

(c) If the market resolves "Yes," which trades were likely from informed traders and which from uninformed? Justify using Bayesian reasoning.

Exercise 6: Break-Even Analysis

A market maker in a binary prediction market faces: - Adverse selection parameter: $\alpha = 0.20$ - Operational cost per trade: $c = \$0.002$ - Average trade size: 10 contracts - Target: break-even on average

(a) Using the zero-profit condition from the Glosten-Milgrom model, what is the minimum spread the market maker must charge at $\mu = 0.50$?

(b) If the platform subsidizes $\$0.005$ per contract traded (both sides), what is the new minimum spread?

(c) At what value of $\alpha$ does market making become unprofitable even with the subsidy, assuming the maximum spread the market will tolerate is $0.10$?


Part B: Inventory Management (Exercises 7–12)

Exercise 7: Quote Skewing

A market maker has the following parameters: - Fair value: $\hat{p} = 0.55$ - Base spread: $s = 0.04$ - Inventory: $q = +200$ contracts (long) - Skew coefficient: $\kappa = 0.0001$

(a) Compute the linear skew $\Delta_{\text{skew}}$.

(b) Compute the skewed bid and ask prices.

(c) By how much does the skew shift the mid-point of the quotes relative to the fair value?

(d) If $Q_{\max} = 500$ and $\beta = 2.0$, compute the nonlinear skew and compare with the linear skew.

Exercise 8: Avellaneda-Stoikov Quotes

A market maker uses the Avellaneda-Stoikov framework with: - $\gamma = 0.05$ (risk aversion) - $\sigma = 0.15$ (price volatility) - $T - t = 5$ days (time to resolution) - Fair value: $m = 0.50$ - Base spread: $s^* = 0.03$

Compute the bid and ask quotes for the following inventory levels:

(a) $q = 0$

(b) $q = +100$

(c) $q = -100$

(d) $q = +500$

(e) At what inventory level does the bid price reach $0$? What does this mean practically?

Exercise 9: Inventory Simulation

Write a simulation where a market maker with linear skewing ($\kappa = 0.0002$) faces a random walk order flow: each period, with probability 0.5 a buy arrives and with probability 0.5 a sell arrives. Trade size is uniformly distributed in $\{1, 2, ..., 10\}$.

(a) Run the simulation for 1,000 trades. Plot the inventory path over time.

(b) Compare the inventory variance with and without skewing.

(c) Compare the P&L distributions with and without skewing.

(d) Find the optimal $\kappa$ that maximizes the Sharpe ratio of P&L over 100 simulation runs.

Exercise 10: Position Limits

A market maker has a maximum inventory of $Q_{\max} = 300$ contracts and faces asymmetric order flow: 60% of arrivals are buys and 40% are sells.

(a) Without any skewing, how long (in number of trades) does it take on average for the market maker to hit the position limit?

(b) With linear skewing ($\kappa = 0.0003$), simulate the process and determine how much longer it takes on average.

(c) When the position limit is hit, the market maker withdraws the bid. What is the expected time until a sell fills and the market maker can resume two-sided quoting?

Exercise 11: Multi-Period Inventory Optimization

Consider a market maker who will provide liquidity for exactly $T = 10$ periods. In each period, the market maker chooses a spread $s_t$ and the probability of a fill on each side is $\lambda(s_t) = 0.5 \cdot e^{-10 \cdot s_t}$. If filled, the trade is for 1 contract.

(a) Write down the dynamic programming formulation for the market maker's problem, where the state is $(t, q_t)$ and the reward is expected terminal P&L minus a risk penalty $\gamma \cdot q_T^2$.

(b) Solve the problem numerically for $\gamma = 0.01$ and plot the optimal spread as a function of $(t, q_t)$.

(c) How does the optimal spread change as $t$ approaches $T$? Explain intuitively.

Exercise 12: Inventory Hedging with Correlated Markets

A market maker is long 200 contracts in "Candidate A wins state X" (priced at 0.60) and can trade in "Candidate A wins the national election" (priced at 0.55). The correlation between the two outcomes is $\rho = 0.70$.

(a) How many contracts of the national market should the market maker sell to minimize portfolio variance?

(b) What is the variance reduction from this hedge?

(c) If the national market has a bid-ask spread of 0.03, what is the cost of the hedge? Is it worth it?


Part C: Adverse Selection (Exercises 13–18)

Exercise 13: Glosten-Milgrom with Noisy Signals

Extend the Glosten-Milgrom model to handle informed traders with noisy signals. The signal quality is $\theta = 0.80$ (i.e., the informed trader's signal is correct 80% of the time).

(a) Derive the ask price for $\mu = 0.50$ and $\alpha = 0.30$.

(b) Compare the spread with the noiseless case ($\theta = 1.0$).

(c) Plot the spread as a function of $\theta$ for $\theta \in [0.5, 1.0]$.

Exercise 14: VPIN Computation

Given the following trade sequence (each trade is 1 unit), classify each as buy or sell based on the Lee-Ready algorithm (compare trade price to mid):

Trade Price Mid Classification
1 0.510 0.505 ?
2 0.495 0.505 ?
3 0.515 0.510 ?
4 0.520 0.512 ?
5 0.500 0.515 ?
6 0.505 0.510 ?
7 0.525 0.515 ?
8 0.490 0.510 ?
9 0.530 0.520 ?
10 0.485 0.515 ?

(a) Classify each trade.

(b) Compute VPIN using bucket size = 5 trades.

(c) Is the VPIN consistent with high or low adverse selection?

Exercise 15: Kyle's Lambda Estimation

A market maker observes the following data over 20 trades:

Trade Signed Order Flow Mid Change
1 +5 +0.008
2 -3 -0.004
3 +8 +0.015
4 +2 +0.001
5 -10 -0.018
6 +4 +0.006
7 -6 -0.010
8 +1 +0.003
9 -7 -0.011
10 +9 +0.014

(a) Estimate Kyle's $\lambda$ using OLS regression.

(b) Compute the $R^2$ of the regression. Is order flow a strong predictor of price changes?

(c) If the market maker widens the spread by $2\lambda$ per unit of expected order flow, what is the new spread for an expected order flow of 5 contracts?

Exercise 16: Toxic Flow Identification

A market maker notices that their realized spread is $-0.005$ (negative) over the last 100 trades. The quoted spread is $0.04$.

(a) What does a negative realized spread imply about the information content of the trades?

(b) Estimate the fraction of informed trading ($\alpha$) given that the expected realized spread equals $(1 - 2\alpha) \cdot s/2$ where $s$ is the quoted spread.

(c) The market maker decides to widen the spread to $0.06$. If $\alpha$ remains constant, what will the new expected realized spread be?

(d) At what spread does the expected realized spread become zero?

Exercise 17: Time-of-Day Adverse Selection

A market maker on a political prediction market observes the following pattern:

Time Window Avg Realized Spread Volume VPIN
00:00-06:00 +0.015 Low 0.35
06:00-10:00 +0.008 Medium 0.45
10:00-14:00 -0.003 High 0.62
14:00-18:00 +0.005 High 0.50
18:00-00:00 -0.008 Medium 0.68

(a) During which time windows is the market maker facing adverse selection?

(b) Propose a time-varying spread schedule that would be profitable in each window.

(c) If the market maker could only quote during two time windows, which should they choose? Why?

Exercise 18: Adverse Selection and Event Proximity

As a prediction market approaches its resolution event, theorize about how adverse selection changes:

(a) Argue why adverse selection should increase as the event approaches. (Hint: Who has information about the outcome close to the event?)

(b) Argue why adverse selection might decrease in some cases. (Hint: What if the outcome becomes increasingly obvious?)

(c) Sketch a model where the adverse selection parameter $\alpha(t)$ is a function of time-to-resolution. Propose a functional form and justify it.

(d) How should a market maker adjust their spread schedule as resolution approaches?


Part D: Subsidized Market Making and AMMs (Exercises 19–24)

Exercise 19: LMSR Properties

Consider an LMSR with $b = 50$ for a binary market.

(a) Compute the current prices when $\mathbf{q} = (0, 0)$.

(b) What is the cost to buy 10 shares of outcome 1, starting from $\mathbf{q} = (0, 0)$?

(c) After the purchase in (b), what are the new prices?

(d) What is the maximum loss for the platform (the subsidy)?

(e) If the market resolves to outcome 1, and the final share vector is $\mathbf{q} = (100, 20)$, compute the platform's actual loss.

Exercise 20: Optimal Liquidity Parameter

A platform designer wants to choose the LMSR liquidity parameter $b$ for a binary market. They face the following trade-off: - Higher $b$ means tighter spreads (more attractive to traders) but higher maximum loss. - They estimate that trading volume scales as $V(b) = 1000 \cdot (1 - e^{-b/50})$. - The platform earns a fee of 1% on volume.

(a) Write the platform's profit as a function of $b$: $\Pi(b) = 0.01 \cdot V(b) - b \cdot \ln(2)$.

(b) Find the $b$ that maximizes expected profit.

(c) Plot the profit function for $b \in [1, 200]$.

(d) How does the optimal $b$ change if the fee is increased to 2%?

Exercise 21: Impermanent Loss in Prediction Markets

An LP deposits equal value into a constant-product AMM for a binary prediction market when the price is $p_0 = 0.50$.

(a) Compute the impermanent loss when the price moves to $p = 0.70$.

(b) Compute the impermanent loss at resolution if the event occurs ($p = 1.0$).

(c) If the LP earns trading fees of $0.5\%$ on total volume of $\$10,000$ during the market's lifetime, and they deposited $\$100$, is liquidity provision profitable? Assume the event occurred.

(d) What minimum total volume is needed for the LP to break even?

Exercise 22: Concentrated Liquidity Strategy

An LP provides concentrated liquidity in the range $[0.40, 0.60]$ for a prediction market currently at $p = 0.50$.

(a) Compared to full-range liquidity, how much more capital-efficient is the concentrated position?

(b) If the price moves to $p = 0.35$ (outside the range), what happens to the LP's position?

(c) Design a "rebalancing" strategy where the LP moves their range to track the current price. How often should they rebalance if the price moves with standard deviation $\sigma = 0.05$ per day?

Exercise 23: Subsidy Budget Allocation

A platform has a total subsidy budget of $\$10,000$ to allocate across 5 markets with the following characteristics:

Market Expected Volume Current Spread Information Value
A High 0.03 Medium
B Low 0.15 High
C Medium 0.06 Low
D Very Low 0.25 Very High
E Medium 0.08 Medium

(a) Argue for allocating subsidies proportional to information value divided by current spread.

(b) Argue for allocating subsidies proportional to the spread gap (current spread minus target spread) times expected volume.

(c) Propose your own allocation and justify it quantitatively.

Exercise 24: AMM vs. Order Book Market Making

Compare the economics of providing liquidity as an AMM LP vs. as an order book market maker for the same prediction market.

(a) List three advantages of AMM liquidity provision over order book market making.

(b) List three advantages of order book market making over AMM liquidity provision.

(c) In what market conditions would you prefer each approach? Consider factors like volume, adverse selection, time to resolution, and competition.

(d) Some platforms combine both (e.g., an AMM as a backstop with an order book overlay). Describe how this hybrid would work and its advantages.


Part E: Advanced Topics and Integration (Exercises 25–30)

Exercise 25: Multi-Market Portfolio Optimization

A market maker provides liquidity in 3 correlated prediction markets with the following characteristics:

Market Fair Value Inventory Volatility
M1 0.60 +100 0.15
M2 0.45 -50 0.20
M3 0.70 +30 0.12

Correlation matrix: $$ \rho = \begin{pmatrix} 1.0 & 0.5 & 0.3 \\ 0.5 & 1.0 & 0.2 \\ 0.3 & 0.2 & 1.0 \end{pmatrix} $$

(a) Compute the portfolio variance.

(b) What trades would minimally reduce portfolio variance?

(c) If the market maker must reduce portfolio standard deviation by 30%, what is the minimum trading cost (assuming spreads of 0.04 in each market)?

Exercise 26: Building a Complete Bot

Design and implement a market-making bot that: - Operates on a simulated order book - Uses Glosten-Milgrom for fair value estimation - Implements Avellaneda-Stoikov inventory management - Tracks adverse selection metrics in real-time - Has configurable risk limits

(a) Implement the bot (see example code in the chapter).

(b) Simulate 10,000 trades with 20% informed traders. Report the P&L distribution.

(c) Vary the informed fraction from 10% to 50% and plot the relationship between $\alpha$ and expected P&L.

(d) Find the breakeven $\alpha$ for your bot's spread setting.

Exercise 27: Regime Detection

Market conditions change over time. Implement a regime detection system that identifies periods of high and low adverse selection.

(a) Use a Hidden Markov Model with two states (low-AS and high-AS) and emission distributions based on realized spreads.

(b) Train the model on simulated data with known regime switches.

(c) Implement a strategy that widens spreads by 50% when the model detects the high-AS regime.

(d) Compare the P&L of the regime-switching strategy vs. a fixed-spread strategy.

Exercise 28: Market Making Economics Paper

Write a 2-page analysis of the economics of market making in a specific real-world prediction market (e.g., a Polymarket market on a recent election).

(a) Estimate the bid-ask spread, volume, and adverse selection from publicly available data.

(b) Estimate the P&L of a hypothetical market maker operating in this market.

(c) Would market making have been profitable without subsidies? With what subsidy level would it become profitable?

Exercise 29: Optimal Market Design

You are designing a new prediction market platform. For each of the following design choices, analyze the impact on market maker incentives:

(a) Maker-taker fee model vs. uniform fee model.

(b) LMSR-based AMM vs. order book vs. hybrid.

(c) Anonymous trading vs. pseudonymous (where market makers can identify repeat traders).

(d) Fixed resolution date vs. early resolution upon certain conditions.

(e) Single-contract market vs. multi-contract market (e.g., one contract per candidate).

Exercise 30: Capstone Project

Build a complete market-making system that:

  1. Maintains fair value estimates for 10 simulated prediction markets.
  2. Quotes two-sided markets in all 10 with inventory-adjusted spreads.
  3. Detects adverse selection in real-time and adjusts spreads accordingly.
  4. Enforces portfolio-level risk limits.
  5. Produces a daily P&L report with attribution.

Run a 30-day simulation with the following scenarios: - Days 1–10: Low adverse selection ($\alpha = 0.15$), moderate volume. - Days 11–20: Increasing adverse selection ($\alpha$ rises from 0.15 to 0.40). - Days 21–30: Mixed conditions with two markets resolving.

Report: (a) Cumulative P&L over the 30 days. (b) P&L attribution (spread capture, adverse selection loss, inventory marking, resolution P&L). (c) Maximum drawdown and Sharpe ratio. (d) Which markets were most and least profitable, and why? (e) How would you improve the system based on the results?