select_benchmarks

Documentation for eth_defi.vault_report.benchmarks.select_benchmarks function.

select_benchmarks(vault, min_volatility, max_drawdown)

Choose the benchmarks a vault is compared with.

A benchmark should be the alternative a reader would otherwise hold: the T-bill for a stablecoin yield product, BTC and ETH for a vault whose returns depend on the crypto market. Called per vault in a performance chart; the chart then draws the benchmarks used by at least half of its vaults, see eth_defi.vault_report.charts.create_performance_figure().

Follows the website’s rules (src/lib/top-vaults/vault-price-benchmarks.ts and isPerpetualFuturesVault.ts in the frontend), checked in order:

  1. perpetual futures vaults, by flag or synthetic perp DEX chain id: BTC and ETH

  2. GMX: GLV pools BTC and ETH; stablecoin-only swap pools the Treasury bill; GM BTC and ETH pools only their own asset; other GM pools BTC and ETH

For other vaults, the website always uses the T-bill. The report adds an activity rule: a vault with three-month volatility at or above min_volatility, or a three-month drawdown at or below max_drawdown, behaves like a trading strategy and is compared with BTC and ETH. Calm yield vaults are compared with the Treasury bill. Missing volatility or drawdown does not trigger the rule.

Parameters
  • vault (pandas.Series) – Vault metrics row with flags, chain_id, protocol_slug, vault_slug, name, three_months_volatility and three_months_max_drawdown.

  • min_volatility (float) – Annualised volatility from which a vault counts as volatile.

  • max_drawdown (float) – Drawdown, a negative fraction, from which a vault counts as volatile.

Returns

Benchmark names, e.g. ("BTC", "ETH").

Return type

tuple[str, …]