Andreas Park PRO
Professor of Finance at UofT
Katya Malinova and Andreas Park
Some Motivation
Big Picture
payments network
Stock Exchange
Clearing House
custodian
custodian
beneficial ownership record
seller
buyer
Broker
Broker
Broker
Exchange
Internalizer
Wholeseller
Darkpool
Venue
Settlement
New institutions!
Key Components
where do I find these plots? theblock.co/data/
limit order book | periodic auctions | AMM | |
---|---|---|---|
continuous trading |
|||
price discovery with orders | |||
risk sharing |
|||
passive liquidity provision | |||
price continuity |
|||
continuous liquidity | |||
sniping prevented |
AMM Theory: Price Functions
Basic Requirements for "unconstrained" two-asset liquidity pool
What does an AMM need?
Some Pricing Rules from Traditional Markets: Uniform Price
\(q=2\)
Example: \(\Delta c(q)= q\times p^m(q)=2\times 15.5\)
Main pricing rule in stock exchanges: limit order book
quantity
price
\(q\)
\(p^m(q)\)
\(\Delta c(q)=\int_0^qp^m(s)~ds\)
again note: the marginal pricing function \(p(q)\) does not have to be linear
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
average prices
Some insights on pricing functions
The Pricing Function
Transaction cost (here: price impact) of buying \(q\)
\[\frac{p(q)-p(0)}{p_0}=\frac{q}{a-q}\]
Liquidity Supply and Demand in an Automated Market Maker
Facts about modelling liquidity provision
Key questions:
Two broad approaches for modelling liquidity provision
You worry about the positional loss relative to any income.
You worry whether you can rebalance your liquidity profitably.
(im)permanent loss
"LVR" = loss-vs-rebalancing
Provide-and-Forget Liquidity Provision
Buy and hold
Provided liquidity
in the pool
Big Picture for Liquidity Provision
\[\underbrace{F\times v}_{\text{earn on dumb people}} +\underbrace{F\times \Delta c (q^*)}_{\text{earn on smart people}}+\underbrace{\Delta c(q^*)-p_tq^*}_{\text{loss from smart people}}\ge 0\]
Basics of Liquidity Provision
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 \text{cost of capital} \]
in AMMs:
protocol fee
in tradFi: bid-ask spread
\[\underbrace{F\times v}_{\text{earn on dumb people}} +\underbrace{F\times \Delta c (q^*)}_{\text{earn on smart people}}+\underbrace{\Delta c(q^*)-p_tq^*}_{\text{loss from smart people}}\ge \text{cost of capital}\]
Basics of Liquidity Provision
\[\underbrace{F\times v}_{\text{earn on dumb people}} +\underbrace{F\times \Delta c (q^*)}_{\text{earn on smart people}}+\underbrace{\Delta c(q^*)-p_tq^*}_{\text{loss from smart people}}\ge \text{cost of capital}\]
\[\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\)
with expectations (and setting cost of capital to zero) and using \(p_t=V_t=Rp_0\)
Equilibrium Liquidity Supply
liquidity provider choice variable: the initial deposit
adverse selection/positional loss when the return is \(R\) (write \(E[PL]\))
\[\int\limits_0^\infty\left(\sqrt{R}-\frac{1}{2}\left(1+R\right)+\frac{F}{2}|\sqrt{R}-1|\right)~\phi(R)dR+F\frac{E[V]}{2a}.=0\]
fees earned
on informed
fees earned
on balanced flow
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)
adverse selection loss
(or: impermanent loss)
Liquidity Demander's Decision & (optimal) AMM Fees
Result:
competitive liq provision\(\to\) there exists an optimal (min trading costs) fee \(>0\)
Similar to Lehar&Parlour (2023) and Hasbrouck, Riviera, Saleh (2023)
\[F^\pi=\frac{1}{E[|\sqrt{R}-1|/2]+E[V]}\left(-2q\ E[\text{position loss}]+ \sqrt{-2qV\ E[\text{position loss}]}\right).\]
assume: liquidity providers add liquidity until they break even in expectation
Model Summary
Preliminaries & Some Motivation
Liquidity providers
Liquidity demander
Liquidity Pool
AMM pricing is mechanical:
No effect on the marginal price
Sidebar: Capital Requirement (or: what about UniSwap v3?)
Deposit Requirements
\(\Rightarrow \) Need about 5% of the value of the shares deposited -- not 100% -- to cover up to a 10% return decline
UniSwap v3
How we think of the Implementation of an AMM for our Empirical Analysis
Approach: daily AMM deposits
you may say 24/7/365 is great -- but:
could be done with AMM rule with price \[\Delta c(q)=\frac{c}{a-2q}\]
uiii!
1. AMMs close overnight
2. Market: opening auction \(\to p_0\)
3. Determine: optimal fee; submit liquidity \(a,c\)
at ratio \(p_0=c/a\) until break even \(\alpha=\overline{\alpha}\)
4. Liquidity locked for the day
5. At EOD release deposits and fees
6. Back to 1.
Background on Data
some volume may be intermediated
AMMs based on historical returns
Return distribution example: Tesla
Average of the market cap to be deposited for competitive liquidity provision: \(\bar{\alpha}\approx 2\%\)
almost break even on average (average loss 0.2bps \(\approx0\))
average: 94% of days AMM is cheaper than LOB for liq demanders
average savings: 16 bps
average daily: $9.5K
average annual saving: $2.4 million
implied "excess depth" on AMM relative to the traditional market
Optimally Designed AMMs with
"ad hoc" one-day backward look
Optimal fee \(F^\pi\)
\(\overline{\alpha}\) for \(F=F^\pi\)
Need about 10% of market cap in liquidity deposits to make this work
average benefits liquidity provider in bps (average=0)
Insight: Theory is OK - LP's about break even
with circuit breakers: what fraction of \(\alpha\) needs to be deposited as cash
Only need about 5% of the 10% marketcap amount in cash
AMMs are better on about 85% of trading days
quoted spread minus AMM price impact minus AMM fee (all measured in bps)
relative savings: what fraction of transactions costs would an AMM save? \(\to\) about 30%
theoretical annual savings in transactions costs is about $15B
Summary
Summary: alternative view
UniSwap v3
UniSwap v3 has "concentrated liquidity provision"
\(p_d\)
\(p_u\)
\(p_0\)
UniSwap v1/v2: provide liquidity \(a,c\) for all prices
\(p^m\in(0,\infty)\)
UniSwap v3: provide liquidity \(u,\Delta c(d)\) for price interval
\(p^m\in[p_d,p_u]\)
\(u\)
\(d\)
\(\}\)
\(\Delta c(d)\)
the pricing curve for each interval is determined by the constant product rule
How the price is determined
where \(\tilde{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
\(p_d\)
\(p_u\)
\(p_0\)
UniSwap v3: An Example
\(p_u=15\)
\(p_d=7\)
\(u=2\)
\(p_0=10\) (that's exogenous, not a choice)
marginal price
\[p^m(s)=\frac{\tilde{a}c}{(\tilde{a}-s)^2}.\]
Finding virtual liquidity factor \(\tilde{a}\)
marginal price
\[p^m(s)=\frac{\tilde{a}c}{(\tilde{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 "\(\tilde{a}\)"
such that \[p^m(u|\tilde{a})=p_u\]
Finding the fourth parameter \(\Delta c(d)\)
\(p_u=15\)
\(p_d=7\)
\(u=2\)
\(d=?\)
required cash deposit \(\Delta c(d)=\) the amount that I pay for \(d\)
marginal price
\[p^m(s)=\frac{\tilde{a}c}{(\tilde{a}-s)^2}.\]
Given \(\tilde{a}\) solves \(\gamma(u)=p_u\), we
Solutions
For those in the know: These formulae/solutions are exactly the same as those in the UniSwap v3 whitepaper
Numerical example
Want to read more?
Deposit Requirements
\(\Rightarrow \) Need about 5% of the value of the shares deposited -- not 100% -- to cover up to a 10% return decline
An alternative to -10% circuit breaker:
max cash needed based on long-run past average R \(-\) 2 std
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.
@financeUTM
andreas.park@rotman.utoronto.ca
slides.com/ap248
sites.google.com/site/parkandreas/
youtube.com/user/andreaspark2812/
By Andreas Park
A conference version of the AMM paper expanded for a full seminar; to be used at Chapman