classify_vault

Documentation for eth_defi.vault_report.sections.classify_vault function.

classify_vault(vault)

Classify a vault into one of the report’s vault groups.

Every vault belongs to exactly one group, which decides its best-performing section, its table thresholds in select_group() and whether it counts as stablecoin yield. The rules are checked in priority order, the first match wins:

  1. AMM: the scanner’s amm_pool_like vault feature. The amm strategy tag is deliberately not used: vaults tagged amm, such as Gains Network gTrade and KiloEx, stay in their other groups.

  2. PERP_DEX: the perp_dex_trading_vault flag, precomputed as is_perp_dex.

  3. TOKENISED_FUND: the tokenised_fund flag, so funds financing real-world credit stay with the other funds.

  4. RWA: an RWA strategy tag, checked before lending so RWA lending vaults count as RWA, see RWA_STRATEGY_TAGS.

  5. LENDING: a lending strategy tag, or a known lending protocol for adapters that set no tags, see LENDING_PROTOCOL_SLUGS.

  6. OTHER: everything else.

Applied row by row with pandas.DataFrame.apply() in eth_defi.vault_report.data.prepare_vault_metrics(). List columns come from JSON and are NaN or None when missing, hence the isinstance checks.

Parameters

vault (pandas.Series) – Vault metrics row with features, is_perp_dex, flags, strategy_tags and protocol_slug. features, flags and strategy_tags are lists of enum values or missing.

Returns

AMM, PERP_DEX, TOKENISED_FUND, RWA, LENDING or OTHER.

Return type

str