# Auto-compounding & Rebalancing

These two mechanics are the core of how AlphaFi strategies actually work. Auto-compounding applies to every vault. Auto-rebalancing applies only to CLMM vaults.

### Auto-Compounding

Auto-compounding is an on-chain operation that invests your earned rewards back into the vault.&#x20;

#### **How auto-compounding works?**

Three steps:

1. **Claim** — Pull pending rewards from the underlying protocol
2. **Swap** — Convert them to the vault's underlying asset.
3. **Reinvest** — Add the swapped output back into the position

After auto-compounding, every receipt token is worth slightly more. No new receipt tokens get minted.

#### **Compounding frequency**

Vaults auto-compounds **several times a day** — typically every 2 hours. The exact cadence is tuned per vault. High-yield vaults compound more often. Low-yield ones compound less often to avoid wasting gas on tiny returns.

#### **Impact on APY**

Compounding frequency is the difference between APR and APY:

* **APR** = raw annual rate, no reinvestment
* **APY** = what you actually earn after compounding

More frequent compounding = higher APY for the same APR. But the gains shrink fast. A 50% APR becomes:

* 64.8% APY with daily compounding
* 64.86% APY with hourly compounding
* 64.87% APY with continuous compounding

Past daily, the extra gain is barely there. So AlphaFi tunes for "often enough to capture most of it" without spending gas needlessly.

***

### Auto-Rebalancing (CLMM only)

A concentrated liquidity position only earns fees while price is *inside* its range. Sit out of range long enough and you earn nothing.

Auto-rebalancing fixes this by resetting the range automatically.

#### **Target LP Range**

The price band the vault keeps its position centered on. Examples:

* **USDC-USDT vault**: maybe 0.999-1.001. Extremely tight because both assets are pegged.
* **SUI-USDC vault**: maybe ±10-15% around current price.
* **WETH-USDC vault**: even wider.

#### **Reset Range / Trigger**

The threshold that fires a rebalance. If the position is centered at price *P* with a ±5% trigger, the vault waits until price hits *P × 1.05* or *P / 1.05* before resetting.

Triggering on every small price move burns gas. Waiting too long means earning zero for too long. The trigger threads this needle.

#### **Rebalancing logic**

When the trigger fires:

1. Close the current LP position (withdraw both assets)
2. Claim any accrued fees and rewards along the way
3. Swap to rebalance assets to the right ratio for the new range
4. Open a fresh position centered on the new current price
5. Roll the collected rewards into the new position

All one transaction. The vault's TVL stays roughly the same — only a bit of swap slippage is lost.

<details>

<summary><strong>Example: Rebalance event</strong></summary>

A SUI-USDC vault sits centered at SUI = $2.00 with a ±5% trigger. The position covers \~$1.80 to $2.20.

* SUI rallies to $2.15 → still in range, no rebalance
* SUI dips to $1.95 → still in range
* SUI breaks up to $2.25 → trigger fires

Now the vault:

* Closes the position. As price rose, the AMM math sold off SUI for USDC, so the position is now USDC-heavy.
* Swaps some USDC back into SUI to hit 50/50.
* Opens a fresh position centered at $2.25, covering \~$2.02 to $2.48.
* Resumes earning fees in the new range.

Time spent not earning: a few seconds during the transaction itself.

</details>

### Reward Routing

How reward tokens get from "earned by the underlying protocol" to "compounded into your position."

**Claim → Swap → Reinvest.**

* **Claim** — Pull accrued rewards from the underlying protocol into the strategy contract
* **Swap** — Swap rewards into the vault's underlying asset(s). For a USDC-USDT vault, SUI rewards become USDC and USDT in the right ratio. For a single-asset USDC vault, everything becomes USDC.
* **Reinvest** — Add the output back into the strategy's position


---

# Agent Instructions: 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:

```
GET https://docs.alphafi.xyz/strategies/auto-compounding-and-rebalancing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
