calculate_lifetime_metrics
Documentation for eth_defi.research.vault_metrics.calculate_lifetime_metrics function.
- calculate_lifetime_metrics(df, vault_db, returns_column='returns_1h', core3_protocols=None)
Calculate lifetime metrics for each vault in the provided DataFrame.
All-time returns
3M returns, latest
1M returns, latest
Volatility (3M)
Lookback based on the last entry.
- Parameters
df (pandas.DataFrame) – Cleaned price DataFrame conforming to
CleanedVaultPriceRow. Must have aDatetimeIndex.vault_db (Union[eth_defi.vault.vaultdb.VaultDatabase, dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]]) – Pass all vaults or subset of vaults as VaultRows, or full VaultDatabase
core3_protocols (Optional[dict[str, eth_defi.core3.vault_protocol.Core3ExportRecord]]) – Optional Core3 risk records keyed by our protocol slug, as returned by
eth_defi.core3.vault_protocol.build_core3_protocols_for_export(). Threaded through tocalculate_vault_record()to attach a per-vaultcore3summary.Noneto skip Core3 enrichment.returns_column (str) –
- Returns
DataFrame, one row per vault.
- Return type