grvt.vault_data_export

Documentation for eth_defi.grvt.vault_data_export Python module.

Export GRVT vault data into the ERC-4626 pipeline format.

This module bridges the GRVT-specific DuckDB data into the formats consumed by the existing ERC-4626 vault metrics pipeline:

  • Synthetic VaultRow entries for the VaultDatabase pickle

  • Raw price DataFrames matching the uncleaned Parquet schema, so that GRVT data goes through the same cleaning pipeline as EVM vaults

  • Merge functions to append GRVT data into existing files

Example:

from pathlib import Path
from eth_defi.grvt.daily_metrics import GRVTDailyMetricsDatabase
from eth_defi.grvt.vault_data_export import merge_into_vault_database, merge_into_uncleaned_parquet

db = GRVTDailyMetricsDatabase(Path("daily-metrics.duckdb"))

merge_into_vault_database(db, vault_db_path)
merge_into_uncleaned_parquet(db, uncleaned_parquet_path)

db.close()

Functions

build_raw_prices_dataframe(db)

Build a raw prices DataFrame from the GRVT DuckDB.

create_grvt_vault_row(vault_id, ...[, ...])

Create a synthetic VaultRow for a GRVT native vault.

merge_into_uncleaned_parquet(db, parquet_path)

Merge GRVT daily prices into the uncleaned Parquet file.

merge_into_vault_database(db, vault_db_path)

Merge GRVT vault metadata into an existing VaultDatabase pickle.

create_grvt_vault_row(vault_id, chain_vault_id, name, description, tvl, management_fee=None, performance_fee=None)

Create a synthetic VaultRow for a GRVT native vault.

Builds a VaultRow that matches what calculate_vault_record() expects, using the GRVT chain ID.

GRVT management fees (0-4%) are internalised via daily share minting (already reflected in share price). Performance fees (0-40%) are charged at redemption (externalised, NOT in share price). Fee mode is externalised so the pipeline treats the share price as gross of performance fees.

Per-vault fee percentages are fetched from the GRVT public GraphQL API (managementFee and performanceFee fields). When fees are known, the downstream pipeline can calculate net returns by deducting the externalised performance fee.

Parameters
  • vault_id (str) – Vault string ID on the GRVT platform (e.g. VLT:xxx).

  • chain_vault_id (int) – Numeric on-chain vault ID used by the market data API and the strategies page URL.

  • name (str) – Vault display name.

  • description (str | None) – Vault description text.

  • tvl (float) – Current TVL in USDT.

  • management_fee (float | None) – Annual management fee as a decimal fraction (e.g. 0.01 = 1%). None if not available.

  • performance_fee (float | None) – Performance fee as a decimal fraction (e.g. 0.20 = 20%). None if not available.

Returns

Tuple of (VaultSpec, VaultRow).

Return type

tuple[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]

build_raw_prices_dataframe(db)

Build a raw prices DataFrame from the GRVT DuckDB.

Produces rows matching the schema of the EVM vault scanner (export()), so GRVT data can go through the same cleaning pipeline (process_raw_vault_scan_data()) as ERC-4626 vaults.

The output has timestamp as a column (not index), matching the raw uncleaned Parquet format.

Parameters

db (eth_defi.grvt.daily_metrics.GRVTDailyMetricsDatabase) – The GRVT daily metrics database.

Returns

DataFrame with columns matching the uncleaned Parquet schema.

Return type

pandas.DataFrame

merge_into_vault_database(db, vault_db_path)

Merge GRVT vault metadata into an existing VaultDatabase pickle.

Reads the existing pickle, upserts GRVT VaultRow entries (keyed by VaultSpec), and writes back. Idempotent: running twice produces the same result.

If the pickle file does not exist, creates a new VaultDatabase.

Parameters
Returns

The updated VaultDatabase.

Return type

eth_defi.vault.vaultdb.VaultDatabase

merge_into_uncleaned_parquet(db, parquet_path)

Merge GRVT daily prices into the uncleaned Parquet file.

Writes GRVT raw data in the same format as the EVM vault scanner, so the standard cleaning pipeline (process_raw_vault_scan_data()) can process all vaults together.

Reads the existing Parquet, removes any prior GRVT rows (chain == 325), appends fresh GRVT daily price rows, and writes back. Idempotent: running twice produces the same result.

If the Parquet file does not exist, creates a new one.

Parameters
Returns

The combined DataFrame.

Return type

pandas.DataFrame