# Concentrated

restricted price-range pool with excess collateral removed, ensuring that the entire collateral is available for prices in the specified range

## Key formulas

##### Characteristic function
$$f(x,y) = k = \sqrt{(x+\Delta x)\cdot(y+\Delta y)}$$

In the above formula, $\Delta x, \Delta y$ are “virtual” token balances, ie tokens that are accounted for in the AMM mechanics but that do not actually exist. This is possible as long as those virtual tokens never leave the AMM, meaning that its operations need to be restricted to a certain range. The numeraire $y$ leaves the AMM when prices go down, so if $\Delta y > 0$ then there must be a lower limit to the price. Similarly, if $\Delta x > 0$ there must be an upper price limit.

Note that range-bound AMMs do not necessarily need to operate with virtual tokens, aka leverage. However, there is not usually a good reason to keep collateral in the pool that can never be used.

##### Indifference curve
$$y_k(x) = \frac{k^2}{x+\Delta x} - \Delta y$$

Within the range the indifference curve is the constant product indifference curve, except that it is shifted by the virtual balances $\Delta x, \Delta y$ respectively. Assuming all excess liquidty is removed, ie both $\Delta x, \Delta y$ are at their maximum possible values, the range goes from $x=0$ to $y=0$, ie the point where it crosses the x-axis.

##### Price response function
$$\pi_k(x) = \frac{k^2}{(x+\Delta x)^2}$$

The PRF is that of the constant product AMM except that the virtual balance $\Delta x$ is added to the actual balance. As $x$ can not go below zero this means the the PRF is bounded from above at $\frac{k^2}{\Delta x^2}$. It is also bounded from below because $x<x_{\mathrm{max}}$ where the latter is determined by the requirement that $y > 0$.

##### AMM portfolio value (below range)
$$\nu(\xi) = n_0 \cdot \xi \ \ \ \forall \xi < \xi_0$$

Below the range, the AMM is 100% invested in the risk asset. Therefore its value is proportional to the price of the risk asset $\xi$, with a suitable portfolion notional factor $n_0$.

##### AMM portfolio value (above range)
$$\nu(\xi) = n_0 \cdot \sqrt{\xi_0 \xi_1} \ \ \ \forall \xi > \xi_1$$

Above the range, the AMM is invested in the numeraire asset. Therefore its price is constant. The factor $\sqrt{\xi_0 \xi_1}$ represents the divergence loss suffered when crossing the range

##### AMM portfolio value (in range)
$$\nu(\xi) = n_0 \cdot \left( \sqrt{\xi_0 \xi_1} \cdot \frac{\sqrt{\xi}-\sqrt{\xi_0}}{\sqrt{\xi_1}-\sqrt{\xi_0}} + \sqrt{\xi_0 \xi} \cdot \frac{\sqrt{\xi_1}-\sqrt{\xi}}{\sqrt{\xi_1}-\sqrt{\xi_0}} \right) \ \ \ \forall \xi_0 < \xi < \xi_1$$

Within the range, the AMM portfolio value is given by the above formula. Note that whilst it looks complex it is essentially of the form $a\sqrt \xi + b$, ie it is affine in $\xi$, and the complexity lies solely in the constants $a,b$. For $\xi_0 \to 0, \xi_1 \to \infty$ we recover our standard $\sqrt \xi$ shape, provide we adjust the notional $n_0$ to account for the different normalization.

##### Risk asset holdings
$$N_r(\xi) = n_0 \cdot \sqrt{\frac{\xi_0}{\xi}} \cdot \frac{\sqrt{\xi_1}-\sqrt{\xi}}{\sqrt{\xi_1}-\sqrt{\xi_0}} \ \ \ \forall \xi_0 < \xi < \xi_1$$

Below the range, the AMM is 100% invested in the risk asset, and above it, it holds none. Within the range the risk asset holdings (the Black Scholes “Delta”) is given by the above formula. The cash invested into the risk asset (“Cash Delta”) is obtained by multiplying the above with $\xi$, so the leading term becomes $n_0 \cdot \sqrt{\xi_0 \xi}$

##### Numeraire holdings
$$N_n(\xi) = n_0 \cdot \sqrt{\xi_0 \xi_1} \cdot \frac{\sqrt{\xi}-\sqrt{\xi_0}}{\sqrt{\xi_1}-\sqrt{\xi_0}} \ \ \ \forall \xi_0 < \xi < \xi_1$$

Above the range, the AMM is 100% invested in the numeraire asset, and below it, it holds none. Within the range the cash held in the numeraire asset is given by the above formula.

##### Divergence loss
$$\Lambda(\xi) = N_n(\bar\xi) + \xi \cdot N_r(\bar\xi) - \nu(\xi)$$

As usualy the DL is defined as the difference between the current value of the initial portfolio and the value of the AMM portfolio. Initially we have, by definition, $\xi = \bar\xi$ and therefore the portfolio composition is $N_n(\bar\xi)$ units of the numeraire, and $N_r(\bar\xi)$ units of the risk asset. The current value of the latter is $\xi N_r(\bar\xi)$, and the value of the AMM portfolio is $\nu(\xi)$, which yields the above formula.

The issue with DL in the concentrated liquidity case is two-fold. Firstly there is the question whether the initial portfolio is really the right benchmark, and secondly whether DL outside the range (when the AMM does not earn any fees) should be counted, or whether this is simply a suboptimal strategy on behalf of the LP. There is no general answer to those questions, they need to be solved in the situation at hand.

Whilst reasonable care has been taken to verify the above formulas they may still contain errors. Please do not use them without independent verification.