Andreas Park PRO
Professor of Finance at UofT
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
price impact of trades
anonymity
price discovery
centralized auction
bilateral
negotiation
Request
for Quote
open
outcry
Broker
Exchange
Internalizer
Wholeseller
Darkpool
Venue
Settlement
Investor
Decentralized Trading
Liquidity providers
Liquidity demander
Liquidity Pool
AMM pricing is mechanical:
No effect on the marginal price
AMM Theory: The Price Function
Basic Requirements
What does an AMM need?
quantity
price
q
pm(q)
Δc(q)(Q)=p(q)m×q
Traditional pricing: auctions/open outcry/RFQ: uniform price
idea: cost of q= price× quantity
Some Pricing Rules from Traditional Markets: Uniform Price
q=2
Δc(q)=q×pm(q)=2×15.5
Main pricing rule in stock exchanges: limit order book
quantity
price
q
pm(q)
Δc(q)=∫0qpm(s) ds
Some Pricing Rules from Traditional Markets: Limit Order Book
Most Common Pricing Rule in DeFi: Constant Product
Most Common Pricing Rule in DeFi: Constant Product
Insight: AMM pricing function is the same as a limit order book when we require
Some insights on pricing functions
The Pricing Function
Sidebar: we can quantify how much a PASSIVE LP loses when the price moves by R
for orientation:
initial depositadverse selection loss when the return is R=R−21(R+1)
see Barbon & Ranaldo (2022)
Liquidity Demander's Decision & (optimal) AMM Fees
Result:
competitive liq provision→ there exists an optimal (min trading costs) fee >0
Similar to Lehar&Parlour (2023) and Hasbrouck, Riviera, Saleh (2023)
Fπ=E[∣R−1∣/2]+V1(−2q E[position loss]+−2qV E[position loss]).
assume: liquidity providers add liquidity until they break even in expectation
Empirical Work
Lehar and Parlour (2021)
Barbon & Ranaldo (2023)
Other notables:
Malinova & Park (2023): AMM applied to equities would reduce trading costs by 30%
UniSwap v3
UniSwap v3 has "concentrated liquidity provision"
Just a little more institutional details
users submit liquidity positions (u,d,pu,pd) and receive an ERC-721 (=NFT) token as a receipt
the code segments liquidity into discrete exponential intervals [pk,pk+1] with pk=(1+δ)k. (numerically: p(k)=1.0001k)
it aggregates liquidity over these intervals
the pricing curve for each interval is determined by the constant product rule
intervals may be "empty"
How the price is determined
How the price is determined
pd
pu
p0
we know this curve has functional form pm(q)=(a~−c)2a~c
where a~ is the virtual liquidity
quick disclaimer: what follows is not how UniSwap is explained on its website etc. But the resulting maths are the same
More on UniSwap v3
marginal "limit order book" price
γ(s)=(a−s)2ac
pu=15
pd=7
u=2
p0=10 (that's exogenous, not a choice)
Finding virtual liquidity factor a~
marginal "limit order book" price
γ(s)=(a−s)2ac
pu=15
pd=7
u=2
p0=10 (that's exogenous, not a choice)
= find the right curve
= find the right "a~"
Finding the fourth parameter Δc(d)
marginal "limit order book" price
γ(s)=(a−s)2ac
pu=15
pd=7
u=2
d=?
required cash deposit Δc(d)= the amount that I pay for d
Solutions
Numerical example
Want to read more?
Concerns around Automated Market Makers
a
b
c
d
e
f
g
Problem 1: Public Mempools allow sandwich (MEV) attacks
related paper: “Maximal Extractable Value and Allocative Inefficiencies in Public Blockchains”. A. Capponi, R. Jia, and Y. Wang (2023)
Problem 2: Just-In-Time Liquidity (single trade cream skimming)
X-Router
Liquidity pool
OTC
Problem 2: Just-In-Time Liquidity (at the MEV level)
X-Router
Liquidity pool
searcher/builder
balanced orders
add as much liquidity as possible
withdraw liquidity
unbalanced orders
related paper: Capponi, Jia, and Zhu (2024) "The Paradox of Just-in-Time Liquidity in Decentralized Exchanges: More Providers Can Lead to Less Liquidity"
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
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/
By Andreas Park