# Fixed Product Market Maker

xParametric uses an Fixed Product Market Marker (FPMM) developed by Gnosis. A introduction can be found at https://docs.gnosis.io/conditionaltokens/docs/introduction3/.

FPMM are responsible for the most important aspects of the markets: liquidity and price setting. It always forces a balance in the number of shares of each outcome in the market. When an imbalance is introduced (by adding or removing shares to any pool), outcome prices change and shares are redistributed between the trader or liquidity provider, and the share pools.

#### Pool Share Calculation Function

where LS=Liquidity Shares

#### Outcome Price Calculation Function

Before we can calculate the outcome prices, we must first calculate their relative weight.

To calculate the Price Weight for a given outcome, we multiply the number of shares available in the pool of every other outcome.

Once we have the Price Weight of every Outcome, we can determine the price on an outcome.

**Price calculation at the time of a trade**

When a trade happens, a number of shares of a particular outcome is bought or sold, which means that shares are added or removed from that outcome's pool, and that shares are added to or removed from the prediction market participant's balance. As the distribution of shares available in the overall pool changes, so changes the price of each outcome.

Consider a case where a user decides to buy x USDC worth of shares of Outcome A in the market with n outcomes.

For any outcome other than A, their new share is equal to

Now using the Pool Share Calculation Function, we can get the new share of outcome A and consequently its prce using the outcome price function.

Last updated