VaultHistoricalRead
Documentation for eth_defi.vault.base.VaultHistoricalRead Python class.
- class VaultHistoricalRead
Bases:
objectVault share price and fee structure at the point of time.
Attributes summary
Vault for this result is
block number of the reade
Naive datetime in UTC
What was the share price in vault denomination token
NAV / Assets under management in denomination token
Number of share tokens
What was the vault performance fee around the time
What was the vault management fee around the time
Add RPC error messages and such related to this read
What dynamic read frequency was used at the time of taking this sample
Maximum deposit amount allowed at this point in time (ERC-4626 maxDeposit).
Maximum redeem amount allowed at this point in time (ERC-4626 maxRedeem).
Whether deposits were open at this point in time (protocol-specific logic)
Whether redemptions were open at this point in time (protocol-specific logic)
Whether the vault was actively trading at this point in time.
Available liquidity for immediate withdrawal.
Utilisation percentage of the lending vault.
Methods summary
__init__(vault, block_number, timestamp, ...)export()Convert historical read for a Parquet/DataFrame export.
is_almost_equal(other[, epsilon])Check if the read statistics match.
migrate_parquet_schema(existing_table)Migrate an existing Parquet table to the current schema.
Get parquet schema for writing this data.
- vault: eth_defi.vault.base.VaultBase
Vault for this result is
- block_number: int
block number of the reade
- timestamp: datetime.datetime
Naive datetime in UTC
- share_price: decimal.Decimal | None
What was the share price in vault denomination token
None if the read failed (call execution reverted)
- total_assets: decimal.Decimal | None
NAV / Assets under management in denomination token
None if the read failed (call execution reverted)
- total_supply: decimal.Decimal | None
Number of share tokens
None if the read failed (call execution reverted)
- errors: list[str] | None
Add RPC error messages and such related to this read
Exported as empty string in Parquet if no errors, otherwise concat strings
- vault_poll_frequency: str | None
What dynamic read frequency was used at the time of taking this sample
Useful for diagnostics of scanning process
- max_deposit: decimal.Decimal | None
Maximum deposit amount allowed at this point in time (ERC-4626 maxDeposit).
In denomination token units.
- max_redeem: decimal.Decimal | None
Maximum redeem amount allowed at this point in time (ERC-4626 maxRedeem).
In share token units.
- deposits_open: bool | None
Whether deposits were open at this point in time (protocol-specific logic)
- redemption_open: bool | None
Whether redemptions were open at this point in time (protocol-specific logic)
- trading: bool | None
Whether the vault was actively trading at this point in time.
Currently only supported for D2 Finance vaults.
- available_liquidity: decimal.Decimal | None
Available liquidity for immediate withdrawal.
Only applicable to lending protocol vaults (IPOR, Euler, Morpho, Gearbox, etc.) In denomination token units.
- utilisation: float | None
Utilisation percentage of the lending vault.
Only applicable to lending protocol vaults. Value between 0.0 and 1.0 (0% to 100%).
- is_almost_equal(other, epsilon=0.001)
Check if the read statistics match.
Throttle with epsilon relative difference to get rid of small increment rows
- Parameters
epsilon (float) – Write changes with 10 BPS granularity
other (eth_defi.vault.base.VaultHistoricalRead | None) –
- Return type
- export()
Convert historical read for a Parquet/DataFrame export.
- Return type
- classmethod to_pyarrow_schema()
Get parquet schema for writing this data.
Write multiple chains, multiple vaults, to a single Parquet file
- Return type
pyarrow.Schema
- static migrate_parquet_schema(existing_table)
Migrate an existing Parquet table to the current schema.
When new columns are added to
to_pyarrow_schema(), existing parquet files still have the old schema. This function adds missing columns as null arrays so incremental scans can write new data without losing columns.- Parameters
existing_table (pyarrow.Table) – Table read from an older parquet file.
- Returns
Table with all current schema columns, missing ones filled with nulls.
- Return type
pyarrow.Table
- __init__(vault, block_number, timestamp, share_price, total_assets, total_supply, performance_fee, management_fee, errors, vault_poll_frequency=None, max_deposit=None, max_redeem=None, deposits_open=None, redemption_open=None, trading=None, available_liquidity=None, utilisation=None)
- Parameters
vault (eth_defi.vault.base.VaultBase) –
block_number (int) –
timestamp (datetime.datetime) –
share_price (decimal.Decimal | None) –
total_assets (decimal.Decimal | None) –
total_supply (decimal.Decimal | None) –
performance_fee (float | None) –
management_fee (float | None) –
vault_poll_frequency (str | None) –
max_deposit (decimal.Decimal | None) –
max_redeem (decimal.Decimal | None) –
deposits_open (bool | None) –
redemption_open (bool | None) –
trading (bool | None) –
available_liquidity (decimal.Decimal | None) –
utilisation (float | None) –
- Return type
None