> For the complete documentation index, see [llms.txt](https://docs.predy.finance/predy-v6/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.predy.finance/predy-v6/dev/position-value.md).

# Position Value

### Position Value

$$
v\_p:=p \cdot amount\_{base}+2\sqrt{p} \cdot amount\_{squart}+amount\_{quote}
$$

where $$amount\_{base}$$ is the Base token amount, $$amount\_{squart}$$ is the Squart amount, $$amount\_{quote}$$ is the Quote token amount, and `p` is the current price of the Base token. If the amount is positive, it is considered an asset, and if negative, it is considered a liability.

### Vault Value

The Vault-Value is defined as follows. *Margin* is the amount of collateral.

$$
V\_p=v\_p+margin
$$

### Min. Margin

Min. Margin represents the minimum required Vault-Value. To ensure the position value does not become zero even if the price moves by `r`, the difference between the minimum value of the position within a price movement of +/- `r`% and the current value is set as the minMargin. Predy defines Min. Margin at the price `p` as forrow. In the case of the short Squart position, the $$v\_p$$ is convex downwards, causing the Min. margin to become zero. To create a buffer, add the value obtained by multiplying the short Squart's value by $$r\_{debt}$$ to the Min. margin.

$$
min\_p := v\_p-Min{
v\_{pr},
v\_{\frac{p}{r}},
v\_{(\frac{amount\_{base}}{amount\_{squart}})^2}
}+Min{0, -r\_{debt} \cdot (2\sqrt{p} \cdot amount\_{squart})}
$$

`r` is risk parameter(e.g. r = 1.02).

$$r\_{debt}$$ is (e.g. $$r\_{debt}$$ = 0.001)

&#x20;Price $$(\frac{amount\_{base}}{amount\_{squart}})^2$$ is the minimum (or maximum) when considering the position value as a polynomial.

### Safe Condition

The condition for a sufficiently safe position can be expressed by the following formula. If this condition is not met, the position will be forcibly liquidated.

$$
V\_p >= min\_p
$$


---

# 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://docs.predy.finance/predy-v6/dev/position-value.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.
