> For the complete documentation index, see [llms.txt](https://limitless.gitbook.io/ramm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://limitless.gitbook.io/ramm/instrument-examples-and-usage/individual-creditline/simple-numerical-example.md).

# Simple Numerical Example

This page illustrates an example of how interest rates for a given loan is derived, and the managers' and passive liquidity provider's payoff for different scenarios.

As an example, a borrower(utilizer) would request a loan with the following parameters, denominated in USD:&#x20;

**Proposed Principal**: 100k&#x20;

**Proposed Interest**: 10k&#x20;

**Proposed Duration** 1 Year

From the equations outlined in section 7 of the whitepaper, the initial parameters of the AMM, namely its inverse liquidity coefficient(which determines how fast price increases in relation to **`longZCB`** bought) and the initial price of **`longZCB`** would be constructed.&#x20;

Here the initial price (b) would be 2P/(P+I)-1 = 0.818 USD. The inverse liquidity coefficient (a) is (1-b)/(P+I) = 0.0000016545.&#x20;

The p := price of  **`longZCB`** can then be numerically represented as a function of c:= (**`longZCB`** bought - **`shortZCB`** bought )

**p = 0.0000016545c + 0.818**

Say a manager(with a high reputation) deems this borrower creditworthy or thinks that his collateral is sound. He would then start buying its **`longZCB`** at this initial price for a total of, say, **10000** USD worth. Then the average price he would pay is calculated by the area under the price curve(10K) divided by the quantity he would buy(which can be derived from this area as input). In this case, it would be around 0.83USD, for a total of **12050** **`longZCB.`** When the loan successfully matures, this would be redeemable for 12050 USD.&#x20;

Now, say there are only two more managers who believe this borrower is creditworthy, and each of them buys 5000 USD worth, for a total of  10000+5000+5000 = **20000** USD worth of **`longZCB`** bought, which equates to **11350+ 12050 = 23400** total **`longZCB`** bought.&#x20;

Then the actual principal and interest the borrower will be able to get will be computed using the *leverage parameter L,* which is a parameter that scales with how much leverage **`longZCB`** token holders are incurring(and equally, how little protection junior holders are getting). If L = 3, then the actual principal and interest(using equations in the whitepaper) is&#x20;

**Actual Principal**: 60K

**Actual Interest**: 7.2K

Now, note that the principal is lower and the interest rate higher being 7.2/60 = 12% as opposed to 10/100 = 10% from the borrower's proposal. If there are more managers who bu&#x79;**`longZCB`**, the actual principal will cap at 100K, and interest at 10K.&#x20;

The capital used to lend out to the borrower is supplied **20K** from these managers and 60K - 20K = **40K** from the VT holders.&#x20;

At maturity, let's go through examples of three possible scenarios:&#x20;

1. The borrower pays back 33.8K. Including the interest as debt, the loss is 67.2K-33.8K = 33.8K. Recall that the total number of **`longZCB`** tokens sold is 12050 + 11350 = 23400. The redemption price of **`longZCB`** tokens is then set at *max*(1 - 33800/23400,0) =  0. This means all of the managers' collateral would be used as first loss capital. The VT holders would have a protection of 20K, so their loss would be 33.8K - 20K = 13.8K, which is shared pro-rata.
2. The borrower pays back 55K. The loss is 67.2k - 55K = 12.2K. **`longZCB`** redemption price would be at *max*(1 - 12200/23400, 0) = 0.48. No loss is incurred by VT holders.&#x20;
3. The borrower pays back the full amount of 67.2K. The redemption price of **`longZCB`** tokens is then set at max(1-0/23400, 0) = 1. The first manager would have made a profit of 12050-10000 = 2050 USD, and the second/third manager would have made a combined profit of 11350-10000 = 1350 USD. The VT holders' profit would be 7200 - 2050-1350 = 3800 USD.&#x20;

{% hint style="info" %}
Note that the specific payouts from the examples above might vary for different parameters. Also, the AMM parameter computation ignores rewards for validators.&#x20;
{% endhint %}

**Sub Example 1: Manager with Leverage**

Now let's assume that the first manager has a great track record and is able to buy **`longZCB`** with leverage. This essentially means he will be able to borrow capital inside VT, and use it to margin long **`longZCB`**. When he redeems his **`longZCB`** at maturity, he will have to pay back the borrowed amount to VT.&#x20;

Under the same example as illustrated above, say the manager(with a high reputation) deems this borrower creditworthy and starts buying its **`longZCB`** at this initial price for a total of **10000**USD worth. If his allowed leverage coefficient is 2, he would instead be able to borrow 5000 USD from VT, and only pay 5000 USD of his own capital to purchase 12050 **`longZCB`**.&#x20;

At maturity, let's go through the same three examples:&#x20;

1. The borrower pays back 33.8K. The redemption price of **`longZCB`** tokens is set at *max*(1 - 33800/23400,0) =  0. This means all of the managers' collateral would be used as first loss capital. The VT holders would have a protection of 15K, so their loss would be 33.8K - 15K = 18.8K, which is shared pro-rata.
2. The borrower pays back 55K. The loss is 67.2k - 55K = 12.2K. **`longZCB`** redemption price would be at *max*(1 - 12200/23400, 0) = 0.48. No loss is incurred by VT holders, since 15K> 12.2K. The first manager who bought with leverage would have to pay back the vault 5000 USD after redeeming his **`longZCB`** tokens at a value 12050\*0.48 = 5784, which will leave him with only 784 USD.&#x20;
3. The borrower pays back the full amount of 67.2K. The redemption price of **`longZCB`** tokens is then set at max(1-0/23400, 0) = 1. The first manager would have made a profit of 12050-10000 = 2050 USD. His returns percentage terms would instead be 2050/5000 = 41% as opposed to 20.5% without leverage.

**Sub Example 2: ShortZCB buyer**

Now, let's assume that there is a VT holder who disagrees with the managers. He wants to hedge potential exposure from this borrower by buying some **`shortZCB`**. Under the same example, let's say the VT holder buys **`shortZCB`** after all three managers have purchased thei&#x72;**`longZCB`**, when the final price is 0.87USD. Then the spot price of each **`shortZCB`** would be 1-0.87 = 0.13 USD. He then buys **11350** **`shortZCB`**, at a total price of 1470USD(as selling would also incur symmetric slippage). This would decrease the net **`longZCB`** and lower the actual principal/interest approved for the borrower. A reduction of **11350** net **`longZCB`** results in only 12050 net **`longZCB`** left, and with the same L = 3,&#x20;

Actual Principal: 60K

Actual Interest: 7.2K

At maturity, let's go through the same three examples:&#x20;

1. The borrower pays back 33.8K. Including the interest as debt, the loss is also at 67.2K-33.8K = 33.8K. Recall that the number of **`longZCB`** tokens sold is 12050 + 11350 = 23400, and the number of **`shortZCB`** tokens sold is 11350. The redemption price of **`longZCB`** tokens is then set at *max*(1 - 33800/23400,0) =  0, and the redemption price of **`shortZCB`** would be 1 - 0 = 1. The VT holders would have a protection of 20K - 11.35K + 0.147K.&#x20;
2. The borrower pays back 55K. The loss is 67.2k - 55K = 12.2K. **`longZCB`** redemption price would be at *max*(1 - 12200/23400, 0) = 0.48, and the redemption price of **`shortZCB`** would be 1-0.48 = 0.52. Some loss is incurred by VT holders, since 20K - 11.35K + 0.147K < 12.2K. &#x20;
3. The borrower pays back the full amount of 67.2K. The redemption price of **`longZCB`** tokens is then set at max(1-0/23400, 0) = 1, and the **`shortZCB`** redemption price is 0.&#x20;

{% hint style="info" %}
In actuality, the amount of **`shortZCB`** that can be bought by an individual would not be this high, unless he/she owns a very large amount of VT.&#x20;
{% endhint %}

{% hint style="info" %}
All these processes could be applied to any loan-based instrument.&#x20;
{% endhint %}
