Ratio Finance
  • šŸ‘‹Welcome to Ratio Finance!
  • Providing Liquidity
    • šŸ’°Creating LP Tokens
  • Our Platform
    • šŸ”ŒConnecting Your Wallet
    • šŸ”ŽExplore the Vaults
    • 🄷Insta-Swap
    • šŸ’øDeposit LP
    • šŸ§™ā€ā™‚ļøMint USDr
    • šŸ—ļøPay Back USDr
    • āœ…Withdraw LP
    • 🦾Technical Architecture
    • 🄩RATIO Staking
  • Liquidation Engine
    • Dynamic Risk Management
    • Mechanics
    • Example
    • Technical Details
    • Liquidation Parameters
  • Our Business
    • šŸŖ™Business Model
      • Stability Fees
    • šŸ“ŠRATIO Tokenomics
      • šŸŽ†$RATIO Token
      • šŸ’²USDr Stablecoin
    • šŸ“ˆHow does Ratio's Collateralization work?
    • šŸ¦Governance
  • For Developers
    • Grant Program
    • Instaswap-SDK
      • Instaswap-core
      • Instaswap-hook
    • Vault-SDK
Powered by GitBook
On this page
  • Case 1: User in a healthy position
  • Case 2: User repays to be safe
  • Case 3: User getting partially liquidated
  1. Liquidation Engine

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 Tolerance
Market Conditions
Borrower'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 Position
Risk 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 Tolerance
Market Conditions
Borrower'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 Position
Risk 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 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:

New CTD
New 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 Tolerance
Market Conditions
Borrower'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 Position
Risk 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 results
User 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%

PreviousMechanicsNextTechnical Details

Last updated 2 years ago

= 2%

= 0.2%

= 0.2%

= 2%

= 0.2%

= 0.2%

= 2%

A full calculation of this example can be found in the following link

Ī”min \Delta_{min}Ī”min​
Γ\GammaΓ
Γ\GammaΓ
Ī”min \Delta_{min}Ī”min​
Γ\GammaΓ
Γ\GammaΓ
Ī”min \Delta_{min}Ī”min​
https://docs.google.com/spreadsheets/d/1OIbpjnNHeSDOufd7lC7i6tk8aRZ1VLSEgX4N9yQN5Vc/edit?usp=share_link