> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sonaragent.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Health Factor

> How Sonar computes liquidation risk

The **health factor (HF)** measures how safe a position is from liquidation. Sonar computes it the same way the lending protocol does — an Aave-style, Zest-native formula:

```
HF = Σ(collateralUSD × liquidationThreshold) / Σ(debtUSD)
```

| Health factor    | Status                  |
| ---------------- | ----------------------- |
| HF ≥ 1.5         | Safe                    |
| 1.1 ≤ HF \< 1.5  | Caution                 |
| 1.0 \< HF \< 1.1 | Approaching liquidation |
| HF \< 1.0        | Liquidatable            |

## Inputs (all read live from mainnet)

<CardGroup cols={2}>
  <Card title="Collateral & debt" icon="coins">
    Per-reserve balances from `get-user-reserve-data` and the aToken balance.
  </Card>

  <Card title="Liquidation threshold" icon="gauge">
    From `get-reserve-state` — e.g. sBTC = `0.75` (75%).
  </Card>

  <Card title="Oracle price" icon="chart-line">
    From the reserve's on-chain oracle — e.g. `stx-btc-oracle-v1-4`.
  </Card>

  <Card title="Decimals" icon="hashtag">
    Per-asset fixed-point scaling from `get-reserve-state`.
  </Card>
</CardGroup>

## Worked example

A position with **0.5 sBTC** collateral and **$21,000** borrowed, at a live sBTC price of **$64,472** and a liquidation threshold of **0.75**:

```
weighted collateral = 0.5 × $64,472 × 0.75 = $24,177
health factor       = $24,177 / $21,000     = 1.15   (caution)
liquidation price   = $21,000 / (0.5 × 0.75) = $56,000
```

If sBTC falls to **\$56,000**, the health factor hits `1.0` and the position becomes liquidatable. Sonar alerts well before that point.
