apex.vault_data_export
Documentation for eth_defi.apex.vault_data_export Python module.
Export ApeX vault data into the shared vault pipeline format.
This module bridges the ApeX-specific DuckDB data into the metadata pickle and raw price dataframe consumed by the multi-chain vault pipeline. ApeX timestamps are preserved exactly; the exporter does not resample or bucket the source observations.
Functions
Build raw shared-pipeline price rows from the ApeX DuckDB. |
|
|
Create one synthetic shared-pipeline row for an ApeX native vault. |
|
Merge ApeX metadata into the shared vault database pickle. |
- create_apex_vault_row(vault_id, *, name, description, tvl, share_count, created_at, first_seen, status)
Create one synthetic shared-pipeline row for an ApeX native vault.
The ApeX platform vault ID remains the identity through the
apex-vault-{vault_id}address. Fee source values are deliberately not interpreted because ApeX does not authoritatively document their units.- Parameters
vault_id (str) – Stable ApeX platform vault ID.
name (str) – Vault display name.
tvl (Optional[float]) – Current total value in ApeX USDT terms.
share_count (Optional[float]) – Current source-reported share count.
created_at (Optional[datetime.datetime]) – Source creation timestamp as naive UTC.
first_seen (datetime.datetime) – Reader first-observation timestamp as naive UTC.
status (str) – Raw ApeX lifecycle status.
- Returns
Synthetic vault specification and metadata row.
- Return type
tuple[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]
- build_raw_prices_dataframe(db)
Build raw shared-pipeline price rows from the ApeX DuckDB.
Every actual ranking or history timestamp is retained. The resulting columns match
eth_defi.vault.base.RawVaultPriceRow; ApeX has no native block number, soblock_numberis zero.- Parameters
db (eth_defi.apex.metrics.ApexMetricsDatabase) – Open owner-thread ApeX metrics database.
- Returns
Raw price dataframe, or an empty dataframe when the database has no observations.
- Return type
- merge_into_vault_database(db, vault_db_path)
Merge ApeX metadata into the shared vault database pickle.
Existing ApeX identities are replaced in place while unrelated protocol rows are preserved. Missing ApeX ranking entries remain present because the reader retains their metadata and lifecycle state.
- Parameters
db (eth_defi.apex.metrics.ApexMetricsDatabase) – Open owner-thread ApeX metrics database.
vault_db_path (pathlib.Path) – Shared vault metadata pickle path.
- Returns
Updated shared vault database.
- Return type