Make sure that you have read the Adding Liquidity article, dedicated to learning what happens when you liquidity is added to a market, before reading this section.
We assume that, since liquidity had to be added before it can be removed, you'll carry the understanding of the concepts to this section.

# Introduction

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.**

When the prices of all outcomes are equal, removing liquidity will not result in the Liquidity Provider receiving any outcome shares.

# Removing liquidity while the market is open

As described in Strategies and Risks for Liquidity Providers, and exemplified below, a Liquidity Provider should always aim to remove their liquidity before a market closes.

Assuming that you understood the dynamics of adding liquidity to a market, let's jump straight into a couple of example.

## Removing liquidity from a binary outcome market

Let’s first look at an example using binary outcomes with unequal outcome prices, continued from the example in Adding Liquidity:

**Example: Removing liquidity from a market with unequal binary outcome prices**As seen previously in Adding Liquidity, Bob added $1000 USDC in liquidity to Alice's market. The market is now nearing its expiration date, so it's time for Bob to consider removing the liquidity he had previously added and close his overall position in this market. Bob has read this article, as well as Strategies and Risks for liquidity providers attentively, and knows that when he removes his liquidity, part of his stake will result in him getting back shares from the least likely outcome, which, by definition, are less likely to hold any value once the market is resolved. Indeed, after resolution, the value of the shares of the losing outcome becomes 0, and the value of the shares of the winning outcome becomes 1. Bob's plan is to remove his liquidity, claim his rewards earned from the fees, sell the shares of Outcome B that he'll receive, and hold on to the shares of Outcome A until the market resolves, as he's confident that it will be the winning outcome. The market currently looks likes this:

Liquidity Value | $5600 USDC |

Price of Outcome A | 0.71 |

Price of Outcome B | 0.29 |

Shares of Outcome A | 3578.97 |

Shares of Outcome B | 8762.30 |

And Bob's portfolio for this market currently looks like this:

Liquidity shares | 782.88 |

Shares of Outcome A | 387.10 |

Note that the price of Outcome A has gone up slightly since Bob added $1000 USDC in liquidity, from 0.62 to 0.71. The value of the Outcome A shares that Bob holds is now $274.841 USDC, up from ~$240 USDC.

So now Bob wants to give back his 782.88 shares of the Liquidity Pool and claim USDC. The first thing that happens is the valuation of those shares. The formula is:

In this case, we have:

Now that we know that Bob's LP shares are worth $500.34 USDC, we can go ahead and calculate how many shares of Outcome B he'll get in addition to the $500.34 USDC that he’s claiming back. The temporary state of the market is:

Liquidity Value | $5600 - $500.34 = $5099.66 USDC |

Shares of Outcome A | 3078.629 |

Shares of Outcome B | 8261.962 |

As you'd now expect, this temporary status violates the constant function, which would change the outcome prices, and so needs to be rebalanced.
To do so, we recalculate the number of shares that should remain in the Outcome B pool, since Bob will get shares from that pool. The formula is:

Therefore, Bob will get

`8261.962 - 7537.33 = 724.630`

shares of Outcome B, and the new market status is:Outcome A Shares | 3078.629 |

Outcome B Shares | 7537.33 |

Liquidity Value | USDC |

Now that Bob got $500.34 USDC back from the $1000 USDC he put in the Liquidity Pool, his portfolio looks like this:

Outcome | Shares | Price | Value |

Outcome A | 387.10 | 0.71 | $274.841 USDC |

Outcome B | 724.630 | 0.29 | $202.8964 USDC |

Total | $477.7374 USDC |

Bob's strategy in this market could net him some profits once it's resolved and if indeed Outcome A is the winning outcome.
Let's see it in detail:

Outcome | Shares | Redeemed at | Value |

Outcome A | 387.10 | $1 USDC | $387.10 USDC |

Outcome B | 724.630 | $0.29 USDC - 2% fees | $198.84 USDC |

Liquidity | 782.88 | $0.64 USDC | $500.34 USDC |

Total | $1,086.28 USDC |

Bob’s profit, before any LP fees he was awarded while he had liquidity in the market, will have been roughly +8.6%.

We see how beneficial it will have been for Bob to have received the rewards from the 2% trading fees, and how liquidity provisioning is more likely to be profitable when entering the markets while prices are even, and when we believe that the most likely outcome will indeed be the winning outcome.
We also see the importance of being opinionated about the market outcomes. Bob believed that Outcome A would prove to be winning outcome, and could have increased in total profitability if he had bought more shares of Outcome A.
To sum up the example:

- Bob adding liquidity to the market that he believed could yield a high trading volume,

- Bob improved the quality of the market by making it more liquid.

- Bob added liquidity at a time when Outcome A was, in his opinion, underpriced.

- Bob removed liquidity before the market expired so he could still sell the shares of the least likely outcome, diminishing his risk.

- Bob profited from holding the shares of the winning outcome, whose value went to 1 after resolution, and from the trading fees he received for being a liquidity provider.

- Bob could have increased his profit from this market had he bought more shares of the winning outcome, doubling down on his opinion that Outcome A was underpriced and was going to win.

**Read**

**Strategies and Risks for Liquidity Providers**

**before you decide to add or remove liquidity to prediction markets.**

## Removing liquidity from a multiple outcome market

Now let’s look at an example using multiple outcomes with unequal outcome prices, continued from the example in Adding Liquidity:

**Example: Removing liquidity from a market with multiple outcome**Charlie had created this market with 1000 USDC in liquidity and equal outcome prices.

He now sees that Outcome A is being favored by forecasters, and it so happens that he doesn’t believe that Outcome A will be the winning outcome.

In his mind, it’s now a good time to divest some of his liquidity in exchange for shares of Outcomes B, C and D, the price of which he believes is likely to go up when other forecasters start realising that Outcome A is overpriced.

He still believes that his market will be popular and can yield a fair amount in trading fees if it’s liquid enough, so he’ll only partially divest his liquidity position. He decides to trade back 300 shares of the Liquidity Pool for some USDC and shares of Outcomes B, C and D.
The market currently looks likes this:

Pool | Shares | Price |

Outcome A | 812.46 | 0.48 |

Outcome B | 2294 | 0.17 |

Outcome C | 2294 | 0.17 |

Outcome D | 2294 | 0.17 |

Liquidity | 1769.68 | N/A |

And Charlie’s portfolio for this market currently looks like this:

Liquidity shares | 1000 |

So now Charlie wants to give back 300 shares of the Liquidity Pool and claim USDC. The first thing that happens is the valuation of those shares. The formula is:

In this case, we have:

Now that we know that Charlie’s 300 LP shares are worth ~$231.43 USDC (rounded), we can go ahead and calculate how many shares of Outcomes B, C and D he'll get in addition to the ~$231.43 USDC that he’s claiming back.

The temporary state of the market now is:

Shares of Outcome A | 812.46 - 231.43 = 581.03 |

Shares of Outcome B | 2294 - 231.43 = 2062.57 |

Shares of Outcome C | 2294 - 231.43 = 2062.57 |

Shares of Outcome D | 2294 - 231.43 = 2062.57 |

As you'd now expect, this temporary status violates the constant function, which would change the outcome prices, and so the market needs to be rebalanced.
Charlie will receive shares of all outcomes except for the most likely, meaning shares of B, C and D. So let’s calculate how many shares of each should remain in the pool, so that the market remains balanced.

And given that Outcomes C and D have the same number of shares and the same price as outcome B, we have the following market status:

Shares of Outcome A | 581.03 |

Shares of Outcome B | 1640.55 |

Shares of Outcome C | 1640.55 |

Shares of Outcome D | 1640.55 |

Liquidity Value | (rounded) |

Bob will get

`2062.57 - 1640.55 = 422.02`

shares of Outcomes B, C and D, leaving his portfolio with:Liquidity Shares | 700 |

Outcome B Shares | 422.02 |

Outcome C Shares | 422.02 |

Outcome D Shares | 422.02 |

**Read**

**Strategies and Risks for Liquidity Providers**

**before you decide to add or remove liquidity to prediction markets.**

# Removing liquidity after a market is resolved

Removing liquidity after a market is resolved is not ideal, but it’s still possible.

In this situation, the value of a liquidity share is calculated as follows:

For example, in a hypothetical a market that has $1000 USDC in liquidity and resolves to Outcome A, of which there are 500 shares, a Liquidity Provider that is claiming back 300 shares of the Liquidity Pool after resolution, will get $150 USDC back.

**Read**

**Strategies and Risks for Liquidity Providers**

**before you decide to add or remove liquidity to prediction markets.**

*A special thank you to*

*Polkamarkets Discord*

*member NFT_Trader for helping write the examples for removing liquidity in multiple outcome markets, and removing liquidity after a market is resolved.*