> For the complete documentation index, see [llms.txt](https://bitfi-2.gitbook.io/bitfi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitfi-2.gitbook.io/bitfi/developer/epoch-and-ratio/apy-calculation.md).

# APY Calculation

## Introduction

This document describes how BitFi computes and reports APY for bfBTC. We publish two complementary metrics:

* 7‑Epoch Rolling APY (“7D APY”)
* Cumulative Project APY (since genesis)

Both are derived from the on-chain exchange rate between bfBTC and BTC.

## Terminology

* Epoch N: The N‑th rebasing or accounting interval at which the bfBTC/BTC exchange rate is finalized.
* T\_N: Unix timestamp (in seconds) when epoch N is finalized.
* R\_N: Exchange rate at epoch N, expressed as BTC per 1 bfBTC. In words, “1 bfBTC = R\_N BTC.”
* S\_year: Number of seconds in one year. Unless otherwise noted, S\_year = 31,536,000.
* Percent vs fraction: All APY formulas below return percentage values (i.e., multiplied by 100).

Notes:

* The exchange rate R\_N is expected to be non‑decreasing over time if bfBTC accrues yield in BTC.
* Timestamps must be strictly increasing: T\_N > T\_{N-1}.

## 7‑Epoch Rolling APY (“7D APY”)

### Definitio

A linearized, annualized rate based on the change in the bfBTC/BTC exchange rate over the last seven epochs. Because epochs are not guaranteed to be exactly 24 hours, this “7D APY” can differ from a strict 7‑calendar‑day APY.

### Formula

$$
\mathrm{APY}^{(7)}(N)
=====================

100 \times S\_{\text{year}} \times
\frac{\displaystyle \frac{R\_{N}}{R\_{N-7}} - 1}{\displaystyle T\_{N} - T\_{N-7}},
\qquad N \ge 7
$$

**Where:**

* R\_N / R\_{N-7} − 1 is the relative change over the last seven epochs.
* The fraction is scaled to an annual rate by S\_year, then converted to percent by 100.

### Notes:

* Require N ≥ 7.
* If T\_N − T\_{N-7} is very small or zero, skip the update or fallback to a safe default.

## Cumulative Project APY (since genesis)

### Definition

A linearized, annualized rate computed from genesis (epoch 0) to epoch N.

### Formula

$$
\mathrm{APY}\_{\text{cumulative}}(N)
====================================

100 \times S\_{\text{year}} \times
\frac{\displaystyle \frac{R\_{N}}{R\_{0}} - 1}{\displaystyle T\_{N} - T\_{0}}
$$

**Where:**

* R\_N / R\_0 − 1 is the total relative appreciation of bfBTC versus BTC since genesis.
* Linearization makes the rate easy to interpret and stable across reporting intervals.


---

# 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://bitfi-2.gitbook.io/bitfi/developer/epoch-and-ratio/apy-calculation.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.
