This article is more than nine months old

How to track liquidations

How to track liquidations
In DeFi, liquidation usually occurs on lending protocols when the value of a user’s loans exceed a predetermined threshold against their deposited collateral.

Liquidation is the process where a lender closes a borrower’s financial positions and sells its collateral assets in order to recover a debt.

The process usually signals the end of an enterprise, whether that’s the closure of a brick-and-mortar business or the dissolution of a major investment fund.

In decentralised finance, liquidation usually occurs on lending protocols when the value of a user’s loans exceed a predetermined threshold against their deposited collateral.

The smart contracts close out borrowed positions wholly or in part to ensure that lenders are repaid in full and the protocol does not accrue bad debt. This generally entails a loss for the borrower; a liquidation indicates that the borrower has been unable to keep the loan solvent.

To keep lending protocols attractive to both borrowers and lenders, DeFi applications try to strike a balance between providing high yields to lenders and protecting them from reckless borrowing. This balance is struck through a set of rules enforced automatically through smart contracts.

NOW READ: ‘I just want to help’: Justin Sun scoops $2.9m worth of Curve founder’s governance tokens amid liquidation crisis

Loans issued through smart contracts can’t play by the same rules as traditional finance, or TradFi, where many loans are taken out on credit, meaning that the borrower has not provided any collateral up front. These kinds of loans are usually referred to as undercollateralised in crypto.

In DeFi, lenders operate from pseudonymous wallets, so it is difficult to trust them with undercollateralised loans — a bailiff wouldn’t know whose door to knock down to try and recoup losses.

Join the community to get our latest stories and updates

DeFi is designed to be trustless. Because of this, lending protocols require borrowers to provide assets with a greater value than they can borrow, so that the protocol is better insured against losses.

As such, the most common method for getting around this is to overcollateralise. The borrower provides a DeFi lending protocol with a greater value of assets than they intend to borrow, so that the lending protocol is better insured against losses.

Because overcollateralised loans are based on rules enshrined in code, there are no limitations on who can access them. Factors a bank may take into account when deciding to lend money for an undercollateralised loan, such as credit history, non-collateral assets and employment status do not apply in DeFi.

NOW READ: ‘Great revenue source for the protocol’: BNB Chain gears up to liquidate its hacker in DeFi

There are a few reasons why someone would take out a loan to borrow less than the collateral they put up. One is that borrowers would like to retain exposure to their collateral asset while they trade a borrowed asset for a short amount of time.

Another is that borrowers can use overcollateralised loans to bet against assets, otherwise known as shorting. This is done by posting collateral, borrowing the target asset against it, then immediately selling it on the market. If the borrowed asset then falls in price, the borrower can buy it back at a lower price, repay their loan and pocket the difference.

But what happens if the value of a borrower’s collateral falls below the value of the assets they borrowed? Imagine that a borrower posts $1,000 worth of Ether to borrow $500 of BTC. The ether market crashes, and the price of ETH goes down 60%. This leaves the borrower with only $400 worth of Ether. Uh-oh — they are no longer overcollateralised. This is where liquidation comes in.

How do liquidations work?

Liquidations are designed to prevent lending protocols from going bust. There are three important phrases to keep in mind when thinking about this: health factor, liquidation threshold, and collateral ratio.

Lending protocols such as Aave or Compound liquidate loans based on what’s called the health factor of a loan. The health factor is calculated by an algorithmic formula that includes the borrower’s collateral, the collateral asset’s liquidation threshold, and the total value of borrowed assets. Borrowers need to be wary of the difference in value, otherwise known as the collateral ratio, of assets to keep loans healthy.

If the loan turns so unhealthy that the health factor approaches a one-to-one ratio with the deposited collateral, the lending protocol puts the loan up for liquidation.

Just as DeFi lending markets are open to anyone, so is the liquidation process. But since liquidation is a highly competitive and lucrative endeavour, the successful liquidators tend to be the ones running specialised computer programs commonly referred to as liquidation bots.

These bots can execute transactions far faster than a human, which means the liquidator with the best bot usually wins. The winning bot is rewarded with a liquidation fee from the borrower whose collateral they are liquidating.

NOW READ: Everything is about to change at MakerDAO: Rune Christensen on his Endgame plan

Competition for rewards ensures that bots liquidate bad loans almost instantly, and that lending protocols experience minimal disruption when a borrower fails to keep a loan healthy. This is not always the case — protocols such as Maker have come close to bankruptcy when waves of failed loans overwhelm their algorithms.

Liquidations can be triggered by various mechanisms, but Aave’s model is a good example of how a typical liquidation might go down.

  1. Leroy the Llama deposits 50 Ether into Aave and borrows 25 Ether worth of USDC.
  2. The crypto market takes a hit. Ether falls in price, and the health factor of Leroy’s loan drops below one.
  3. A liquidation bot swoops in and buys up to 50% (12.5 Ether worth of Leroy’s collateral. This number is specific to Aave and varies across lending protocols.
  4. The bot then immediately sells the Ether on the market to avoid losing money if the Ether price continues to fall.
  5. In addition, the bot takes a liquidation fee from Leroy’s remaining collateral — this acts as an incentive for bots to buy Leroy’s assets from the protocol.
  6. Leroy loses, liquidators profit, and the protocol remains solvent.

How to use DefiLlama to track liquidations

DefiLlama tracks liquidation data for 35 assets on 11 protocols across five blockchains.

To track them, head to the Liquidations tab on the upper left of the DefiLlama landing page, and click to see the list of assets tracked. The switch in the upper right corner above the chart toggles the graph between protocols and chains.

Select an asset to see a chart showing liquidation levels at all lending protocols that offer borrowing against it, along with some other nifty data points, including::

  • Total Liquidatable (USD): This shows the total amount of the chosen asset that is posted as collateral across all lending protocols. Keep in mind that any funds borrowed from lending protocols are at risk of liquidation, so this number tracks even healthy loans with minimal risk.
  • Liquidatable value change (24hr): Tracks a change in the value of Total Liquidatable assets over the past 24 hours.
  • Within -20% of current price: This number shows how much of the chosen asset is within 20% of borrower’s liquidation thresholds. It provides a clearer metric of risk associated with the chosen asset than Total Liquidatable.

Next, let’s look at the two main fields in the liquidations section in detail.

Chart:

The chart shows data related to liquidations. Each bar represents how many loans will be liquidated at various price points. Scroll over the chart for additional metrics.

  • Cumulative filter: The cumulative filter summarises liquidations without taking the size of individual loans into account. Large wallets that take out a few outsized loans drastically affect unfiltered charts, so the cumulative chart allows for a better picture of the general liquidation landscape.
  • Click the Protocols or Chains listed on the left side of the chart to add or remove them from the chart.
  • The toggle in the upper right section of the chart displays liquidation data in either the chosen asset’s value, or in its USD value.
  • Click bobo to meme out the chart.

Dashboard List:

The dashboard list sits below the chart. Information in the dashboard is listed by rank, depending on which filters are selected.

The dashboard is divided into two sections: Distribution and Positions.

% Distribution:

The field is linked to the “Protocol/Chain” toggle, and displays the distribution of liquidatable funds across either protocols or chains. Select “protocol” to display the distribution of the asset across lending protocols. Select “chain” to display the distribution across the different chains the asset is hosted on.

Positions:

A position indicates the amount of an asset held on a lending protocol by a single wallet. This field is not linked to the “Protocol/Chain” toggle, and will give a single set of data per chosen asset. The positions field displays the top 100 liquidatable positions of the chosen asset, regardless of protocol or chain, and includes several columns.

Tip: Above the chart on the right, you can click “Download all positions” to download a .csv file containing all liquidatable positions, not just the top 100.

Next steps

  • Check out Aave and Compound docs to see how liquidations function at a deeper level.
  • Head over to the DefiLlama hacks page to see other not-so-nice DeFi metrics.
Related Topics