DeriveV3VaultDatabase
Documentation for eth_defi.derive.v3_vault_metrics.DeriveV3VaultDatabase Python class.
- class DeriveV3VaultDatabase
Bases:
objectFile-backed public vault metadata and daily performance observations.
Metadata is keyed by
(network, subaccount_id); prices also includetimestamp. Amounts are stored as decimal strings. Ingestion handles duplicate keys without unique constraints because large ART indexes have caused native DuckDB crashes under Python 3.14 in this repository.- Parameters
path – Destination DuckDB file.
Methods summary
__init__(path)close()Close the file-backed database connection.
get_vault_metadata(network)Read current vault metadata for one deployment.
get_vault_prices(network)Read sampled vault prices for one deployment.
store_vault(network, vault, prices)Replace one vault's metadata and fetched history transactionally.
- __init__(path)
- Parameters
path (pathlib.Path) –
- store_vault(network, vault, prices)
Replace one vault’s metadata and fetched history transactionally.
A fetched point replaces the stored point at the same timestamp. All other timestamps survive, including gaps within the fetched range.
observed_atretains the first scan time when metadata is refreshed.- Parameters
network (str) – Source deployment name.
vault (eth_defi.derive.v3_vaults.DeriveV3Vault) – Fresh public vault metadata.
prices (list[eth_defi.derive.v3_vaults.DeriveV3VaultPrice]) – Fetched performance points.
- Returns
None.- Return type
None
- get_vault_metadata(network)
Read current vault metadata for one deployment.
Includes previously stored vaults that no longer appear in the API listing.
first_price_atcomes from the earliest stored price.- Parameters
network (str) –
testnetormainnet.- Returns
DataFrame with the
vault_metadatacolumns and nullablefirst_price_atas a naive UTC timestamp. One row per vault.- Return type
- get_vault_prices(network)
Read sampled vault prices for one deployment.
Rows are ordered by subaccount ID, then observation timestamp.
- Parameters
network (str) –
testnetormainnet.- Returns
DataFrame with integer
subaccount_id, naive UTCtimestampandwritten_at, stringnetwork, and decimal stringsshare_price,nav_usd(nullable) andtotal_shares.- Return type
- close()
Close the file-backed database connection.
- Returns
None.- Return type
None