> For the complete documentation index, see [llms.txt](https://funarchy.gitbook.io/funarchy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://funarchy.gitbook.io/funarchy/security-for-prediction-market/trading-mechanism/amm-risks/permanent-loss/unequal-market-state.md).

# Unequal market state

Contrary to scenario A, unequal market state mean that Yes/No shares price are not equal.

{% stepper %}
{% step %}
Liquidity is provided after trading occurs in "Permanent Loss - Market creation stat". (80:20)

* Action: User C provides liquidity of 1,000 USDC.
* LP Position: Temporarily deposit $1000 previously deposited by User A and $1000 added by User C.
  * $$Yes(500 + 1000)$$, $$No(2000 + 1000)$$
  * $$Liquidity Value(1000 + 1000) = 2000$$
  * However, in the current calculation formula, the product of $$Yes$$ and $$No$$ does not equal a constant value.
  * Therefore, since price fluctuations occur when this constant formula is broken, a formula exists to adjust this and calculate how much LP share to distribute to user C. This formula always returns a portion of the $$Yes$$ or $$No$$ shares, which are currently at a high price and thus have a high probability of winning, to those who provided liquidity to adjust the constant.\
    \
    When providing liquidity in an imbalanced market, tokens with high current value are provided together with LP shares. LP shares are tokens that can be immediately converted to USDC later.<br>
  * $$OutcomePriceA$$ : The price of the share with the higher probability at present\
    $$OutcomePriceB$$ : The price of the share with the current lower probability$$OutcomeShareA$$ : Among Yes/No, the number of shares with a higher probability are given to liquidity providers and the remaining number is the remaining number.\
    $$OutcomeShareB$$ : Among Yes/No, this is the share with the lower probability.
  * * $$OutcomeShareA = \frac {OutcomeShareB \* OutcomePriceB} {OutcomePriceA}$$<br>
  * If we consider A in the above formula as having a high present value:
    * $$OutcomeShareYes(x) = \frac {OutcomeShareNo(2000 + 1000) \* 0.2} {0.8}$$
    * $$OutcomeShareYes(x) = 750$$
    * $$Yes(750) \* No(3000) = 1500^2$$
    * The LP share and Yes share returned to user C through the values ​​obtained in this way are as follows:
      * $$Yes(1500) - OutcomeShareYes(750) = Yes(750)$$
      * $$Liquidity Value(1500) -  Liquidity Value(1000)= LPshare(500)$$
        {% endstep %}

{% step %}
**Trading occurs**

* Situation: As time passes and information and news emerge that Trump's chances of winning increase, User B purchases another $1,000 worth of Yes.
* AMM Action: FPMM temporarily provides liquidity to the formula that processes these orders.
  * It must not be broken before $$1500^2$$.
    * $$Yes(1750) \* No(4000) \not = 1500^2$$
  * So, with the information we know, $$No(4000)$$, and the fixed value $$1500^2$$we can calculate the Yes share that will come out later.
    * $$Yes(x) \* No(4000)  = 1500^2$$
      * $$Yes(x) = 1500^2 / No(4000)$$
      * $$Yes(x) =  562.5$$
  * This should leave you with a total of 562.5 Yes shares for a total of $1000.
* LP Position Change:\
  In the end, we give Yes shares to User B, and since the remaining amount should be 562.5, we give $$Yes(1750) - Yes(562.5) = 1187.5$$  Yes shares. In this case, both Users A and B end up losing money.
* Here is the formula for how much money Users A and B lose:
  * $$Yes(562.5) \* No(4000) = 1000^2$$
  * This changes the Yes/No price ratio from 80:20 ⇒ 87:13.
  * User A's loss up to this point can be derived using the following formula.
    * $$V(p) = (\text{YES Price}) + (\text{No Price})$$
    * $$V(p) = \mathbf{2} \cdot \sqrt{k} \cdot \sqrt{p(1-p)}$$
    * *Initial price ratio*: $$V(0.5) \propto \sqrt{0.5 \times 0.5} = \sqrt{0.25} = 0.5$$
    * *Price ratio thereafter*: $$V(0.8) \propto \sqrt{0.87 \times 0.13} = \sqrt{0.11} = 0.3$$
    * $$Ratio = \frac{V(0.87)}{V(0.5)} = \frac{0.33}{0.5} = 0.66 \quad (66%)$$
  * So, User A's funds are reduced from $1000 to only $660.
  * If User B calculates the loss like User A, it is as follows:
    * *Initial price ratio*: $$V(0.8) \propto \sqrt{0.8 \times 0.2} = \sqrt{0.16} = 0.4$$
    * *Price ratio thereafter*: $$V(0.8) \propto \sqrt{0.87 \times 0.13} = \sqrt{0.11} = 0.3$$
    * $$Ratio = \frac{V(0.87)}{V(0.8)} = \frac{0.33}{0.4} = 0.825 \quad (82.5%)$$
  * User B also only has about 82.5% of his initial assets left.
    {% endstep %}

{% step %}
**Market closed and loss confirmed**

* Conclusion: \
  User A, the creator of the market, will have $375 left, which is 2/3 of the 562.5 Yes shares that were initially provided with $1,000.\
  \
  User B receives 750 as liquidity provider, plus 187.5 Yes shares, which is 1/3 of the remaining shares in the pool, leaving only $937.5.
* If there is a 3% fee in the current market, User A will receive $50 and User B will receive $10.\
  Still, User A has $425, and User B has $947.5. Ultimately, liquidity providers have incurred permanent losses.

{% hint style="info" %}
Why does User A receive $50?

The reason is that when the initial transaction was conducted, since A alone provided liquidity, all fees incurred at that time went to A.&#x20;

Later, when User C provided liquidity, the fees incurred in the transaction were taken according to each LP share, so it was $50.

* First transaction: $30 all to A.
* Second transaction: $20 for A, $10 for B.
  {% endhint %}
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://funarchy.gitbook.io/funarchy/security-for-prediction-market/trading-mechanism/amm-risks/permanent-loss/unequal-market-state.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
