is_relative_change_within_threshold
Documentation for eth_defi.vault.base.is_relative_change_within_threshold function.
- is_relative_change_within_threshold(current, previous, threshold=0.001)
Return whether two optional values differ by at most a relative threshold.
Zero and missing values cannot be compared relatively and therefore match only when they are exactly equal. Historical readers use this helper to share one change-filtering rule across ERC-4626 and share-price-equivalent products.
- Parameters
current (Optional[Union[decimal.Decimal, float]]) – Newly observed value.
previous (Optional[Union[decimal.Decimal, float]]) – Previously retained value.
threshold (float) – Maximum absolute relative difference considered unchanged.
- Returns
Truewhen the observation remains inside the threshold.- Return type