calculate_vault_record
Documentation for eth_defi.research.vault_metrics.calculate_vault_record function.
- calculate_vault_record(prices_df, vault_metadata_rows, month_ago, three_months_ago, vault_id=None, core3_protocols=None)
Process a single vault metadata + prices to calculate its full data.
Exported to frontend, everything
- Parameters
prices_df (pandas.DataFrame) – Price DataFrame for a single vault, conforming to
CleanedVaultPriceRowvault_metadata_rows (dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Dictionary of vault metadata keyed by VaultSpec
month_ago (pandas.Timestamp) – Timestamp for 1-month lookback
three_months_ago (pandas.Timestamp) – Timestamp for 3-month lookback
vault_id (Optional[str]) – Vault ID string. If not provided, extracted from prices_df[“id”].
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(). When given, a compact per-vaultcore3summary (Core3VaultSection) is attached to the record for the vault’s protocol, orNoneif the protocol has no Core3 data.
- Returns
Series with calculated metrics
- Return type