# Settlements

### How it works

When Earn API is used to deposit and withdraw assets to accounts, no actual transfers are sent or received. Instead, all deposits and withdrawals per accounting cycle are netted and added to a per-currency outstanding balance.

The outstanding balance represents an unsettled balance that is expected to be sent or received as per the agreements for settlement intervals (typically daily).

If the total amount to be settled is less than the **minimum settlement threshold**, the outstanding balance will remain 0 and no transactions need to be done.

### Settlement flow

At midnight (partner's timezone) the current accounting cycle ends. Tesseract produces a settlement update based on the outstanding balance using the following steps:

1. Calculate the accrued balances since the last settlement:
   * **Accrued payables** = accrued deposits + accrued fees (what the partner is to pay to Tesseract).
   * **Accrued receivables** = accrued withdrawals + accrued partner margin (what Tesseract is to pay to the partner).
2. Net accrued payables and receivables by subtracting one from the other (**accrued receivables − accrued payables**).
   * If the netted balance is less than the minimum settlement amount, no settlement is created and the outstanding balance is not updated.
   * If the netted balance is greater than or equal to the minimum settlement amount, a settlement is created and the outstanding balance is updated by adding the netted payables and receivables.

Every day (or at regular intervals), the partner and Tesseract each check the outstanding balance per currency using the [API](https://earn-api.partner.env.tesseractinvestment.dev/docs/) to determine who sends assets to the counter-party:

* **Positive balance** — Tesseract sends capital to the partner; expect to receive a certain amount within the day (times may vary depending on amount).
* **Negative balance** — the partner sends the given currency to Tesseract. When the transaction is received, the outstanding balance is updated.

### Benefits of this process

1. All deposits and withdrawals are batched — only one transaction per currency per day is exchanged. This makes the exchange of assets predictable and less error-prone.
2. Saves on fees — one transaction per day means smaller total network costs, combined with small amounts below the minimum settlement threshold waiting to be settled until later.
3. If too little or too much is sent from partner to Tesseract (or vice versa), the outstanding balance updates accordingly and is taken into account in the next settlement.

### Minimum settlement amount

The minimum settlement amount ensures small amounts aren't settled. Typically the minimum settlement amount is set to a value equivalent to 1,000 USD per currency, but it may be updated dynamically to suit specific needs.

### Balances

The following terms describe the day-to-day settlement process of the outstanding balance:

* **Outstanding balance** — amount per currency exposed by the API, indicating who is to send money. Negative means the partner owes Tesseract; positive means Tesseract owes the partner.
* **Accrued payables** — amount per currency the partner is currently accruing to pay to Tesseract when a new outstanding balance is calculated.
* **Accrued receivables** — amount per currency the partner is to receive from Tesseract when the outstanding balance is calculated.
* **Netted accrued payables and receivables** — the netted accrued payables and receivables used to update the outstanding balance.


---

# 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/settlements.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.
