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
Returns

True when the observation remains inside the threshold.

Return type

bool