Account Health

Every account's health is represented as a health factor. Your account health factor is a single value that encapsulates how well-collateralized your portfolio is - or, how healthy it is.

Account health is calculated with the following formula:

A=assetsweightedliabilitiesweightedassetsweightedA = \frac{assets_{weighted} - liabilities_{weighted}}{assets_{weighted}}

Account health is typically between 0% and 100%, but can technically go as low as -∞.

When your account health reaches 0% or below, you are exposed to liquidation.

NOTE: weighted assets and liabilities are used in account health calculations. They're explained below.

Assets as collateral

When you lend an asset on marginfi, there are a few values to keep in mind when pricing the value of your collateral:

  • Every asset has a market USD price, as determined by its oracle.

  • Every asset has a confidence band-adjusted market USD price, as determined by the bottom limit of the price oracle's 95% confidence band.

  • Every asset has a weighted price, which is the confidence band-adjusted market USD price multiplied by the asset's deposit weight.

Here's an example:

  • Let's say a price oracle supplies a market USD price for SOL of $25.

  • The price oracle's 95% confidence band is +/- $1, i.e. $24-26. The bottom limit of this confidence band is $24, so the confidence band-adjusted market USD price is $24.

  • Let's say the SOL asset weight on marginfi is 90%. We multiply the confidence band-adjusted market USD price by the asset weight, or $24 * 90%.

  • After all adjustments, SOL is priced at $21.60 as collateral.

This multi-step approach to asset pricing allows marginfi to conservatively value assets, robust to multiple volatility and price manipulation angles.

Liabilities as borrows

Similarly to assets, liabilities on marginfi are adjusted:

  • Every liability has a market USD price, as determined by its oracle. This market USD price is the same market USD price as a given token would have when being lent.

  • Every liability has a confidence band-adjusted market USD price, as determined by the top limit of the price oracle's 95% confidence band.

  • Every liability has a weighted price, which is the confidence band-adjusted market USD price multiplied by the liability's borrow weight.

Here's an example:

  • Let's say a price oracle supplies a market USD price for SOL of $25.

  • The price oracle's 95% confidence band is +/- $1, i.e. $24-26. The top limit of this confidence band is $26, so the confidence band-adjusted market USD price is $26.

  • Let's say the SOL LTV on marginfi is 80%. We multiply the confidence band-adjusted market USD price by 1LTV\frac{1}{LTV}. In this case, 10.80=1.25\frac{1}{0.80} = 1.25.

  • After all adjustments, SOL is priced at $32.50 when borrowed.

Conservative pricing illustrated

Notice that SOL is valued differently at a given price depending on whether it's an asset or a liability.

At a market price of $25 (and assuming the configured parameters above), SOL is valued at $21.60 as an asset and $32.50 as a liability.

Last updated