> For the complete documentation index, see [llms.txt](https://docs.tradeflows.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tradeflows.io/tradeflows/flows-programmed-liquidity.md).

# Flows - Programmed Liquidity

Liquidity flows through out the TradeFlows Core protocol according to two formulas. When a stream is created, an escrow account is automatically deployed and two types of liquidity come to exist as a result. The first amount is the **Available** and the second is the **Locked**. As time passes, the liquidity flows from the **Locked** amount, which is in escrow, to the **Available** amount.

When a stream is created, a final maturity and a target amount are defined and the payer deposits an initial amount to the escrow. As time passes, the amount that flows continuously between the locked and the available amount is defined by the final maturity and the target amount. The amount that flows is such that at the time of the final maturity, the available amount has grown to the target amount, unless the stream has been paused.

### Initial Parameters

Programming liquidity starts with setting up a payment stream based on a few parameters:

* Target Amount - The full amount that is to be paid in aggregate between the starting time and the final maturity.
* Initial Amount - The amount that the payment stream is initially collateralised with and sent to escrow.
* Start Time - The time at which the stream starts flowing to the receiver.
* Final Maturity - The final time at which the full amount has flown to the receiver.

### Available Liquidity

The formula for the available liquidity depends on the final maturity **T** and the target amount.&#x20;

$$
Available(t) = Amount\_{target} \* \frac{t-t\_{last}}{T-t\_o}
$$

In the event of a withdrawal at **time last**, the formula resets the accrual of the flowing amounts. For the sake of clarity, as time passes, the available amount grows.

### Escrowed Liquidity

The escrow is defined as a locked amount described by the following formulat:

$$
Locked(t) = Locked(t-1) - Available(t)
$$

In other words, the new locked amount is equal to the locked amount at the previous time minus the available amount. As time passes, the locked amount decreases.


---

# 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:

```
GET https://docs.tradeflows.io/tradeflows/flows-programmed-liquidity.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.
