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:

Ratio Finance Risk ToleranceMarket ConditionsBorrower's position

Market Price = $1.02

LP Tokens = 1000

Tolerance = 1.25

Fair Price = $0.98

Debt Taken = 100%

Collateralization Ratio = 130%

Following the calculations before we have the following conditions for liquidation

Borrower's PositionRisk monitoring

Maximum Borrowable USDr = $784.62

Delta = 4.66%

USDr Debt = $784.62

Dynamic CR = 128.15%

Collateral to Debt = 130%

Health = 1.85%

Liquidate Flag = FALSE

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.

Ratio Finance Risk ToleranceMarket ConditionsBorrower's position

Market Price = $1.01

LP Tokens = 1000

Tolerance = 1.15

Fair Price = $0.85

Debt Taken = 100%

Collateralization Ratio = 130%

The current market conditions are such that:

Borrower's PositionRisk monitoring

Maximum Borrowable USDr = $ 776.92

Delta = -1.15%

USDr Debt = $ 784.62

Dynamic CR = 131.15%

Collateral to Debt = 128.73%

Health = -2.42%

Liquidate Flag = TRUE

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

Repay (%)LP Tokens to depositUSDr 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:

New CTDNew Health

131.23 %

0.08%

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.

Ratio Finance Risk ToleranceMarket ConditionsBorrower's position

Market Price = $1.01

LP Tokens = 1000

Tolerance = 1.15

Fair Price = $0.85

Debt Taken = 100%

Collateralization Ratio = 130%

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

Borrower's PositionRisk monitoring

Maximum Borrowable USDr = $ 776.92

Delta = -1.15%

USDr Debt = $ 784.62

Dynamic CR = 131.15%

Collateral to Debt = 128.73%

Health = -2.42%

Liquidate Flag = TRUE

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:

Liquidation resultsUser perspective

Minimum Liquidation = 25%

New LP Position = 750

Tokens to be unwound = 250

New LP Nominal = $ 757.50

LP Notional Value = $ 252.66

New USDr Debt = $ 531.95

USDr Burnt = $ 194.35

New Collateral to Debt = 142.40%

New Health = 11.25%

Last updated