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

# Auto Rebalancing

Each portfolio is designed to keep a target allocation across its tokens (for example: a Blue Chip strategy with $BONK - 22%, $JLP - 20%, $JUP - 20%, $JITO -20% and $PYTH - 18%). Over time, token prices move, and these weights drift.

To preserve the portfolio’s structure, an auto-rebalancing engine monitors the vault continuously.

**How it works:**

1. Drift Monitoring
   * The engine checks (uses [Switchboard](https://docs.switchboard.xyz/product-documentation/data-feeds/getting-started-with-switchboard-data-feeds) oracle every 1 min) if the weight of any token deviates more than the threshold defined by the vault manager or the admin (e.g. 10%) from its target allocation.
   * Example: If $BONK should be 22% but grows to 32%, it’s flagged for rebalancing.
2. Triggering Rebalance
   * When drift exceeds the threshold, a rebalance is triggered.
   * The rebalancing engine operates on a delta basis. Using the vault’s swap function, it executes only the minimal set of trades required to restore the target allocation, selling overweight assets and reallocating into underweight ones.
   * To maximize capital efficiency and reduce the frequency of rebalancing events, each deposit is allocated to assets that are furthest from their target weights, bringing the portfolio as close as possible to the intended allocation.
3. Execution
   * Rebalance swaps are executed atomically through Jupiter aggregator.
4. Outcome
   * Vault composition is restored to its target weights.
   * dToken price (NAV) remains continuous, as TVL is preserved (minus minor trading fees/slippage).
   * Users don’t need to take any action - it’s fully automatic.

**Why it matters:**

* Keeps portfolios and strategies true to their narrative (you always get the intended exposure).
* Protects against over-concentration in a single asset.
* Makes the product truly “set and forget” for users.

*Rebalancing is executed autonomously by the protocol. dToken holders do not initiate or control individual swap transactions.*


---

# 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.diversifi.trade/auto-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.
