clean_by_tvl

Documentation for eth_defi.research.wrangle_vault_prices.clean_by_tvl function.

clean_by_tvl(rows, prices_df, logger=<built-in function print>, tvl_threshold_min=1000.0, tvl_threshold_max=99000000000, tvl_threshold_min_dynamic=0.02, returns_col='returns_1h')

TVL-based threshold filtering of returns.

Hypercore keeps its PnL/NAV price-derived return because rewriting the return alone would make profit disagree with the cleaned share price. Its low-TVL observations still receive tvl_filtering_mask=True so investment-suitability consumers can exclude them. Other protocols retain the existing zero-return behaviour.

Parameters
  • rows (dict[eth_typing.evm.HexAddress, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata keyed by address. Retained for compatibility with the existing cleaner interface.

  • prices_df (pandas.DataFrame) – Timestamp-indexed price rows containing id, chain, total_assets, and the selected return column.

  • logger – Notebook, console, or structured-log adapter accepting one message.

  • tvl_threshold_min – Absolute minimum NAV in USD.

  • tvl_threshold_max – Absolute maximum NAV in USD.

  • tvl_threshold_min_dynamic – Minimum NAV as a fraction of the vault’s all-time average NAV.

  • returns_col – Name of the return column to clean.

Returns

The input frame with TVL audit columns and protocol-appropriate return cleaning applied.

Return type

pandas.DataFrame