# Adding and Removing Liquidity

### Adding Liquidity

When a Liquidity Provider adds liquidity to an existing market, two things will happen:

the Liquidity Provider will be assigned with a number of shares of the Liquidity Pool pro rata the Liquidity Pool share that the Liquidity Provider is funding.

if the outcome prices are not equal, the Liquidity Provider will receive shares of all the outcomes, except for the least likely, i.e. the least expensive outcome, at the moment of the funding.

When a Liquidity Provider adds liquidity to a market, they in fact increase the number of shares in all pools in that market.

If the number of outcome shares is equal (i.e. if the outcome prices are equal), adding liquidity will not change the balance of the equation, and therefore the Liquidity Provider will only receive shares of the Liquidity Pool in return for adding liquidity to the market.

If, on the contrary, the number of shares in each pool is unbalanced (i.e. if the outcome prices are not equal), then adding liquidity would change the balance of the equation, which would cause a change in outcome prices. To avoid that, the AMM gives the Liquidity Provider shares from the most likely outcome(s), but not from the least likely outcome(s) (i.e. the outcome(s) with the lowest price), in addition to shares from the Liquidity Pool.

Now consider a case where all outcomes other than A share the same price and is the least likely outcome.

We can calculate the share of outcome A a user will get by adding X as liquidity using:

And get the liquidity value by

And now we can calculate how many LP and Outcome A shares will be given to the user with a simple subtraction:

First, we calculate the Price of all Outcomes using the formula:

### Removing Liquidity

Removing liquidity from a market has the same constraints, and the opposite effect, of adding liquidity to a market. As the price of the outcomes cannot be impacted by the rebalancing of the pools, the Liquidity Provider will receive shares of all the outcomes except for the most likely (i.e.. least expensive) outcome (instead of all but the least likely) when removing liquidity from a market.

The calculation follows the calculation done in Adding Liquidity except by replacing "least likely" by "most likely".

Last updated