Motivation

After seeing many protocols fail with vanilla vAMMs, it’s easy to conflate good vAMM with bad vAMM. However, vAMM can be a powerful tool with a properly built-in risk engine. Here, we explore how a pricing scheme defined by vAMM implicitly deploys liquidity that adapts to change in the inventory as well as volatilities of the underlying assets.

See the full write-up here.

Derivation

Consider a vAMM with a pricing function \pi(x) that charges premium for a trade with size x. This construction is slightly different from conventional CFMMs, where the invariant is defined over non-negative quantities of n assets, since \pi(x) is defined for any real x. This is one of the factors that separates vAMMs from spot AMMs — allowing “reserves” to be negative.

We now transform the function \pi(x) into a function of spread y, l(y), where \int_{y_1}^{y_2}l(y)dy represents the total amount of liquidity deployed within price range (p + y_1) and (p + y_2), where p is the index price. This will help us visualize how vAMM places virtual liquidity across different prices. Note that midprice is equal to p + \pi'(0).

l(y) = \begin{cases} 1/\pi''(\{\pi'\}^{-1}(y)) \text{ if } y \in \text{Dom}(\{\pi'\}^{-1}) \\ 0 \text{ otherwise}\end{cases}

Conversely, we can also retrieve the pricing function \pi(x) given liquidity curve l(y) and midprice y_0.

\pi(x) = \int_0^x f(z)dz
where f(z) = g^{-1}(z) and g(y) = \int_{y_0}^y l(w)dw

Example

We now apply this to indifference pricing with EVaR, explored in our previous post.

Under multi-asset trading scenario with multivariate normal assumption on the underlying prices with mean \boldsymbol{\mu} and covariance \boldsymbol{\Sigma}, the premium for trading x amount of i th asset can be written as

\pi_i(x)= \mu_ix + \sqrt{-2\log\alpha}(\sqrt{ (\boldsymbol{X}+x\boldsymbol{1}_i)^T\boldsymbol{\Sigma}(\boldsymbol{X}+x\boldsymbol{1}_i)} - \sqrt{\boldsymbol{X}^T\boldsymbol{\Sigma}\boldsymbol{X}})

where \boldsymbol{X} = (x_1, \cdots, x_n)^T represents the current inventory for the AMM, \mathbf{1}_i is a vector where \mathbf{1}_{i, j} = 0 \text{ if } i\neq j \text{ and } 1 \text{ if } i=j and 1-\alpha is the EVaR confidence level.

Now with some math, we get

\begin{align*} l_i(y) &= \begin{cases} \frac{\sqrt{(\log\alpha)(\boldsymbol{X}^T\boldsymbol{\Sigma}\boldsymbol{X}+2\boldsymbol{\Sigma}_i^T\boldsymbol{X}x + {\Sigma}_{ii}x^2})}{4{\Sigma}_{ii} - (2\boldsymbol{\Sigma}_i^T\boldsymbol{X} + 2{\Sigma}_{ii}x)^2 / (\boldsymbol{X}^T\boldsymbol{\Sigma}\boldsymbol{X}+2\boldsymbol{\Sigma}_i^T\boldsymbol{X}x + {\Sigma}_{ii}x^2)}&\text{ if }B^2 - 4AC \geq 0 \\ 0 &\text{ otherwise} \end{cases}\\ x &= \frac{-B + \sqrt{B^2 - 4AC}}{2A}\\ A &= 2 {\Sigma}_{ii}\{(y - \mu_i + p_i)^2 + 2{\Sigma}_{ii}+\log\alpha\}\\ B &= 4 \boldsymbol{\Sigma}_i^T\boldsymbol{X}\{(y - \mu_i + p_i)^2 + 2{\Sigma}_{ii}+\log\alpha\}\\ C &= 2 (y -\mu_i + p_i)^2 \boldsymbol{X}^T\boldsymbol{\Sigma}\boldsymbol{X} + (2\boldsymbol{\Sigma}_i^T\boldsymbol{X})^2 + \log\alpha \end{align*}

where p_i is the index price for the i th asset, \boldsymbol{\Sigma}_i is the i th row of \boldsymbol{\Sigma} and \Sigma_{ii} is the (i, i) th entry of \boldsymbol{\Sigma}.

In the plots above, we see that the bids are placed with negative spread so as to incentivize shorts to come in, which will help reduce the risk for the AMM who has a net short exposure in the second asset that is positively correlated with the first.

Application

This construction can be applied to other risk measures with different confidence levels. In addition, converting from premium function to liquidity function makes the “addition” of multiple risk-indifference pricing more intuitive (which reminds me of the beautiful work in “A Geometric Perspective of AMMs”). While operating at the premium function level (probably) requires computing convolution of the risk measures, converting them to liquidity functions simply lets us consider the sum of the functions.

If we want to consider charging an additional fee applied to the notional size (priced at the index), this is equivalent to shifting the liquidity curve away from mid price by \gamma p, where \gamma is the fee level (e.g. 10 bpts).

Note that if one were to apply this market making strategy on order books, it would require them to rebalance their orders frequently, with every change in the inventory as well as changes in the volatility of the underlying assets. However, with a vAMM, we only need to change the parameters in the pricing function \pi(x)!

Questions for Discussion

While converting to liquidity function theoretically allows the aggregation of LPs with different risk tolerances as well as desired fee levels, the practicality of keeping track of the total liquidity functions is still an issue.

1. How large is the set of liquidity curves that can be mapped to from coherent/convex risk measures?
2. What is the complexity-approximation (Milionis et al. 2023) tradeoff?
3. Can we formalize an insolvency-capital efficiency tradeoff in the LOB vs vAMM setting?