Free lesson · DeFi models
Collateral health factor and correlated shocks
Open interactive lessonPractice calculationsExplore labs
Start with the idea
A lending position is protected by collateral only to the extent its discounted value covers the debt under the protocol’s valuation rules.
Symbols, units & horizon
- H: dimensionless health factor
- V_i: collateral i value in USD under specified oracle
- τ_i: liquidation threshold fraction
- D: positive debt USD value at the same checkpoint
- i: collateral asset
When and why to use this
Build a collateral stress matrix with oracle timing, accrued debt and withdrawal restrictions.
A lending position is protected by collateral only to the extent its discounted value covers the debt under the protocol’s valuation rules.
For multiple collateral assets, sum value times each liquidation threshold and divide by debt value. A health factor of one is a modeled boundary, not a safe target.
Use the oracle’s valuation convention and current debt units. Collateral falling while borrowed stablecoin rises is a joint adverse scenario. Interest accrual and changes to eligibility can erode health without a new trade.
Collateral health factor and correlated shocks
- Value each collateral asset at the specified checkpoint.
- Multiply by its liquidation threshold and sum the eligible amounts.
- Divide by current debt and inspect values near or below one.
Collateral $12,000, threshold .8 and debt $8,000 yield H=9600/8000=1.2. A 20% collateral fall at unchanged debt gives .96.
Apply it in a strategy
- Build a collateral stress matrix with oracle timing, accrued debt and withdrawal restrictions.
- Record the input timestamp, executable quantity, currency and horizon. Reconcile the result with a cash-flow or state table.
- Stress this failure condition: An apparently healthy stale oracle can conceal an economically insolvent position.
Research deliverable
Build and explain a collateral health factor and correlated shocks worksheet. Build a collateral stress matrix with oracle timing, accrued debt and withdrawal restrictions.
Evidence boundary: Synthetic arithmetic and scenarios illustrate mechanics. They are not historical returns, a paper replication, or evidence of an executable edge. Research sources and their access limitations are recorded at the end of this module.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
# Python 3.10+; standard library unless NumPy is imported below.
# Inputs and outputs use the units defined in this lesson. Synthetic teaching example.
def health_factor(values,thresholds,debt):
if debt<=0 or len(values)!=len(thresholds) or any(v<0 for v in values) or any(not 0<=t<=1 for t in thresholds): raise ValueError("Invalid health inputs")
return sum(v*t for v,t in zip(values,thresholds))/debt
print(health_factor([12000],[.8],8000),health_factor([9600],[.8],8000))Continue learning
DeFi: AMMs, Liquidity Provision and Lending — all lessons- Constant-product swaps with an input fee
- LP inventory after price changes
- LP value versus holding the original tokens
- Concentrated liquidity and range boundaries
- LVR and the price of stale inventory
- Lending utilization and rate response
- Collateral health factor and correlated shocks
- Liquidation incentives after execution costs
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations