> For the complete documentation index, see [llms.txt](https://docs.prophecy.bet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prophecy.bet/sell-trades.md).

# Sell Trades

#### Purpose

The Sell function allows users to sell their shares of a specific outcome in exchange for a selected coin. The AMM dynamically adjusts the price based on the remaining pool liquidity.

#### Workflow

1. Input Parameters:

* Market ID.
* Outcome to sell.
* Number of shares the user wants to sell.

2. Price Calculation:

* The AMM calculates the amount of collateral the user will receive for the shares sold

3. pool Update:

* Shares are added back to the pool.
* Collateral is removed to maintain the constant product.

4. Collateral Transfer:

* The calculated collateral is transferred to the user.

5. Fee Deduction:

* A small fee is deducted and distributed to liquidity providers or the platform treasury.
