> For the complete documentation index, see [llms.txt](https://docs.pancakeswap.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pancakeswap.finance/italian/benvenuto-su-pancakeswap/how-to-guides/v3-v2-migration/how-v3-apr-is-calculated.md).

# Come viene calcolato l'APR v3

{% hint style="info" %}
In Liquidità v3 e Farm, con la nuova Liquidità non fungibile e la capacità di personalizzare il range di prezzo, ogni posizione LP avrà il proprio APR sulle commissioni LP e il proprio APR di Yield Farming CAKE.
{% endhint %}

L'APR totale è combinato dall'APR sulle commissioni LP e dall'APR sulle ricompense CAKE

### Commissioni LP

In linea teorica, dato un range di prezzo e la Liquidità che l'utente sta per aggiungere, possiamo stimare le commissioni previste per i prossimi 7 giorni come segue

$$
fee\_{next7d} = fee\_{in} \frac{\Delta{L}}{L\_{in} + \Delta{L}}
$$

* $$fee\_{in}$$ : Ammontare delle commissioni maturate nel range di prezzo specificato dall'utente negli ultimi 7 giorni
* $$L\_{in}$$: Liquidità attuale nel range di prezzo specificato dall'utente
* $$\Delta{L}$$: Liquidità che l'utente vuole aggiungere al range di prezzo

#### Commissioni nel range

Per $$fee\_{in}$$, utilizziamo i dati storici sul volume di Trading, il livello di commissione e i dati storici sui prezzi per stimare il prezzo nel range

$$fee\_{in} = f\_tV\_{7d}\frac{T\_{in}}{T\_{7d}}$$

* $$f\_t$$: Livello di commissione
* $$V\_{7d}$$: Volume di Trading totale degli ultimi 7 giorni
* $$T\_{in}$$: Durata, misurata in secondi, in cui i prezzi sono rimasti nel range di prezzo negli ultimi 7 giorni
* $$T\_{7d}$$: 7 giorni misurati in secondi

### APR CAKE

#### Allocazione del Pool

La ricompensa totale CAKE al secondo in MC v3 usando upkeep può essere derivata da `latestPeriodCakePerSecond`

`cakePerSecond = lastestPeriodCakePerSecond / 1e12 / 1e18`

In ogni pool, possiamo usare `poolInfo` per ottenere il `poolWeight` dividendo `poolInfo.allocPoint / totalAllocPoint`

#### APR CAKE Globale

L'APR globale viene calcolato usando l'ammontare totale di Liquidità attiva in Staking con le emissioni di ricompense CAKE del pool.

`APR (global) = (cakePerSecond * 31536000) / (totalAllocPoint / pool.allocPoint) * 100 * cakeUSD / totalStakedLiquidityUSD`

`totalStakedLiquidityUSD` rappresenta la Liquidità attiva in Staking nel pool in USD, composta da tutti i tick di posizione nel range messi in Staking in MasterChef v3.

#### APR CAKE per Posizione

Gli APR per le singole posizioni possono variare in base alle impostazioni del range di prezzo.

$$
ARP\_p = {\frac{USD\_{r}}{USD\_{p}}} {\frac{L\_{p}}{L\_{lm}}}
$$

* $$USD\_r$$: Ricompensa CAKE guadagnata in USD all'anno nel pool
* $$USD\_p$$: Valore totale in USD della posizione
* $$L\_{p}$$: Liquidità della posizione
* $$L\_{lm}$$: Liquidità totale in Staking tracciata da LMPool


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pancakeswap.finance/italian/benvenuto-su-pancakeswap/how-to-guides/v3-v2-migration/how-v3-apr-is-calculated.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
