# Computations

This page outlines the major computations that occur within the Athena protocol. These calculations are crucial for understanding the mechanics of cover pricing, liquidity provision, and reward distribution.

{% hint style="warning" %}
This page is still being expanded. Information might be incomplete.
{% endhint %}

## Utilization Rate

The utilization rate (U) is a key metric that influences many aspects of the protocol. It represents the percentage of liquidity in a pool that is currently locked as a guarantee for bought covers.

$$U = \frac{\text{Total covered amount}}{\text{Total liquidity}} \times 100%$$

Example:

```
Total liquidity in pool = $10,000
Total covered amount in pool = $3,500

U = (3,500 / 10,000) × 100% = 35%
```

## Premium Rate

The premium rate (P\_r) is calculated using a bi-linear curve based on the utilization rate. It determines the cost of covers and rewards for liquidity providers.

Let:

* u\_optimal = optimal utilization rate
* r\_0 = base premium rate at 0% utilization
* r\_slope1 = premium slope below optimal utilization
* r\_slope2 = premium slope above optimal utilization

Then:

For U ≤ u\_optimal: $$P\_r = r\_0 + \frac{U}{u\_{optimal}} \cdot r\_{slope1}$$

For U > u\_optimal: $$P\_r = r\_0 + r\_{slope1} + \frac{U - u\_{optimal}}{1 - u\_{optimal}} \cdot r\_{slope2}$$

Example:

```
u_optimal = 80%
r_0 = 2%
r_slope1 = 6%
r_slope2 = 15%

For U = 40%:
P_r = 2% + (40% / 80%) × 6% = 5%

For U = 90%:
P_r = 2% + 6% + ((90% - 80%) / (100% - 80%)) × 15% = 15.5%
```

## Reward Rate

The reward rate (R\_r) for liquidity providers is calculated by multiplying the utilization rate and the premium rate:

$$R\_r = U \times P\_r$$

Example:

```
U = 50%
P_r = 8%

R_r = 50% × 8% = 4%
```

## Cover Duration and Tick Spacing

The duration of a cover is measured in ticks, with the time between ticks (seconds per tick) varying based on pool utilization. The maximum seconds per tick is 86,400 (1 day), and the minimum is calculated as:

$$\text{min seconds per tick} = 86400 \times \frac{r\_0}{r\_0 + r\_{slope1} + r\_{slope2}}$$

The actual seconds per tick (s\_t) at a given utilization is:

$$s\_t = 86400 - (86400 - \text{min seconds per tick}) \times U$$

## Liquidity Index Computation

The liquidity index (L\_i) tracks the accumulation of premium rewards. For a given period:

$$L\_i = \text{capital} \times R\_r \times \frac{\text{elapsed time}}{\text{one year}}$$

Example:

```
capital = $10,000
R_r = 4%
elapsed time = 10 days

L_i = 10,000 × 4% × (10 / 365) = $10.96
```

## Compensation Impact on Leveraged Positions

When a compensation occurs in a pool, it affects the liquidity of other pools with shared (leveraged) liquidity. The impact is calculated as:

$$\text{Impact ratio} = \frac{\text{Compensation amount}}{\text{Total pool liquidity}}$$

For the pool where the compensation occurs: $$\text{New liquidity} = \text{Old liquidity} \times (1 - \text{Impact ratio})$$

For pools with shared liquidity: $$\text{New shared liquidity} = \text{Old shared liquidity} \times (1 - \text{Impact ratio})$$

Example:

```
Pool A liquidity = $3,000 (including $1,000 shared with Pool B)
Pool B liquidity = $2,000 (including $1,000 shared with Pool A)
Compensation in Pool A = $1,000

Impact ratio = 1,000 / 3,000 = 33.33%

New Pool A liquidity = 3,000 × (1 - 0.3333) = $2,000
New Pool B liquidity = 2,000 - (1,000 × 0.3333) = $1,667
```

These computations form the backbone of Athena's risk assessment, pricing, and reward distribution mechanisms. Understanding them is crucial for analysts and users looking to deeply engage with the protocol.


---

# 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://doc.athenains.io/technical-concepts/computations.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.
