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

# Rebalancing

Although concentration and the use of an oracle are sufficient for the protocol to efficiently market make, it lacks the simplicity of standard constant product pools where the total value of each asset in a pool are always equal. To add a similar property while maximizing profit, the protocol rebalances its pools by adjusting their liquidity.

This adjustment of liquidity occurs on every trade and/or change in oracle price according to the following formulae.

To increase liquidity for x:

$$
K\_{adjusted} = K ⋅ (x ⋅ p / y)^z
$$

To decrease liquidity for x:&#x20;

$$
K\_{adjusted} = K ⋅ (y / (x ⋅ p))^z
$$

where K is the total amount of liquidity, p is the price of x provided by the oracle, and z is the parameter that determines the magnitude of the adjustment.

For example, when x comprises less than 50% of the total value of the pooled assets, the market maker will decrease liquidity for buyers of x and increase liquidity for sellers of x in an effort to regain balance. This will incentivize traders to sell against the pool while discouraging them from buying, ensuring that the pool balance regresses to the bonding curve.


---

# 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.lifinity.io/dex/rebalancing.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.
