Andreas Park
Traditional Markets
What is Market Microstructure?
Broker
Exchange
Internalizer
Wholeseller
Darkpool
Venue
Settlement
Traditional Institutions
Investors
Trading Arrangements
central limit order book
complexity
impact of trades
anonymity
price discovery
centralized auction
bilateral
negotiation
Request
for Quote
open
outcry
marginal pricing function
quantity \(Q\)
price \(p(Q)\)
Illustration of pricing
quantity
price
\(Q\)
\(p(Q)\)
\(P^{\mathsf{up}}(Q)=p(Q)\times Q\)
Illustration of pricing: auctions/open outcry/RFQ: uniform price
Illustration of pricing: limit order book = discriminatory pricing
quantity
price
\(Q\)
\(p(Q)\)
\(P^{\mathsf{dp}}(Q)=\int_0^Qp(q)~dq\)
Who trades?
Key question for liquidity provision
Seminal papers
What's there first? Orders or Liquidity?
Seminal papers
Basics of liquidity provision under value uncertainty
Questions:
every model has some form of structure like
\[\text{trading fee income} +\underbrace{\text{what I sold it for}-\text{value of net position}}_{\text{positional gain/loss}} \ge 0 \]
Example 1: Grossman/Miller
Example 2: Kyle or Glosten-Milgrom
Example 3: Limit order market (a la Glosten 1994)
Small point:
Crypto Markets
payments network
Stock Exchange
Clearing House
custodian
custodian
beneficial ownership record
seller
buyer
Broker
Broker
Broker
Exchange
Internalizer
Wholeseller
Darkpool
Venue
Settlement
note: Coinbase has only ~260 assets; most trading is in ETH and BTC
Centralized Trading
BTC/USD
ask: 7,600
bid: 7,550
BTC/USD
ask: 7,500
bid: 7,450
buy BTC
sell BTC
move BTC to Kraken
Crypto Wash Trading, Lin William Cong, Xi Li, Ke Tang, Yang Yang
What is pump and dump?
arranged via Telegram Channels
IS BITCOIN REALLY UN-TETHERED? JOHN M. GRIFFIN and AMIN SHAMS
Journal of Finance 2020
Figure 1. Aggregate Flow of Tether between Major Addresses
August 2016
Decentralized Trading
Actually ...
\(\to\) simply connect with MetaMask (or similar wallet)
AMM Pricing
Constant Liquidity (Product) AMM
Key Components
The Pricing Function
Liquidity Deposit \(\Rightarrow\) slope of the price curve
The Pricing Function (just a little more)
The Pricing Function (just a little more)
The Pricing Function (almost done, just one more thing)
AMMs continue to evolve: UniSwap v3
Basic idea:
Source:" Uniswap v3 Core," Adams, Zinsmeister, Salem, Keefer, Robinson (2021)
More on UniSwap v3
More on UniSwap v3
marginal "limit order book" price
\[\gamma(s)=\frac{ac}{(a-s)^2}\]
\(p_u=15\)
\(p_d=7\)
\(u=2\)
\(p_0=10\) (that's exogenous, not a choice)
More on UniSwap v3
marginal "limit order book" price
\[\gamma(s)=\frac{ac}{(a-s)^2}\]
\(p_u=15\)
\(p_d=7\)
\(u=2\)
\(p_0=10\) (that's exogenous, not a choice)
= find the right curve
= find the right "\(a^*\)"
More on UniSwap v3
marginal "limit order book" price
\[\gamma(s)=\frac{ac}{(a-s)^2}\]
\(p_u=15\)
\(p_d=7\)
\(u=2\)
\(d=?\)
required cash deposit \(\Delta c(d)=\) the amount that I pay for \(d\)
Some UniSwap v3 maths (Barbon & Ranaldo 2023)
Source: Elsts (2021) "Liquidity Math in UniSwap v3"
Liquidity Supply and Demand in an Automated Market Maker
Two views
Basics of Liquidity Provision
\[\underbrace{F \int DV \mu(DV) }_{\text{fees earned on}\atop \text{balanced flow}}+\int_0^\infty\underbrace{(\Delta c(q^*)-q^*p_t(R)}_{\text{adverse selection loss} \atop \text{when the return is {\it R}}} +\underbrace{F \cdot \Delta c(q^*))}_{\text{fees earned}\atop \text{from arbitrageurs}}~\phi(R)dR \ge 0.\]
\(q^* \) is what arbitrageurs trade to move the price to reflect \(R\)
Basic idea of liquidity provision: earn more on balanced flow than what you lose on price movement
\[\text{fee income} +\underbrace{\text{what I sold it for}-\text{value of net position}}_{\text{adverse selection loss}} \ge 0 \]
in AMMs:
protocol fee
in tradFi: bid-ask spread
Basics of Liquidity Provision
\[\frac{1}{\text{initial deposit}}\int_0^\infty(\Delta c(q^*)-q^*p_t(R)+F \cdot \Delta c(q^*))~\phi(R)dR +\frac{F p_0 V}{\text{initial deposit}}\ge 0\]
\[\int_0^\infty\left(\frac{\Delta c(q^*)-q^*p_t(R)}{\text{initial deposit}} +F \cdot \frac{\Delta c(q^*)}{\text{initial deposit}}\right)~\phi(R)dR +\frac{F p_0 V}{\text{initial deposit}}\ge 0\]
closed form functions of \(R\) only
(see Barbon & Ranaldo (2022))
\[\underbrace{F \int DV \mu(DV) }_{\text{fees earned on}\atop \text{balanced flow}}+\int_0^\infty\underbrace{(\Delta c(q^*)-q^*p_t(R)}_{\text{adverse selection loss} \atop \text{when the return is {\it R}}} +\underbrace{F \cdot \Delta c(q^*))}_{\text{fees earned}\atop \text{from arbitrageurs}}~\phi(R)dR \ge 0.\]
Basics of Liquidity Provision
\(\Rightarrow\) \(\Delta c(q^*)-q^*p_t(R)\) is also referred to as the "impermanent loss" or "divergence loss"
\(\Delta c(q^*)-q^*p_t(R)=\underbrace{p_t(R)\times(a-q^*) +c+\Delta c(q^*)}_{\text{value of liquidity deposit}}-\underbrace{(p_t(R)a+c)}_{\text{value of buy-} \atop \text{and-hold position}}\)
see Milionis, Moallemi, Roughgarden, and Zhang (2022) for a dynamic analysis of impermanent loss
Sidebar: we can quantify how much a PASSIVE LP loses when the price moves by \(R\)
for orientation:
\[\frac{\text{adverse selection loss when the return is \(R\)}}{\text{initial deposit}}=\sqrt{R}-\frac{1}{2}(R+1)\]
see Barbon & Ranaldo (2022)
Basics of Liquidity Provision
Liquidity provision measured as "collective" deposit \(\alpha\) of token's market cap as function of
\[E[\text{DL}(R)]+F\cdot E[\text{another function of }R]+F\cdot \frac{\text{E[dollar volume]}}{\text{initial deposit}}\ge 0.\]
\[\text{what I sold it for}-\text{value of net position}+\text{fee income} \ge 0 \]
The Decision of the Liquidity Demander
\[F^\pi=\frac{1}{E[|\sqrt{R}-1|/2]+E[DV]}\left(-2q\ E[\text{DL}]+ \sqrt{-2qE[DV]\ E[\text{DL}]}\right).\]
this is from Malinova and Park (2023); similar result is in Hasbrouk, Riviera, Saleh (2023)
Model Summary
Empirical Work
Lehar and Parlour (2021)
Barbon & Ranaldo (2023)
Other notables:
Malinova & Park (2023): AMM applied to equities would reduce trading costs by 30%
Concerns around Automated Market Makers
a
b
c
d
e
f
g
Problem: Public Mempools allow sandwich (MEV) attacks
\(X\)
\(Y\)
normal trade: sell \(x\) \(\to\) get \(y'\)
\(Y-y'\)
\(X+x\)
front-running:
\(Y-y'-y''\)
\(X+2x\)
\(y'>y''~\Rightarrow\)
front-running is intrinsically profitable
Disclaimer:
From Vitalik Buterin's post on the topic:
https://ethresear.ch/t/improving-front-running-resistance-of-x-y-k-market-makers/1281
Theorem (Park 2023):
Hypothetical example
The Bigger Picture: MEV Extraction
read more at: "Battle of the Bots: Flash Loans, Miner Extractable Value and Efficient Settlement", Lehar & Parlour, 2023
Literature
AMM Literature: a booming field
Lehar and Parlour (2021): for many parametric configurations, investors prefer AMMs over the limit order market.
Aoyagi and Ito (2021): co-existence of a centralized exchange and an automated market maker; informed traders react non-monotonically to changes in the risky asset’s volatility
Capponi and Jia (2021): price volatility \(\to\) welfare of AMM LPs; conditions for a breakdown of liquidity supply in the automated system; more convex pricing \(\to\) lower arbitrage rents & less trading.
Capponi, Jia, and Wang (2022): decision problems of validators, traders, and MEV bots under the Flashbots protocol.
Park (2021): properties and conceptual challenges for AMM pricing functions
Milionis, Moallemi, Roughgarden, and Zhang (2022): dynamic impermanent loss analysis for under constant product pricing.
Hasbrouck, Rivera, and Saleh (2022): higher fee \(\Rightarrow\) higher volume
Empirics:
Lehar and Parlour (2021): price discovery better on AMMs
Barbon and Ranaldo (2022): compare the liquidity CEX and DEX; argue that DEX prices are less efficient.
The Bigger Picture and Last Words
Last Words
@financeUTM
andreas.park@rotman.utoronto.ca
slides.com/ap248
sites.google.com/site/parkandreas/
youtube.com/user/andreaspark2812/