# Example

## Case 1: User in a healthy position

Following the post on Delta and the liquidation logic, we think a full example of liquidation calculations is useful. Suppose that the initial conditions of the position taken by the user are:

<table><thead><tr><th width="288">Ratio Finance Risk Tolerance</th><th width="202">Market Conditions</th><th>Borrower's position</th></tr></thead><tbody><tr><td><span class="math"> \Delta_{min}</span> = 2%</td><td>Market Price = $1.02</td><td>LP Tokens = 1000</td></tr><tr><td>Tolerance = 1.25</td><td>Fair Price = $0.98</td><td>Debt Taken = 100%</td></tr><tr><td>Collateralization Ratio = 130%</td><td></td><td></td></tr><tr><td><span class="math">\Gamma</span> = 0.2%</td><td></td><td></td></tr></tbody></table>

Following the calculations before we have the following conditions for liquidation

<table><thead><tr><th width="392">Borrower's Position</th><th>Risk monitoring</th></tr></thead><tbody><tr><td>Maximum Borrowable USDr = $784.62</td><td>Delta = 4.66%</td></tr><tr><td>USDr Debt = $784.62</td><td>Dynamic CR = 128.15%</td></tr><tr><td>Collateral to Debt = 130%</td><td><span class="math">\Gamma</span> = 0.2%</td></tr><tr><td></td><td>Health = 1.85%</td></tr><tr><td></td><td>Liquidate Flag = FALSE</td></tr></tbody></table>

In this case nothing needs to be done, the user is in a healthy position and there isn't any liquidation.

## Case 2: User repays to be safe

Here we start from the same initial conditions as the example above, however different market conditions pushed LP Market price to $1.01 and Fair Price to $0.85.&#x20;

<table><thead><tr><th width="288">Ratio Finance Risk Tolerance</th><th width="202">Market Conditions</th><th>Borrower's position</th></tr></thead><tbody><tr><td><span class="math"> \Delta_{min}</span> = 2%</td><td>Market Price = $1.01</td><td>LP Tokens = 1000</td></tr><tr><td>Tolerance = 1.15</td><td>Fair Price = $0.85</td><td>Debt Taken = 100%</td></tr><tr><td>Collateralization Ratio = 130%</td><td></td><td></td></tr><tr><td><span class="math">\Gamma</span> = 0.2%</td><td></td><td></td></tr></tbody></table>

The current market conditions are such that:

<table><thead><tr><th width="392">Borrower's Position</th><th>Risk monitoring</th></tr></thead><tbody><tr><td>Maximum Borrowable USDr = $ 776.92</td><td>Delta = -1.15%</td></tr><tr><td>USDr Debt = $ 784.62</td><td>Dynamic CR = 131.15%</td></tr><tr><td>Collateral to Debt = 128.73%</td><td><span class="math">\Gamma</span> = 0.2%</td></tr><tr><td></td><td>Health = -2.42%</td></tr><tr><td></td><td>Liquidate Flag = TRUE</td></tr></tbody></table>

Then the amount to repay to be safe can be easily calculated:

| Repay (%)        | LP Tokens to deposit      | USDr to repay             |
| ---------------- | ------------------------- | ------------------------- |
| CR - CTD = 1.27% | Repay (%) \* 1000 = 12.75 | 12.75 \* $ 1.01 = $ 12.87 |

At the end of this repayment process the borrower goes back to a healthier position where:

<table><thead><tr><th width="334">New CTD</th><th width="780">New Health</th></tr></thead><tbody><tr><td>131.23 %</td><td>0.08%</td></tr></tbody></table>

## Case 3: User getting partially liquidated

Here the same conditions as the example above are given, but the borrower didn't repay any of their debt within the 3 epochs of time given as a buffer before liquidation occurs.

<table><thead><tr><th width="288">Ratio Finance Risk Tolerance</th><th width="202">Market Conditions</th><th>Borrower's position</th></tr></thead><tbody><tr><td><span class="math"> \Delta_{min}</span> = 2%</td><td>Market Price = $1.01</td><td>LP Tokens = 1000</td></tr><tr><td>Tolerance = 1.15</td><td>Fair Price = $0.85</td><td>Debt Taken = 100%</td></tr><tr><td>Collateralization Ratio = 130%</td><td></td><td></td></tr></tbody></table>

In this case the ratio between Market Price and Fair Price has dropped considerably and the position of the user needs to be liquidated

<table><thead><tr><th width="392">Borrower's Position</th><th>Risk monitoring</th></tr></thead><tbody><tr><td>Maximum Borrowable USDr = $ 776.92</td><td>Delta = -1.15%</td></tr><tr><td>USDr Debt = $ 784.62</td><td>Dynamic CR = 131.15%</td></tr><tr><td>Collateral to Debt = 128.73%</td><td>Health = -2.42%</td></tr><tr><td></td><td>Liquidate Flag = TRUE</td></tr></tbody></table>

In this example, at current market conditions the borrower's debt is now under-collateralized, therefore, the position needs to be readjusted. For this particular example this readjustment is:

<table><thead><tr><th width="311">Liquidation results</th><th>User perspective</th></tr></thead><tbody><tr><td>Minimum Liquidation = 25%</td><td>New LP Position = 750</td></tr><tr><td>Tokens to be unwound = 250</td><td>New LP Nominal = $ 757.50</td></tr><tr><td>LP Notional Value = $ 252.66</td><td>New USDr Debt = $ 531.95</td></tr><tr><td>USDr Burnt = $ 194.35</td><td>New Collateral to Debt = 142.40%</td></tr><tr><td></td><td>New Health = 11.25%</td></tr></tbody></table>

#### A full calculation of this example can be found in the following link <https://docs.google.com/spreadsheets/d/1OIbpjnNHeSDOufd7lC7i6tk8aRZ1VLSEgX4N9yQN5Vc/edit?usp=share_link>
