---
# System prepended metadata

title: A Simple Market Making Strategy
tags: [dAMM]

---

---
tags: dAMM
---

# A Simple Market Making Strategy

This note present a simple market making strategy. While less sophisticated than popular MM strategies based on statistical and mathematical models (e.g. [Avellaneda & Stoikov](https://www.math.nyu.edu/~avellane/HighFrequencyTrading.pdf)), the strategy presents several advantages:

- the model is easily tuned with a few parameters (only min and max price in its simplest form)
- the logic is oracle-free and simple enough to be decentralized in a smart contract
- the strategy is set-and-forget
- It can be understood by non-experts.

These are the same properties that have made Uniswap-type automated market making (AMM) strategies retail-friendly and immensely popular in defi. In fact, I will show that the strategy shares the same concepts and can be viewed as a generalization of current AMMs' design.

## Model

A market maker brings liquidity on a trading pair $X$/$Y$ in which $X$ is a volatile asset and $Y$ a base asset (this could be cash or a numeraire asset like ETH). At a high level, market making consists in buying at low price and selling at high price. While there are many ways to give a practical content to the notions of "high" and "low", I consider a strategy buying $X$ when its price has decreased and selling it when it has increased both by some pre-defined variation rate. To manage the risk of prematurely running out of $X$ (when the price is going up) or $Y$ (when it is going down), we define two price thresholds:
- a minimum price $p_{min}$ at which all $Y$ have been sold and the inventory is 100% in $X$,
- a maximum price $p_{max}$ at which all $X$ have been sold and the inventory is 100% in $Y$.

$p_{min}$ and $p_{max}$ should be set so that the MM is reasonably confident that the price will not get out of the two bounds.

An extremely conservative strategy would be to set the min and max prices to 0 and infinity, leading to the fixed weight model. After a brief presentation of this stratgey, which is the most basic form of MM, I show how to improve it to concentrate capital in a narrower price range.

### Fixed weight policy

A market has two assets X and Y. The price of X defined in Y units is $p$. The market maker (MM) has inventories $x$ and $y$. The market value of the assets held in MM's inventory is:
$$
V = px + y
$$

A MM tries to increase inventory value over time by capturing incremental bid-ask spreads and accumulating them.

MM's inventory weight is:
$$
\dfrac{px}{px + y}
$$

A possible strategy is to keep a fixed weight:
$$
\dfrac{px}{px + y} = \text{constante} \quad \forall p 
% \text{ over the interval } (0,\infty)
$$

The strategy targets a fixed share of the two assets as would do an index-based passive strategies. It is contrarian: to restore target weight after price variations, it buys low and sells high, profiting from [volatility harvesting](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3847692).

This strategy is not capital efficient as liquidity is deployed as if the price could fluctuate over the $(0,\infty)$ interval.

### Liquidity concentration

The strategy relies on presuming a minimum price $p_{min}$ and a maximum price $p_{max}$ between which the actual price fluctuates. The price state $s \in [0,1]$, a normalization of price over the range $[0,1]$, is defined as:
$$
s = \dfrac{p_{max} - p}{p_{max} - p_{min}}
$$

If the price approaches its upper bound, $s$ is close to $0$. If $s$ is near its lower bound, it is close to 1.

The MM posts bids and asks so that the inventory weight targets an increasing function $\phi$: $[0,1] \rightarrow [0,1]$ of $s$:
$$
\dfrac{px}{px + y} = \phi(s)
$$

with $\phi'(.) \geq 0$, $\phi(0) = 0$ and $\phi(1) = 1$. When the price hits its hypothetical upper limit, the target weight is 0\% (100% in Y). When it reaches its lower bound, it is 100%. The two constraints lever capital efficiency and take seriously the meaning of price boundaries.

Compared to fixed-weight strategies, liquidity is concentrated over a narrower interval, which allows larger buys and sells and higher profit. The narrower the price range $[p_{min}, p_{max}]$ the higher the return: the more sensitive state $s$ to price variations, the larger the quantity variations $x_1-x_0$ needed to restore target weight which brings more profit.

When price decreases, more $X$ are bought for two reasons:
- to restore previous inventory weight (as in the constant weight case)
- to catch up the increasing target share.

There is a risk/return trade-off between concentrating liquidity available for trades over a narrow range $[p_{min},p_{max}]$ and inventory risk. The narrower the price range, the higher the return but also the higher the risk that the price moves out of the range.

#### Linear case

Target weight linearly decreases with price state:
$$
\dfrac{px}{px + y} = s = \dfrac{p_{max} - p}{p_{max} - p_{min}}
$$

Linearity implies that when the state price increases by 3 percentage points, inventory weight decreases by -3 percentage points.


#### Non-linear cases

Consider the following transformation:
$$
\phi(s) = \dfrac{1}{ 1 + \Big( \dfrac{1-s}{s} \Big)^{\gamma}}
$$

The function $\phi$ is increasing and linear for $\gamma =1$. It is S-shaped (convex then concave) for $\gamma$ > 1, as illustrated in the case $\gamma =$ 2:

![](https://i.imgur.com/vSWGIAx.png =500x300)

It is inverse S-shaped (concave then convex) for $\gamma < 1$. For example with $\gamma = 0.5$:

![](https://i.imgur.com/ij1hA4T.png =500x330)

When $\gamma > 1$, larger buys and sells are executed around mid-price. This is achieved by flattening the curve at both ends. The next Figure shows how inventory weight changes with price state:

![](https://i.imgur.com/e5vpZUP.png =450x300)

Suppose that the price state $s$ increases from 0.4 to 0.6. On the horizontal axis, $1-s$ decreases from 0.6 to 0.4. On the vertical axis, the portfolio weight changes by a wide margin: 0.7-0.3=0.4. On the other hand, if the price state increases from 0.8 to 1 (from 0 to 0.2), $1-s$ decreases from 0.2 to 0 (from 1 to 0.8), the portfolio weight changes by a small margin equal to $6$ percentage points in both cases.

To the contrary, when $\gamma < 1$, larger volumes are quoted on both ends of the price distribution.

The first derivative $-\phi'(1-s)$ indicates how portfolio weight varies following a marginal variation of state price. Since the MM makes more profit by concentrating liquidity where the price goes back and forth, it also informs about where the MM expects the price to circulate most of the time. In this interpretation, the derivative is a proxy for the expected price distribution and the $\phi$ function is the cumulative distribution function.

The derivative $-\phi'(1-s)$ is plotted for $\gamma=$ 2 (S-shaped weighting function), $\gamma=$ 1 (linear function) and $\gamma=$ 0.5 (inverse S-Shaped function):

![](https://i.imgur.com/y0npHgO.png =440x330)

The MM shifts portfolio weight with greater amplitude and increases quote size in the middle of the price grid for $\gamma >$ 1 and at both ends for $\gamma <$ 1.

## Example: ETH/USDC market

The minimum price $p_{min}$ for ETH is set to \$$1000$, the maximum price $p_{max}$ to \$$4000$. The $\gamma$ parameter which tunes how state price $s$ maps into a portfolio share, is set to $1$, which corresponds to the linear case. Given a current price of \$$2000$, and a constant price interval of \$$200$, buy orders are posted at prices \$$1800$, \$$1600$, etc., down to the minimum price \$$1000$. Sell orders are posted at prices \$$2200$, \$$2200$, etc., up to the maximum price \$$4000$. They are located by orange and green vertical lines on the price space:
<!-- Buy and sell orders are posted on an order book like [Mangrove](https://mangrove.exchange). -->
![](https://i.imgur.com/kZxwbln.png =500x280)

The blue curve is made up of 15 linear segments and indicates how MM's wealth, which is $700,000$\$ at current ETH price \$$2000$, changes when the price goes to either direction and triggers the execution of buy or sell orders. The smaller the price, the higher the share of ETH and the more responsive wealth to price variations. The local slope, the strategy's delta, is bending towards zero as the price increases and the MM accumulates USDC.

The wealth curve can be compared to the wealth derived from holding the two assets without rebalancing (red line):

![](https://i.imgur.com/qxHZp8N.png =500x280)

The gap between the two curves is the equivalent of impermanent loss (IL) found in Uniswap-type AMM strategies. IL is more pronounced on the upside, with a $25$% loss rate at price $4000$\$, than on the downside with a $16$% loss rate compared to holding. This is  explained by the fact that a) the price range is wider on the upside than on the downside, and b) a quadratic relation exists between IL and distance from current price.

The quadratic relation has two implications. First a market maker willing to minimize average losses at both end should set a minimum and a maximum price at equal distance from current price.

Second, a MM being either bullish on ETH (with a current price close to the min price) or bearish (with a current price close to the max price) suffers the most from IL if his expectation materializes. This 'winner curse' suggests that investors with asymmetric bets may prefer 

IL varies little with $\gamma$, the curvature parameter:

![](https://i.imgur.com/MaTXGYU.png =500x280)

We note a bit more IL at the price extremes for $\gamma=1.5$.

The parameter has stronger influence on the distribution of size orders, the quantity of ETH bought or sold at every execution price:

![](https://i.imgur.com/D9THVCz.png =500x300)

In accordance with previous discussion about the meaning of $\gamma$, order sizes are U-shaped for $\gamma=0.5$, decreasing for $\gamma=1$ and bell-shaped for $\gamma=1.5$. The MM will make more profit if the price distribution is:
- concentrated at the two extremes in the first case
- decreasing in the second case
- concentrated in the middle of the price range in the third case.

## The MM strategy as a general AMM

![](https://i.imgur.com/X8ADcaG.png =450x265)

The MM strategy can be viewed as a discrete AMM, a generalized version of Uniswap-type AMMs. While the fixed weight strategy could be compared to Uniswap V2 in which the weight is set to 50%, the concentrated liquidity version can be interpreted as a generalized verion of Uniswap V3.

Both strategies buy low and sell high by concentrating liquidity over a price interval. The figure graphically represents a simplified strategy with three execution prices in the space of MM's inventories of $X$ and $Y$. The curve is composed of three connected segments:

![](https://i.imgur.com/WNpCH25.png =390x300)

The strategy posts bids and asks at execution prices $p_0$, $p_1$ and $p_2$ which are the segments' slopes. Given current price $p$, the MM posts at price $p_1<p$ a bid of size $x'-x$ and at price $p_2 > p$ an ask of size $y'' - y$. If the bid at price $p_1$ is taken, the strategy posts another bid at price $p_0<p$ of size $x''-x'$:
<!--(except where the last order has been filled) -->

![](https://i.imgur.com/gXmawxR.png =390x290)

Contrary to Uniswap which continuously adjusts its internal exchange rate in function of the relative scarcity of the two assets held in the pool, the exchange rates proposed to the market is fixed for large intervals of market prices. However, nothing prevents the MM to shrink the distance between any two prices and propose a quasi continuous price schedule (abstratcting from gas costs). In this sense, Uniswap V3 could be viewed as a special case of the strategy in which the number of quoted prices and segments is tending towards infinity. 

In the ETH/USDC market previously presented, the bonding curve is made of 15 connected segments:

![](https://i.imgur.com/wu7kAE6.png =500x280)

The horizontal axis represents the quantity of ETH held by the MM, the vertical axis the quantity of USDC. The slope goes from the maximal price on the left (when the MM has sold all his ETH) to the minimal price on the right when his inventory is 100% in ETH).

The functions $\phi$: $[0,1] \rightarrow [0,1]$ which informs about where the MM concentrates his capital on the price grid can be computed for UNI-V3: $\phi (p) = (1+p/\alpha(p))^{-1}$ with
$$
\alpha(p) = \dfrac{\sqrt{p}-\sqrt{p_{min}}}{ \dfrac{1}{\sqrt{p}}-\dfrac{1}{\sqrt{p_{max}}}}
$$

We can graphically compare the $\phi$ functions:

![](https://i.imgur.com/APkrBY2.png =500x295)

The Uniswap V3 $\phi$ function has a concave shape (it is actually slightly S-shaped), which means that LP concentrate their liquidity over the lower part of the price interval, as confirmed by the distribution of size orders:

![](https://i.imgur.com/poTr8X3.png =500x295)

This strategy is consistent with expectations that the price will stay most of the time on the left-hand-side of the price interval. The MM strategy can exactly replicate a UNI-V3 strategy by selecting the same $\phi$ function. It is also flexible enough to accomodate other strategies by choosing a different function.

The extent of impermanent loss can also be compared. In both strategies, the MM buys the depreciating asset and sells the appreciating asset. As a result, they both underperform compared to holding if the price steadily decreases or increases. Howevern, IL affects the two strategies differently:

![](https://i.imgur.com/Vq9uBl7.png =500x295)

The Uniswap strategy is more affected by IL on the upside than the downside. Overall, LP seem more exposed to IL than those who follow the MM strategy.

## Strategy implementation

A market maker (MM) provides liquidity for the trading pair X/Y. He posts bids $\{ \delta x_0^+, \delta x_1^+, ..., \delta x_N^+ \}$ and asks $\{ \delta x_0^-, \delta x_1^-, ..., \delta x_N^- \}$ over the price grid $\{p_0, p_1, ..., p_N\}$ with $p_0 < p_1 < ... < p_N$.

Here $p_0=p_{min}$, implying $\delta x_0^-=0$. Likewise, $p_N=p_{max}$ implies $\delta x_N^+=0$.

At price $p_n$, the MM is endowed with $x_n$ and $y_n$ and posts a set of bids at prices $p_{n-1}$, $p_{n-2}$, ... and asks at prices $p_{n+1}$, $p_{n+2}$, ... Bids' size $\delta x_{n-1}^+$, $\delta x_{n-2}^+$, ... and asks' size $\delta x_{n+1}^-$, $\delta x_{n+1}^-$, ... relate to price through $\omega(p)$, the portfolio weight w.r.t. price:
$$
\omega(p_n) = \phi \Big( \dfrac{p_{max} - p_n}{p_{max} - p_{min}} \Big) = \dfrac{p_n x_n }{p_n x_n + y_n}
$$

To find ask's size for price $p_{n+1}$, compute:
$$
x_{n+1} = \dfrac{\omega(p_{n+1}) (y_n + p_{n+1} x_n) }{ p_{n+1} }
$$

Ask's size is $\delta x_{n+1}^- = x_n - x_{n+1}$ and $y_{n+1} = y_n + p_{n+1} \delta x_{n+1}^-$.

For ask's size at price $p_{n+2}$, proceed the same manner:
$$
x_{n+2} = \dfrac{\omega(p_{n+2}) (y_{n+1} + p_{n+2} x_{n+1}) }{ p_{n+2} }
$$

Ask's size is $\delta x_{n+2}^- = x_{n+1} - x_{n+2}$ and $y_{n+2} = y_{n+1} + p_{n+2} \delta x_{n+2}^-$, etc.

For bid's size posted at price $p_{n-1}$:
$$
x_{n-1} = \dfrac{\omega(p_{n-1}) (y_n + p_{n-1} x_n) }{ p_{n-1} }
$$

Bid's size is $\delta x_{n+1}^+ = x_{n-1} - x_n$ and $y_{n-1} = y_n - p_{n-1} \delta x_{n+1}^+$, etc.

### Seeding the pool

The MM starts with arbitrary quantities $x$ and $y$. At price $p_n$, the initial price, the MM targets:
$$
x_n = \dfrac{\omega(p_n) (y + p_n x) }{ p_n }
$$

which he obtains by buying (if negative) or selling (if positive) the quantity $x - x_n$. His inventory in the second asset is $y_n = y + p_n (x - x_n)$.

## Moving the price interval

The price interval can be moved with the aim to minimize the risk of the market price exiting the interval.

Define the (one-sided) interval of price fluctuation
$$
\Delta = \dfrac{p_{max} - p_{min}}{2}
$$

and the mid-price:
$$
\bar{p} = \dfrac{p_{max} + p_{min}}{2}
$$

Instead of expressing the price state w.r.t. the min and max prices, it is expressed in terms of the mid-price and price range:
$$
\dfrac{px}{px + y} = \dfrac{\Delta + \bar{p} - p}{2 \Delta}
$$

The MM strategy is the same as the one described above with $\phi$ linear, except the mid-price used in the computation of the bid and ask sizes is a moving average of past and present prices.

<!--
---

## Setting the price grid

Profit rate from filling a bid at price $p_n$ then an ask at price $p_{n+1}$, both with size $\delta x_{n}$ is:
$$
\dfrac{p_{n+1} - p_n}{p_n}
$$

Hence, seting the profit return from a basic buy/sell operation also determines the price spacing. For reference, the baseline fee rate is $\tau = 0.3\%$ on Uniswap V2 and V3. Since LP in Uniswap take the fee rate both on the buy and sell volumes, the corresponding profit rate is:
$$
\dfrac{p_{n+1} - p_n}{p_n} = 2 \tau
$$

If the price move is larger, profit rate from filling two bids at prices $p_n$ and $p_{n-1}$, then two asks at prices $p_n$ and $p_{n+1}$, with all orders of size $\delta x_{n}$, is:
$$
\dfrac{p_n + p_{n+1} - p_n - p_{n-1}}{p_n} = \dfrac{p_{n+1} - p_n}{p_n} + \dfrac{p_n - p_{n-1}}{p_n}  =4 \tau
$$

which is also what would earn Uniswap LP.

For $\tau =$ 0.003, the price grid would have a constant increase rate equal to 0.006, which would give the following spacing around 3000 for ETH/USD:

| 2964   | 2982    | 3000     | 3018    | 3036      |

Note that this is not the rate that maximizes profit, which is unknown. A less granular spacing would increase profit rate but forego low frequency volume. Setting the trade-off necessitates backtesting the spacing parameters with on-chain prices.

For comparison, in Uniswap V3 each tick (the boundary between two liquidity buckets) is 0.0001 (0.01%) [actually 0.1% for 0.3% fee rate and 2% for 1% fee rate] away from each of its neighbors [Note: this value is indicated in the white paper but is obviously not what we see in practice. I apparently missed sth.]

## Impermanent loss

Market making basically consists in buying at low price and seeling at higher price.  In Uniswap-type AMM, arbitrageurs force the pool to buy the token which price is decreasing and sell the token which price is increasing. In both cases, the strategy is loosing when the price increasingly deviates from its initial level compared to a simple holding strategy.

The loss has been qualifed as [impermanent](https://pintail.medium.com/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2) in Uniswap V2 as it disapears when the price return to its initial state due to a property called [path independence](https://vitalik.ca/general/2017/06/22/marketmakers.html).

In the MM strategy described in this post, [path independence](https://hackmd.io/@pre-vert/path) is satisfied if it satisfies $\delta x_n^+ = \delta x_{n+1}^-$.






---

Market makers active in limit order books post bids and asks around the mid-price and benefit from the bid/ask spread.

The next Figure shows how inventory weight changes with price state. Basically, the MM broadens its price range while still concentrating

![](https://i.imgur.com/biUMZ4m.png =440x330)

The lower volatility (e.g. when the two assets are pegged or soft-pegged), the higher the curvature parameter (although narrowing the price interval could be a substitute). The S-shaped curve with $\gamma=5$ is:

![](https://i.imgur.com/ujleS7V.png =440x330)

#### Concave or convex functions

The $\phi$ function could also be convex or concave:
$$
w(1-s) = (1-s)^{\gamma}
$$

The concave case ($\gamma > 1$) applies to situations where:
- the price distribution is left-skewed: the probability mass is concentrated near the maximum price and the distribution has a long tail of low prices
- the MM wants to protect against downside risk, not upside risk.


A concave curve with $\gamma=0.5$:

![](https://i.imgur.com/hUMFqxh.png =440x330)

<!-- To the contrary, in the first case in which the MM trades as if he had a multiple of his inventory, the relation is convex, which means that he implicitly wants to protect against upside risk, not downside risk


---

If the price increases to $p_{n+1}$:
$$
\omega(p_{n+1}) = \dfrac{p_{n+1} (x_n - \delta x_{n+1}^-)}{p_{n+1} (x_n - \delta x_{n+1}^-) + y_n - p _{n+1}\delta x_{n+1} } = \dfrac{p_{n+1} x_{n+1} }{p_{n+1} x_n + y_{n+1} }
$$

Rearranging terms:
$$
x_{n+1} = \Big( 1 + \dfrac{p_n}{p_{n+1}} \dfrac{1-\omega(p_n)}{\omega(p_n)} \Big) \omega(p_{n+1}) x_n
$$

Iterating:
$$
x_{n+2} = \Big( 1 + \dfrac{p_{n+1}}{p_{n+2}} \dfrac{1-\omega(p_{n+1})}{\omega(p_{n+1})} \Big) \omega(p_{n+2}) x_{n+1}
$$

Ans so on. Asks' sizes are $\delta x_{n+1}^- = x_n - x_{n+1}$, $\delta x_{n+2}^- = x_{n+1} - x_{n+2}$, ...

The inverse relation is used for bids when price decreases:
$$
x_{n-1} = \Bigg[ \Big( 1 + \dfrac{p_{n-1}}{p_n} \dfrac{1-\omega(p_{n-1})}{\omega(p_{n-1})} \Big) \omega(p_n) x_{n-1}\bigg]^{-1} x_n
$$

$$
x_{n-2} = \Bigg[ \Big( 1 + \dfrac{p_{n-2}}{p_{n-1}} \dfrac{1-\omega(p_{n-2})}{\omega(p_{n-2})} \Big) \omega(p_{n-1}) x_{n-2}\bigg]^{-1} x_{n-1}
$$

Ans so on. Bids' sizes are $\delta x_{n+1}^+ = x_{n-1} - x_n $, $\delta x_{n-2}^+ = x_{n-1} - x_{n+2}$, ...



MM's **notional budget** is wealth $w_0$ at minimum price $p_0$:
$$
w_0 = p_0 \sum_{i=0}^{N-1} \delta x_i^+
$$

Date 0 (maximum) endowment in X is:
$$
x_0 = \sum_{i=0}^{N-1} \delta x_i^+ = \dfrac{w_0}{p_0}
$$

For $p_1$:
$$
x_1 = p_1 \sum_{i=n}^{N-1} \delta x_i^+ + p_0 \delta x_0^+
$$

---


Let's start from the minimum price. Given that $\omega(p_0)=1$:

$$
\delta x_0^+ = \delta x_1^- = x_0 (1 - \omega(p_1))
$$

and
$$
x_1 = x_0 - \delta x_1^- = x_0 \omega(p_1)
$$

Next, for $p_2$:
$$
\delta x_1^+ = \delta x_2^- = x_1 \bigg[ 1 - \omega(p_2) \Big( 1 + \dfrac{p_1}{p_2} \dfrac{1-\omega(p_1)}{\omega(p_1)} \Big) \bigg]
$$

and
$$
x_2 = x_1 - \delta x_2^- = x_0 \omega(p_1) - \delta x_2^-
$$

So on, until $\omega(p_N)=0$:
$$
\delta x_{N-1}^+ = x_{N-1}
$$

and $x_N = 0$.


---

Wealth at price $p_n$ is:
\begin{aligned}
w_n =& p_n \sum_{i=n}^{N-1} \delta x_i^+ + y_n \\ =& p_n \sum_{i=n}^{N-1} \delta x_i^+ + w_N - \sum_{i=n}^{N-1} p_i \delta x_i^+ \\ = & w_N - \sum_{i=n}^{N-1} (p_n  - p_i) \delta x_i^+
\end{aligned}

If the price reaches its minimum, the MM is 100% in X:

---

MM's **notional budget** is defined as wealth $w_N$ at the maximum price $p_N$. At this price, $w_n$ is 100% in Y. Wealth at price $p_n$ is:
\begin{aligned}
w_n =& p_n \sum_{i=n}^{N-1} \delta x_i^+ + y_n \\ =& p_n \sum_{i=n}^{N-1} \delta x_i^+ + w_N - \sum_{i=n}^{N-1} p_i \delta x_i^+ \\ = & w_N - \sum_{i=n}^{N-1} (p_n  - p_i) \delta x_i^+
\end{aligned}

If the price reaches its minimum, the MM is 100% in X:
$$
w_0 = p_0 \sum_{i=n}^{N-1} \delta x_i^+
$$


## Appendix

### Trading beyond one's means

An alternative concentration strategy is to follow a fixed weight strategy while trading beyond one's means. For instance, suppose the MM has \$1m but trades *as if* he had \$10m. His trade sizes would be 10$\times$ larger than with \$1m. This succeeds in concentrating liquidity over some price interval, yet is not sustainable for large price variations as the MM would eventually fall short of one of the two assets.

Define MM's current wealth $W=p x + y$ and inflated wealth $\alpha W = p \alpha x + \alpha y$ (with wealth multiplier $\alpha \geq 1$)  that the MM uses to calculate how much to rebalance based on price $p$ and initial inflated inventories $\alpha x$ and $\alpha y$: $p \alpha x' = \omega \alpha W$ and $\alpha y' = (1-\omega) \alpha W$.

While target weight $\omega$ is constant, actual weight is actually moving with price:
\begin{aligned}
\omega' & = \dfrac{p \big( x + (\alpha x'-\alpha x) \big) }{W} \\
& = \dfrac{p \big( x + \big( \dfrac{1}{p} \omega \alpha W - \alpha x \big )\big) }{W} \\
& = \alpha \omega - (\alpha - 1) \dfrac{p x}{W}
\end{aligned}

The relation between actual weight and price is decreasing:
$$
\frac{\partial \omega'}{\partial p} = - (\alpha - 1) \dfrac{x y}{W^2} \leq 0
$$

and convex:
$$
\dfrac{\partial^2 \omega'}{\partial p^2} = 2 (\alpha - 1) \dfrac{x^2 y}{W^3} \geq 0
$$

The figure illustrates the relationship between actual weight and price state with $x = y = 1$, $\omega = 0.5$ and amplification parameter $\alpha = 5$. In this example, $p_{min} = 0.60$ and $p_{max} = 1.67$.

<center>Relation between inventory weight and price state</center>center>

![Relation between inventory weight and price state](https://i.imgur.com/dp3k6Ui.png)

A convex relation is not particularly efficient as it tends to amplifies downside inventory risk.

<!--


The mid-price is 
$$
\bar{p} = \dfrac{p_{max} + p_{min}}{2}
$$

and the (one-sided) interval of fluctuation presumed by the MM is:
$$
I/2 = \dfrac{p_{max} - p_{min}}{2}
$$


Define portfolio weight without rebalancing:
$$
\omega^*(p') = \dfrac{p' x}{p' x + y }
$$

Asset variation is equal to the ratio of the two weights with and without rebalancing:
$$
\dfrac{x'}{x} = \dfrac{\omega(p')}{\omega^*(p')} = 
$$

weights with and without rebalancing:
$$
\dfrac{x'}{x} = \dfrac{\omega(p')}{\omega^*(p')} = 
$$

---
Since $p' \leq p$, $\omega'(p) \geq 0$ implies $x' \geq x$. 

In the linear case ($w(p)=p$):
$$
\dfrac{x'}{x} = \dfrac{\omega(p')}{\omega^*(p')}
$$

$$
\omega(p) = \dfrac{p_{max} - p}{p_{max} - p_{min}} 
$$

---

### First expression

Define
$$
\dfrac{x}{y} = \beta(p)
$$

with $\beta'(p) \leq 0$.

Particular case: $\beta(p) = \alpha p$ implies a Uniswap V2 style constant allocation:
$$
\dfrac{px}{y} = \alpha
$$

If price increases to $p'$:
$$
\dfrac{x- \Delta x}{y+p' \Delta x} =  \dfrac{x- \Delta x}{x/\beta(p)+p' \Delta x} = \beta(p')
$$

Rearranging terms:
$$
\dfrac{\Delta x}{x} = \dfrac{\beta(p') - \beta(p)}{ \beta(p') + p'}
$$

Since $p' \geq p$, $\beta'(p) \geq 0$ implies $\Delta x \leq 0$.


---

### First expression

Define
$$
\dfrac{y}{x} = \beta(p)
$$

with $\beta'(p) \geq 0$. 

Particular case: $\beta(p) = \alpha p$ implies a Uniswap V2 style constant allocation:
$$
\dfrac{y}{px} = \alpha
$$

If price increases to $p'$:
$$
\beta(p') = \dfrac{y+p' \delta x}{x- \delta x} =  \dfrac{\beta(p)x+p' \delta x}{x- \delta x}
$$

Rearranging terms:
$$
\dfrac{\delta x}{x} = \dfrac{\beta(p') - \beta(p)}{ \beta(p') + p'}
$$

Since $p' \geq p$, $\beta'(p) \geq 0$ implies $\delta x \geq 0$.


### Alternative expression

-->


