# Calculating Vault Performance

## Overview

**The rewards percentage is estimated on-the-fly using actual vault data.** This takes the last five days or so of vault rewards and assumes they are representative of the next year.

{% hint style="info" %}
The rewards shown exclude [vault fees](https://truyields.gitbook.io/docs/trustake-vaults/fees).
{% endhint %}

## Technical Details

More concretely:

1. The TruYields LST / Native Token exchange rate as calculated by the vault is sampled periodically, on average every hour.
2. This time-series is then resampled, interpolating linearly in time between points in the price series to generate a new time-series with points precisely one hour apart.
3. The mean hourly return is taken over the last 120 share price readings.
4. This average is then compounded hourly to give an annual return.

Formally, denote by $${(t\_{i},s\_{i})}*{i=1,\dots,120}$$ tuples representing successive times $$t*{1} < \ldots < t\_{120}$$ and exchange rate prices originally sampled. This is converted into a time-series $${(t^\prime\_{j},s^\prime\_{j})}\_{j = 1,\dots,n}$$ where for each $$j$$

$$
\begin{align\*}t^\prime\_{j+1} - t^\prime\_{j} &= 1\text{ hour}\ t^\prime\_{n} &= t\_{120} \ s^\prime\_{j} &= \frac{s\_{i+1}(t\_{i+1} - t^\prime\_j) + s\_{i}(t^\prime\_{j} - t\_{i})}{t\_{i+1} - t\_{i}}\end{align\*}
$$

where $$i$$ is such that $$t\_{i} \le t^\prime\_{j} \le t\_{i+1}$$ and $$n = \left\lfloor \frac{t\_{120} - t\_{1}}{\text{1 hour}} \right\rfloor$$, i.e. the number of whole hours in the original sample. We then convert this into a list of hourly returns, adjusting for vault fees $$r\_{j} = (s\_{j+1} / s\_{j} - 1) / (1-\text{fee})$$. To calculate the final rewards, we take the mean $$\bar{r} = \frac{1}{n-1}\sum\_{j=1}^{n-1}r\_{j}$$ of these hourly returns and compound this over a year to give an annual number:

$$
\mathrm{APY} := \left(1+\bar{r}\right)^{24\times 365} - 1
$$

{% hint style="warning" %}
Please note: the APY displayed on the front end is simply an estimate and can vary significantly depending on the performance of the network and of the validator to which we delegate.

Digital Asset prices are volatile and fluctuate day-to-day. Transactions involving these Digital Assets through the Protocol are a high-risk activity. Proper diligence and sound judgement should be used in evaluating the risks associated with these activities. Neither TruYields nor the Protocol solicits nor makes any representation that Digital Assets are an investment vehicle suitable for a user. The decision to undertake transactions involving Digital Assets on the Protocol rests entirely on the user's own independent judgement. The Terms and Conditions in full can be found [here](https://www.truyields.com/policy).
{% endhint %}
