derive.v3_vault_data_export
Documentation for eth_defi.derive.v3_vault_data_export Python module.
Export Derive v3 native vaults to the shared vault dataset.
Only mainnet rows are eligible for the shared catalogue. Derive reports USD accounting values even when a vault accepts another deposit asset; the latter is kept as a separate source field in the metadata export.
See Derive’s public vault API.
Functions
Build mainnet raw price rows for the shared Parquet schema. |
|
|
Create one synthetic mainnet vault metadata row. |
|
Upsert mainnet Derive metadata while retaining all existing vaults. |
- create_derive_v3_vault_row(record)
Create one synthetic mainnet vault metadata row.
The USD denomination describes NAV and historical share prices. The accepted deposit token is separately retained in
_derive_deposit_asset. Completed fee settlements dilute shares and affect later sampled prices. The historical series does not simulate fees accrued since the last settlement.- Parameters
record (dict) – Mainnet
vault_metadataDuckDB row.- Returns
Shared vault identity and metadata row.
- Raises
ValueError – If the row is from testnet or lacks a deposit asset.
- Return type
tuple[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]
- build_raw_prices_dataframe(db)
Build mainnet raw price rows for the shared Parquet schema.
Every timestamp is an actual Derive observation. USD share price, USD NAV and native share supply stay in the same units as the source API; there is no hourly interpolation or substitution of the live simulated price.
- Parameters
db (eth_defi.derive.v3_vault_metrics.DeriveV3VaultDatabase) – Open Derive v3 DuckDB reader.
- Returns
DataFrame with the columns in
RawVaultPriceRow: naive UTC timestamps, numeric USDshare_priceandtotal_assets(nullable NAV), and numerictotal_supplyin native shares. Empty when no mainnet history is stored.block_numberis zero for these API observations.- Return type
- merge_into_vault_database(db, vault_db_path)
Upsert mainnet Derive metadata while retaining all existing vaults.
If DuckDB has no mainnet metadata, the pickle is not written. Otherwise stored mainnet records are merged, including records retained after a vault disappears from the API listing. Existing unrelated vaults remain.
- Parameters
db (eth_defi.derive.v3_vault_metrics.DeriveV3VaultDatabase) – Open Derive v3 DuckDB reader.
vault_db_path (pathlib.Path) – Shared vault metadata pickle path.
- Returns
Updated or existing vault database.
- Return type