# Calculating Interest

### Distribution

#### How is it calculated?

Accounts accrue interest inherited from the Product configuration and include a configurable user interest rate plus an optional partner margin. Interest is distributed to accounts every day using a compounding interest formula based on end-of-day account balances.

The accrual process involves:

* Interest distribution to accounts.
* Partner margin accrual (optional, defined per Product / currency).

Daily settlement occurs between the partner and Tesseract for outstanding balances.

**Example use case 1:** Partners integrate Tesseract's platform to enable customers to deposit capital into interest-earning accounts.

**Example use case 2:** Partners with available capital but no direct customers can issue a single per-currency account and optionally include partner margin.

#### When is interest distributed to an account?

Interest is distributed to accounts once an accounting day (also known as an accounting cycle) has ended. The accounting cycle runs from 00:00:00–23:59:59 in the partner's timezone. Interest distributes shortly after 00:00:00 the following day. Deposits or withdrawals during any day affect the balance used for interest calculation.

**Example 1** — user earning interest on initial deposit (3.5% APY account):

* Day 1: user deposits 1 BTC (balance: 1 BTC).
* Day 2: user receives Day 1 interest; balance becomes 1.00009425493 BTC.

**Example 2** — user withdrawing entire balance:

* Day 2: user withdraws 1.00009425493 BTC.
* Day 3: no interest accrues (balance at Day 2 end was zero).

**Note on edge cases:** deposits made just before interest distribution still earn interest that day, balanced by withdrawals earning no interest on withdrawn amounts.

### Compounding interest formula

Interest calculation uses a compounding APY method based on total account balance at the previous accounting cycle's end:

```
user_balance(t) * [(1 + interest_rate)^(1/365) - 1]
```

**Example — account with 0.5 BTC**

Day 1 — user deposits 0.5 BTC to a "Basic BTC interest account" with the 3% tier (0–1 BTC balance) and no partner margin. Account balance: 0.5 BTC.

Day 2 — interest calculation:

```
0.5 * ((1 + 0.03)^(1/365) - 1) = 0.50004049 BTC
(earned: 0.00004049 BTC)
```

Day 3:

```
0.50004049 + (0.50004049 * ((1 + 0.03)^(1/365) - 1)) = 0.50008099 BTC
```

Day 4:

```
0.50008099 + (0.50008099 * ((1 + 0.03)^(1/365) - 1)) = 0.500121489 BTC
```


---

# 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.tesseract.fi/earn-direct-and-earn-api/earn-api/calculating-interest.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.
