Expand description
Risk metrics and calculations for DeFi applications.
This crate provides risk measurement functions including health factors, liquidation thresholds, and position metrics.
Structs§
- Decimal
- A 128-bit decimal number with deterministic arithmetic.
Enums§
- Arithmetic
Error - Error returned when an arithmetic operation fails.
- Rounding
Mode - Rounding mode for decimal operations.
Functions§
- available_
liquidity - Calculates available liquidity in a pool.
- collateral_
ratio - Calculates the collateral ratio (collateral / debt).
- health_
factor - Calculates the health factor of a lending position.
- is_
healthy - Checks if a position is healthy (health factor >= minimum).
- liquidation_
price - Calculates the price at which a position becomes liquidatable.
- liquidation_
threshold - Calculates the liquidation threshold value.
- loan_
to_ value - Calculates loan-to-value ratio.
- max_
borrowable - Calculates maximum borrowable amount given collateral.
- utilization_
rate - Calculates utilization rate of a lending pool.