research.wrangle_vault_prices
Documentation for eth_defi.research.wrangle_vault_prices Python module.
Clean vault price data.
Denormalise data to a single DataFrame
Remove abnormalities in the price data
Reduce data by removing hourly changes that are below our epsilon threshold
Generate returns data
The input is the raw scanner parquet conforming to
RawVaultPriceRow.
The output is a cleaned DataFrame conforming to
CleanedVaultPriceRow, consumed by
calculate_lifetime_metrics().
Module Attributes
NAV at or below this value counts as a complete Hypercore wipe-out. |
|
Sidecar metadata identifying the initial-observation and valid-price policy. |
|
Older sidecars without this version must be rebuilt from hourly prices. |
|
Maximum absolute mismatch when recognising a delayed PnL/NAV API update. |
|
Maximum relative mismatch when recognising a delayed PnL/NAV API update. |
|
PnL-first, NAV-confirming API lag needs a baseline and two later checkpoints. |
|
New capital must reach this NAV before a recapitalised vault is tracked again. |
|
A new Hypercore vault needs this NAV before its performance history is published. |
|
Minimum observations needed to infer the median sampling interval. |
|
Internal integer grouping key reused across the large cleaning stages. |
|
For manual debugging, we process these vaults first |
|
Vault state and pass-through columns added by the historical scanner. |
Functions
|
Add denormalised data to the prices DataFrame. |
Build an approximate Hypercore economic-performance index from PnL and NAV. |
|
|
Ensure all vaults have unique human-readable name. |
|
Map repaired vault names onto an already filtered price frame. |
|
Calculate returns for each vault. |
|
Check that we have metadata for all vaults in the prices DataFrame. |
|
TVL-based threshold filtering of returns. |
|
Clean returns data by removing rows with NaN or infinite values. |
|
Derive unified |
Discard an unfunded Hypercore vault's leading price observations. |
|
Start a recapitalised Hypercore vault at its new meaningful capital base. |
|
|
Ensure vault state columns are present in the DataFrame. |
|
Dedpulicate data rows with epsilon. |
|
Reduce vault price rows to selected denomination families. |
|
Reduce vaults to stablecoin vaults using the compatibility selection. |
|
Repair isolated share-price observations that disagree with their neighbours. |
|
Forward fill missing vault prices up to max_gap_hours. |
Clean raw scanned vault prices and atomically write an analysis dataset. |
|
|
Build a dictionary of vaults by their chain-address id. |
|
Select valid daily closing observations and each vault's first price. |
|
Preprocess vault data for further analysis. |
|
Remove initial inactive period from each vault's price history. |
|
Rebuild and atomically replace cleaned histories for selected vaults. |
Normalise share prices and mark unusable observations as missing. |
|
|
Sort observations into the stable order expected by cleaning stages. |
|
Write an atomic daily sidecar from an already-cleaned price frame. |
Classes
Schema for a single row in the cleaned vault price DataFrame. |
- HYPERCORE_ZERO_NAV_EPSILON = 1e-06
NAV at or below this value counts as a complete Hypercore wipe-out.
- DAILY_VAULT_PRICE_VERSION_METADATA_KEY = b'daily_vault_price_version'
Sidecar metadata identifying the initial-observation and valid-price policy.
- DAILY_VAULT_PRICE_VERSION = b'2'
Older sidecars without this version must be rebuilt from hourly prices.
- HYPERCORE_ECONOMIC_CHECKPOINT_INTERVAL = Timedelta('0 days 04:00:00')
Fixed UTC interval used to select publishable Hypercore economic checkpoints.
- MAX_HYPERCORE_PNL_NAV_CONFIRMATION_DELAY = Timedelta('1 days 02:00:00')
Maximum elapsed time accepted around a delayed Hypercore NAV confirmation.
- HYPERCORE_PNL_NAV_LAG_ABSOLUTE_TOLERANCE = 1.0
Maximum absolute mismatch when recognising a delayed PnL/NAV API update.
- HYPERCORE_PNL_NAV_LAG_RELATIVE_TOLERANCE = 0.001
Maximum relative mismatch when recognising a delayed PnL/NAV API update.
- MIN_HYPERCORE_PNL_NAV_LAG_CHECKPOINTS = 3
PnL-first, NAV-confirming API lag needs a baseline and two later checkpoints.
- MIN_HYPERCORE_RECAPITALISATION_ASSETS = 1000.0
New capital must reach this NAV before a recapitalised vault is tracked again.
- MIN_HYPERCORE_INITIAL_TRACKING_ASSETS = 1000.0
A new Hypercore vault needs this NAV before its performance history is published.
Use the same threshold as a post-wipe-out epoch, so a vault starts its initial and recovery curves from the first $1,000 NAV observation.
- MIN_HYPERCORE_RECAPITALISATION_RECOVERY_DELAY = Timedelta('7 days 00:00:00')
Ignore isolated zero-NAV observations that recover before this delay.
- MIN_ROWS_FOR_INTERVAL_ESTIMATE = 2
Minimum observations needed to infer the median sampling interval.
- INTERNAL_VAULT_GROUP_COLUMN = '_vault_group_code'
Internal integer grouping key reused across the large cleaning stages.
The column is removed before a cleaned frame is returned. Keeping one first-seen factorisation avoids repeatedly hashing millions of string IDs.
- class CleanedVaultPriceRow
Bases:
TypedDictSchema for a single row in the cleaned vault price DataFrame.
This is the enriched format produced by the cleaning pipeline in this module and consumed by
calculate_lifetime_metrics().It extends
RawVaultPriceRowwith denormalised metadata columns (id,name,event_count,protocol) and computed columns (returns_1h).returns_1his a legacy name: it is the return between consecutive observations and does not guarantee a one-hour interval. The DataFrame uses aDatetimeIndexbuilt from thetimestampcolumn.The live raw scanner reports rows older than 14 days for vaults with verified USD TVL of at least $1,500, remaining eligible down to $1,000. Cleaning may remove raw rows because of denomination, metadata, activity or quality filters, so this schema alone does not guarantee a fresh row.
timestampis source time;written_atis publication time.Columns are grouped by availability:
General columns are present for all vault protocols.
ERC-4626 only columns come from on-chain ERC-4626 calls and are NaN / empty for native protocols.
Lending only columns are populated for lending protocol vaults (IPOR, Euler, Morpho, Gearbox, etc.) and NaN for others.
Hypercore only columns come from the Hyperliquid native vault API and are NaN for all other protocols.
Investor-flow amount columns contain direct daily observations for Hypercore and Lighter. Event counts are available for Hypercore only. These columns remain NaN in cleaned ERC-4626 price data; the metrics exporter can estimate signed stablecoin-vault flow later from consecutive daily total-assets, total-supply and share-price states.
- chain: int
EVM chain id (e.g.
1for Ethereum,8453for Base).Native (non-EVM) protocols use synthetic in-house chain ids:
9999— Hypercore (native Hyperliquid vaults), seeHYPERCORE_CHAIN_ID9998— Lighter DEX pools, seeLIGHTER_CHAIN_ID9997— Hibachi native vaults, seeHIBACHI_CHAIN_ID9995— ApeX native vaults, seeAPEX_CHAIN_ID9993— Derive v3 native vaults, seeDERIVE_V3_CHAIN_ID325— GRVT (Gravity Markets), seeGRVT_CHAIN_ID
The full mapping lives in
CHAIN_NAMES.General — present for all protocols.
- address: str
Vault contract address, lowercase.
Address formats vary by protocol:
EVM vaults:
0x-prefixed hex (e.g."0xabcd...")Hypercore:
0x-prefixed hex (Hyperliquid vault addresses)GRVT: platform-specific id (e.g.
"vlt:xxx")Lighter: synthetic id (e.g.
"lighter-pool-281474976710654")Hibachi: synthetic id (e.g.
"hibachi-vault-2")ApeX: synthetic id (e.g.
"apex-vault-2044287989957394432")
See
is_good_multichain_address()for the validation function that accepts all these formats.General — present for all protocols.
- block_number: int
Block number of the on-chain read. For native protocols without blocks this is a synthetic sequence number.
General — present for all protocols.
- timestamp: pandas.Timestamp
Naive UTC timestamp of the real source observation (also the index). Use this, rather than
written_at, to assess the 14-day age.General — present for all protocols.
Share price in denomination token units.
For ERC-4626 vaults this is read directly from the contract (
convertToAssets(1e decimals)). GRVT, Lighter, and Hibachi provide native share prices from their respective APIs. Hypercore (native Hyperliquid vaults) does not expose a historical share price or supply. Its cleaned value is a PnL/NAV economic-performance index starting at1.0for each retained capital epoch. The scanner’s synthetic input remains available inraw_share_price.General — present for all protocols.
- total_assets: float
Total assets under management (TVL) in denomination token units. EVM freshness eligibility converts this using the reader’s existing estimated USD exchange rate. Native feeds use USD stablecoin units.
General — present for all protocols.
- total_supply: float
Total supply of vault share tokens. Hypercore has no exposed historical token supply; its value is synthetic index units calculated as
total_assets / share_priceand must not be interpreted as an on-chain share count.General — present for all protocols.
- performance_fee: float
Performance fee at time of read (e.g. 0.20 = 20%). NaN if unknown.
General — present for all protocols.
- management_fee: float
Management fee at time of read (e.g. 0.02 = 2%). NaN if unknown.
General — present for all protocols.
- errors: str
Comma-separated RPC error messages, or empty string if no errors.
Example values:
"total_supply call failed","total_assets zero: 0","total_supply call missing". Always empty for native protocols.General — present for all protocols (always empty for native protocols).
- vault_poll_frequency: str
Dynamic poll frequency used when taking this sample. Empty string if not set.
Example EVM labels:
"large_tvl","small_tvl","tiny_tvl","peaked","faded","unverified_tvl"and"contextual". Unknown TVL polls hourly without certifying USD value. Peaked and faded vaults poll weekly; other vaults at $10,000+ estimated USD TVL poll hourly. This is separate from row retention.General — present for all protocols (may be empty for native protocols).
- name: str
Human-readable vault name (unique within the dataset).
General — present for all protocols.
- event_count: int
Total deposit + redeem events observed for this vault.
Zero if the protocol does not support on-chain deposit/redeem event tracking (e.g. native vaults like GRVT, Lighter, Hibachi).
General — present for all protocols.
- protocol: str
Protocol name (e.g.
"Morpho","Yearn","Hyperliquid").General — present for all protocols.
- returns_1h: float
Hourly return as
pct_change()ofshare_pricewithin each vault group. Despite the name, for native protocols (Hypercore, GRVT, Lighter) the interval may be daily or irregular — the column name is kept for backward compatibility.General — present for all protocols.
- max_deposit: float
Maximum deposit amount allowed (ERC-4626
maxDeposit). NaN if unknown.ERC-4626 only — NaN for native protocols.
- max_redeem: float
Maximum redeem amount allowed (ERC-4626
maxRedeem). NaN if unknown.ERC-4626 only — NaN for native protocols.
- deposits_open: str
Whether deposits were open:
"true","false", or"".ERC-4626 only — empty for native protocols.
- redemption_open: str
Whether redemptions were open:
"true","false", or"".ERC-4626 only — empty for native protocols.
- trading: str
Whether the vault was actively trading:
"true","false", or"". Currently only supported for D2 Finance vaults.Protocol-specific — empty for most protocols.
- available_liquidity: float
Available liquidity for immediate withdrawal in denomination token units. NaN if not applicable.
Lending only — IPOR, Euler, Morpho, Gearbox, etc. NaN for other protocols.
- utilisation: float
Utilisation ratio (0.0-1.0) for lending vaults. NaN if not applicable.
Warning
This metric measures capital deployment efficiency (how much of the vault’s AUM is lent out), not redeemable liquidity. For single-market vaults (Euler EVK, Gearbox, Silo) high utilisation does mean low available liquidity. For multi-market aggregators (Morpho, Euler Earn, IPOR) a vault can show 95% utilisation yet have substantial instantly redeemable liquidity in low-utilisation underlying markets. See
README-vault-redeemable.mdandREADME-utilisation.mdineth_defi.erc_4626.vault_protocolfor details.Lending only — IPOR, Euler, Morpho, Gearbox, etc. NaN for other protocols.
- deposit_closed_reason: str
Unified reason why deposits are closed (e.g.
"Vault deposits disabled"). Empty string if deposits are open. Derived fromdeposits_openfor ERC-4626 vaults or set directly by native protocol exporters.General — present for all protocols (empty when deposits are open).
- written_at: pandas.Timestamp
Publication time (naive UTC), not the source observation time. NaT for old data; use
timestampfor the live 14-day freshness check.General — present for all protocols.
- perp_position_data_status: str
Position availability or freshness state, such as
availableorstale. Stale numeric values remain present for auditability.
- perp_metrics_observed_at: pandas.Timestamp
Actual source measurement time at one-second resolution. This remains attached to stale values and observations forward-aligned to the latest row of a delayed native price feed.
- vault_settlement_at: pandas.Timestamp
Latest asynchronous vault settlement timestamp in the interval ending at this price row.
General — populated by merging
vault-settlements.duckdbafter cleaning.NaTmeans no known settlement occurred since the previous cleaned price row.
- leader_fraction: float
Fraction of vault assets controlled by the leader (0.0-1.0).
Hypercore only — NaN for all other protocols.
- leader_commission: float
Commission rate charged by the vault leader (0.0-1.0).
Hypercore only — NaN for all other protocols.
- follower_count: float
Number of followers in the vault.
Hypercore only — NaN for all other protocols.
- account_pnl: float
Cumulative PnL of the vault leader account in USD.
Hypercore only — NaN for all other protocols.
- cumulative_volume: float
Cumulative trading volume of the vault in USD.
Hypercore only — NaN for all other protocols.
- hypercore_source: str
Hypercore scanner source:
"daily"or"hf".Used during wrangling to reconcile overlapping synthetic share prices. Hypercore only — NaN for all other protocols.
- epoch_reset: bool
The row starts a new performance epoch after a complete wipe-out.
Hypercore only — false for ordinary observations.
- hypercore_repair_status: str
Provenance of the cleaned Hypercore PnL/NAV approximation.
approximated_pnl_navmarks a four-hour economic checkpoint,approximated_pnl_nav_clippeda positive checkpoint capped at 100%,approximated_pnl_nav_lag_repaireda gain whose NAV confirmation arrived within the bounded confirmation window,approximated_pnl_nav_wipe_outa terminal NAV-corroborated loss, andapproximated_pnl_nav_carrieda row that adds no performance, either because it is not the selected checkpoint for its four-hour UTC bucket, because its PnL awaits NAV confirmation, or because the epoch is already at zero after a terminal loss. A later NAV confirmation can revise the recent provisional PnL-only checkpoint and subsequently compounded prices.deferred_pnl_navmeans inputs were missing anddeferred_pnl_nav_outliermeans an uncorroborated negative PnL step was not allowed to zero a funded vault. Hypercore only — empty for ordinary observations and other protocols.
- daily_deposit_count: float
Number of deposit events in the latest day.
Direct protocol flow — Hypercore only. NaN for other protocols.
- daily_withdrawal_count: float
Number of withdrawal events in the latest day.
Direct protocol flow — Hypercore only. NaN for other protocols.
- daily_deposit_usd: float
Total USD deposited in the latest day.
Direct protocol flow — Hypercore and Lighter. NaN for other protocols.
- daily_withdrawal_usd: float
Total USD withdrawn in the latest day.
Direct protocol flow — Hypercore and Lighter. NaN for other protocols.
- __init__(*args, **kwargs)
- __new__(**kwargs)
- clear()
Remove all items from the dict.
- copy()
Return a shallow copy of the dict.
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items()
Return a set-like object providing a view on the dict’s items.
- keys()
Return a set-like object providing a view on the dict’s keys.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
Return an object providing a view on the dict’s values.
- PRIORITY_SORT_IDS = ['8453-0x0d877dc7c8fa3ad980dfdb18b48ec9f8768359c4']
For manual debugging, we process these vaults first
- get_vaults_by_id(rows)
Build a dictionary of vaults by their chain-address id.
- Parameters
rows (collections.abc.Mapping[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Metadata rows from vault database
- Returns
Dictionary of vaults by their chain-address id
- Return type
- VAULT_STATE_COLUMNS = {'account_pnl': nan, 'available_liquidity': nan, 'cumulative_volume': nan, 'daily_deposit_count': nan, 'daily_deposit_usd': nan, 'daily_withdrawal_count': nan, 'daily_withdrawal_usd': nan, 'deposit_closed_reason': '', 'deposits_open': '', 'epoch_reset': False, 'follower_count': nan, 'hypercore_repair_status': '', 'leader_commission': nan, 'leader_fraction': nan, 'max_deposit': nan, 'max_redeem': nan, 'perp_largest_position_notional': nan, 'perp_long_notional': nan, 'perp_metrics_observed_at': NaT, 'perp_open_position_count': <NA>, 'perp_position_data_status': '', 'perp_quote_asset': '', 'perp_short_notional': nan, 'redemption_open': '', 'trading': '', 'utilisation': nan, 'vault_settlement_at': NaT, 'written_at': NaT}
Vault state and pass-through columns added by the historical scanner. Ensure these are always present in cleaned data, even when processing old scan data that lacks them. See
CleanedVaultPriceRowfor column semantics.
- ensure_vault_state_columns(prices_df)
Ensure vault state columns are present in the DataFrame.
Adds missing columns with default values for backward compatibility with raw scan data generated before these fields were added.
- Parameters
prices_df (pandas.DataFrame) –
- Return type
- derive_deposit_closed_reason(prices_df)
Derive unified
deposit_closed_reasonfrom protocol-specific columns.For Hyperliquid vaults,
deposit_closed_reasonis already set bybuild_raw_prices_dataframe()with specific reason strings.For ERC-4626 vaults, the
deposits_openstring column (“true”/”false”/””) is converted to a generic reason.- Parameters
prices_df (pandas.DataFrame) – DataFrame with
deposit_closed_reasonanddeposits_opencolumns.- Returns
DataFrame with
deposit_closed_reasonfilled in for both vault types.- Return type
- assign_unique_names(rows, prices_df, logger=<built-in function print>, duplicate_nav_threshold=1000, *, assign_names=True)
Ensure all vaults have unique human-readable name.
Rerwrite metadata rows
Find duplicate vault names
Add a running counter to the name to make it unique
The raw price frame can contain many more rows than the selected denomination family. Callers may therefore request only the canonical
idcolumn first, filter the frame, and add names afterwards. The default remainsTruefor notebook and script callers that expect the historical behaviour.- Parameters
rows (dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata keyed by
VaultSpec.prices_df (pandas.DataFrame) – Raw price rows to receive
idand optionallyname.logger (Callable[[str], None]) – Logging callback for metadata repair diagnostics.
duplicate_nav_threshold (float) – NAV threshold used by the duplicate-name diagnostic.
assign_names (bool) – Whether to materialise the human-readable name column. Set to
Falsewhen the caller will filter by denomination before mapping names across the large raw frame.
- Returns
The input frame with canonical identifiers and, by default, names.
- Return type
- assign_vault_names(rows, prices_df)
Map repaired vault names onto an already filtered price frame.
Name assignment is intentionally separate from
assign_unique_names()so denomination filtering can happen before the large row-wise mapping. The metadata repair loop still runs once per vault, while this operation is one vectorised lookup over the selected rows.Baseline (2026-09-22 production run): name and denormalised metadata were mapped before filtering 22,552,978 raw rows as part of the approximately 2m14s metadata/selection/sort segment. In the production-shaped rerun, the complete post-read metadata/filter stage (including this mapping, denomination membership and default-column expansion) took 12.54 seconds on 10,338,606 selected rows; the subsequent sort took 6.56 seconds. The name-only operation was not isolated, so no separate speed-up or stage RSS is claimed. The combined metadata/filter/sort segment, including the compact identity scan and Arrow read, was 24.58 seconds with 20.4 GiB peak process RSS.
- Parameters
rows (collections.abc.Mapping[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata keyed by
VaultSpec.prices_df (pandas.DataFrame) – Filtered rows containing the canonical
idcolumn.
- Returns
The input frame with a filled
namecolumn.- Return type
- add_denormalised_vault_data(rows, prices_df, logger=<built-in function print>)
Add denormalised data to the prices DataFrame.
Protocol names and event counts are mapped from the metadata database onto every selected observation. Unknown identifiers remain a hard error because silently exporting partially enriched rows would corrupt downstream reports.
- Parameters
rows (dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata keyed by vault specification.
prices_df (pandas.DataFrame) – Selected price rows containing the canonical
idcolumn.logger (Callable[[str], None]) – Diagnostic callback accepting one message.
- Returns
The input frame with
event_countandprotocolcolumns.- Return type
- filter_vaults_by_denomination_families(rows, prices_df, denomination_families, *, logger=<built-in function print>)
Reduce vault price rows to selected denomination families.
Classification is based only on the denomination symbol stored in vault metadata. This preserves the legacy stablecoin filter while allowing the isolated crypto bundle to select reviewed ETH/BTC wrappers.
- Parameters
rows (collections.abc.Mapping[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata rows keyed by vault specification.
prices_df (pandas.DataFrame) – Raw/enriched price rows containing the canonical
idcolumn.denomination_families (collections.abc.Iterable[eth_defi.vault.denomination.DenominationFamily]) – Families to retain.
- Returns
Input rows whose vault metadata belongs to a requested family.
- Return type
- filter_vaults_by_stablecoin(rows, prices_df, logger=<built-in function print>)
Reduce vaults to stablecoin vaults using the compatibility selection.
- Parameters
rows (collections.abc.Mapping[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata rows keyed by vault specification.
prices_df (pandas.DataFrame) – Raw/enriched price rows containing the canonical
idcolumn.
- Returns
Stablecoin-denominated price rows.
- Return type
- calculate_vault_returns(prices_df, logger=<built-in function print>)
Calculate returns for each vault.
Discard invalid share-price observations and add the compatibility
returns_1hcolumn. Consecutive zero prices after a complete loss carry a zero return: the loss was already recorded by the first transition to zero, and leaving later0 / 0changes as NaN makes the terminal curve unnecessarily difficult for downstream consumers to use.Example of input data:
chain address block_number timestamp share_price ... errors id name event_count protocol 207 42161 0x487cdc7d21ac8765eff6c0e681aea36ae1594471 13294721 2022-05-30 19:59:22 1.0 ... 42161-0x487cdc7d21ac8765eff6c0e681aea36ae1594471 LDAI 17 <unknown ERC-4626>
- Parameters
prices_df (pandas.DataFrame) – Price rows containing string
idand numericshare_pricecolumns, ordered by vault and timestamp.logger (Callable[[str], None]) – Notebook, console, or structured-log adapter accepting one message.
- Returns
Price rows with
returns_1hcalculated between consecutive rows.- Return type
Baseline (2026-09-22 production run): the implementation performed two grouped passes over the cleaned frame (shift and pct_change), but the source log did not isolate their elapsed time. The optimised one-shift implementation completed the complete return-calculation stage in 5.30 seconds for 10,129,623 rows; stage-only speed-up and RSS are therefore not available. The surrounding production-shaped cleaner run recorded 20.4 GiB peak process RSS.
Normalise share prices and mark unusable observations as missing.
Scanner failures may be persisted as IEEE
NaNvalues in a PyArrowdoublecolumn. Unlike Arrow nulls, these values are not consistently removed bypandas.Series.dropna()until they are converted to a NumPy-backed floating-point series. Negative share prices are invalid as well, whereas zero is a valid complete-loss value.- Parameters
share_price_observations (pandas.Series) – Sparse share prices indexed by naive UTC timestamps. Values are expected to be non-negative denomination-token amounts.
- Returns
Float64 series preserving the original index and order. Invalid, non-finite, and negative values are represented as
NaN.- Return type
- clean_returns(rows, prices_df, logger=<built-in function print>, outlier_threshold=0.5, display=<function <lambda>>, returns_col='returns_1h')
Clean returns data by removing rows with NaN or infinite values.
- In returns data we have outliers that are likely not real returns, or one-time events that cannot repeat.
Floating point errors: [Share price may jumps wildly when a vault TVL is near zero](https://x.com/0xSEM/status/1914748782102630455)
Bugs: Vault share price method to estimate returns does not work for a particular airdrop
Airdrops: Vault gets an irregular rewards that will not repeat, and thus are not good to estimate the future performance
We clean returns by doing an assumptions - Daily returns higher than static outlier - Daily TVL max does not make sense - Daily TVL min does not make sense - Daily TVL % below lifetime average TVL
- Parameters
rows (dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) –
prices_df (pandas.DataFrame) –
display (Callable) –
- Return type
- clean_by_tvl(rows, prices_df, logger=<built-in function print>, tvl_threshold_min=1000.0, tvl_threshold_max=99000000000, tvl_threshold_min_dynamic=0.02, returns_col='returns_1h')
TVL-based threshold filtering of returns.
Clean returns from TVL-manipulation outliers
See https://x.com/moo9000/status/1914746350216077544 for manipulation example
Hypercore keeps its PnL/NAV price-derived return because rewriting the return alone would make profit disagree with the cleaned share price. Its low-TVL observations still receive
tvl_filtering_mask=Trueso investment-suitability consumers can exclude them. Other protocols retain the existing zero-return behaviour.- Parameters
rows (dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Vault metadata keyed by address. Retained for compatibility with the existing cleaner interface.
prices_df (pandas.DataFrame) – Timestamp-indexed price rows containing
id,chain,total_assets, and the selected return column.logger – Notebook, console, or structured-log adapter accepting one message.
tvl_threshold_min (Union[float, collections.abc.Mapping[str, float], Callable[[str], float]]) – Absolute minimum NAV, vault-id mapping, or vault-id callback for a denomination-aware threshold. Legacy callers retain the USD scalar default.
tvl_threshold_max – Absolute maximum NAV in USD.
tvl_threshold_min_dynamic – Minimum NAV as a fraction of the vault’s all-time average NAV.
returns_col – Name of the return column to clean.
- Returns
The input frame with TVL audit columns and protocol-appropriate return cleaning applied.
- Return type
- filter_unneeded_row(prices_df, logger=<built-in function print>, epsilon=0.0025)
Dedpulicate data rows with epsilon.
Reduce data size by elimating rows where the value changes is too little
Remove rows where the total asset/share price/total supply change has been too small
Note
This filter conly yields 2% savings in row count, so it turned out not to be worth of the problems.
- Parameters
prices_df (pandas.DataFrame) – Assume sorted by timestsamp
epsilon – Tolerance for floating point comparison
- Return type
- remove_inactive_lead_time(prices_df, logger=<built-in function print>)
Remove initial inactive period from each vault’s price history.
At the beginning of a vault’s lifecycle, total supply may remain constant while the vault is inactive (e.g., 1, 1000, etc.)
When the vault activates, the share price may jump, causing abnormal returns
This function removes the initial rows where total_supply hasn’t changed
Uses exact equality for comparison
Skips initial rows with zero or NaN total_supply to find first valid value
Arcus pTokens are already trading when the first funded observation is recorded. Their NAV can move before another deposit changes share supply, so retain their history from the first positive supply observation.
- Parameters
prices_df (pandas.DataFrame) – Price data with ‘id’ and ‘total_supply’ columns. Assumes data is sorted chronologically within each vault. Timestamp labels may repeat because modern chains such as Monad can create multiple blocks per second. One-second accuracy is sufficient for price cleaning, so equal timestamp rows are retained and evaluated by their row positions instead of being deduplicated.
logger (Callable[[str], None]) – Progress callback accepting one message.
- Returns
DataFrame with inactive lead time removed for each vault
- Return type
Baseline (2026-09-22 production run): 10,338,606 stablecoin rows took 42 seconds in a DataFrame-returning
groupby().apply(). The positional mask implementation took 6.87 seconds for the same row count (6.1x), removing 203,103 rows. Stage-only RSS was not sampled; the complete production-shaped cleaner peaked at 20.4 GiB.
Build an approximate Hypercore economic-performance index from PnL and NAV.
Hyperliquid does not expose historical vault share supply or an investable unit price through its vaultDetails API. Its rolling NAV and PnL windows can refresh at different timestamps, so the scanner-derived ERC-4626-like supply can change units between daily and HF reads. The July 2026 production investigation found that this left raw multi-hundred-percent moves in cleaned data and that a partial daily/HF repair itself created Order Block Hunter’s
+275.4%clean return. Ledger flows prove NAV accounting for some intervals, but their intra-period ordering is unavailable and therefore cannot recover exact time-weighted investor returns.The cleaned Hypercore price is consequently a conservative performance index. One freshest usable checkpoint is selected per fixed four-hour UTC bucket while retaining its original API timestamp. Missing buckets are not manufactured, and older history remains daily or weekly where Hyperliquid has already downsampled it. Between checkpoints, cumulative account-PnL change is divided by the larger of opening NAV, closing NAV, and one dollar; the resulting returns are compounded from
1.0within each recapitalisation epoch. This denominator prevents unknown capital-flow timing and small NAV from manufacturing performance. Positive returns are capped atmax_positive_returnper selected checkpoint. A return at or below-100%is accepted only when NAV is zero and does not recover in the same epoch; otherwise the price is carried because applying one questionable negative PnL baseline would permanently zero the index. Non-checkpoint rows are also carried, avoiding duplicate daily/HF returns without interpolating future information backwards.A July 2026 follow-up found a narrower timestamp problem in Fish Market. Cumulative PnL increased by
$2,169.43on 17 March while NAV remained unchanged; the same$2,169.43appeared in NAV on 18 March with no additional PnL or capital flow. Treating the first half of this staggered API update as a complete checkpoint produced a clipped+100%return. When a checkpoint within 26 hours exhibits this exact PnL-then-NAV pattern, within a small numerical tolerance, this function carries the premature checkpoint and applies the return at the confirming checkpoint using the larger opening/confirmed NAV. Flat intermediate checkpoints may occur; any other economic change disqualifies the repair. This gives approximately+54.5%for Fish Market. The bounded, positive-only and value-matching conditions avoid suppressing large but reconciled gains in Magixbox, IKAGI and Satori Quantum HF Vault. Because confirmation arrives later, the most recent provisional checkpoint and prices compounded after it may be revised on the next cleaning run.Input uses a timestamp index and requires
id(string),chain(integer),share_price(float),total_assets(float), and cumulative PnL as either exportedaccount_pnl(float) or scanner-shapedcumulative_pnl(float). Optionalwritten_attimestamps select the freshest scanner batch,hypercore_sourcestrings break otherwise equal ties in favour of HF, and booleanepoch_resetvalues separate performance epochs. The output preserves scanner values inraw_share_price, writes audit values tohypercore_repair_status, and recalculates Hypercoretotal_supplyas synthetic index units so thattotal_assets == share_price * total_supplyremains true. Hypercoretotal_supplyis not an actual token supply.- Parameters
prices_df (pandas.DataFrame) – Timestamp-indexed cleaned-price input containing the columns described above. Rows must already be ordered by vault and timestamp.
logger (Callable[[str], None]) – Notebook, console, or structured-log adapter accepting one message.
max_positive_return (float) – Maximum approximate return applied at one four-hour checkpoint. The default is
1.0(100%).
- Returns
A copy with every Hypercore row expressed on its PnL/NAV performance index; all non-Hypercore rows are unchanged.
- Return type
- discard_hypercore_initial_low_tvl_history(prices_df, logger=<built-in function print>, min_tracking_assets=1000.0)
Discard an unfunded Hypercore vault’s leading price observations.
Hypercore has no authoritative historical share price. Its cleaned share price is instead a reconstructed PnL/NAV performance index, normally rebased to one at the first retained observation. A few dollars of bootstrap capital can therefore become the lifetime high-water mark for a vault that later manages meaningful capital, producing an irrelevant near-100% drawdown. Start the published performance history only once the vault reaches a meaningful initial capital base.
This is deliberately an initial-history rule. A funded vault that later falls below the threshold keeps its observations, because that decline is material investor performance information. A vault that has not yet reached the threshold has no cleaned price history; its raw observations remain available for audit and will be included automatically once a future cleaner run sees sufficient capital.
- Parameters
prices_df (pandas.DataFrame) – Vault price data indexed by timestamp, with
id,chain, andtotal_assetscolumns. It must be sorted by vault and timestamp.logger (Callable[[str], None]) – Notebook or console logging function.
min_tracking_assets (float) – Minimum USD NAV needed before publishing the initial Hypercore performance history.
- Returns
Price data without the unfunded initial Hypercore observations.
- Return type
- discard_hypercore_pre_recapitalisation_history(prices_df, logger=<built-in function print>, min_recapitalisation_assets=1000.0, min_recovery_delay=Timedelta('7 days 00:00:00'))
Start a recapitalised Hypercore vault at its new meaningful capital base.
A complete wipe-out followed by new deposits cannot be represented by one continuous share-price series. The old investors have a -100% return, while the new investors must not inherit the destroyed share supply. When a vault has meaningful NAV, reaches zero, and does not regain any positive NAV until after
min_recovery_delay, discard its earlier observations from the cleaned output. The raw parquet remains unchanged.Recovery duration and the new tracking threshold are intentionally separate. The delay is measured to the first value above
HYPERCORE_ZERO_NAV_EPSILON, even when that value is belowmin_recapitalisation_assets. This prevents a sequence such as$2,000 -> $0 -> $900 next day -> $1,000 after seven daysfrom erasing valid history merely because the recovery crossed the display threshold later. Once a durable recovery is established, the first retained observation must have at leastmin_recapitalisation_assetsin NAV and is markedepoch_reset.Raw scanner
epoch_resetvalues are cleared before applying this rule. They mark arbitrary resets of the reconstructed synthetic supply, including funded vaults, and are not evidence of an economic wipe-out. Only the duration/NAV-qualified marker produced here may split the cleaned performance index.The July 2026 production snapshot contained four qualifying episodes across 569 Hypercore vaults. HODL My Perps, HLP Liquidator, Rehobot LR, and Sifu all still qualify when measuring the delay to the first positive NAV, removing 369 rows from cleaned output. The stricter definition was chosen because the same snapshot contained hundreds of transient zero observations which must not reset lifetime performance.
- Parameters
prices_df (pandas.DataFrame) – Vault price data indexed by timestamp, with
id,chain, andtotal_assetscolumns. It must be sorted by vault and timestamp.logger – Notebook or console logging function.
min_recapitalisation_assets (float) – Minimum NAV in USD needed before tracking the new investment epoch.
min_recovery_delay (pandas.Timedelta) – Minimum elapsed time between zero NAV and the first later positive NAV.
- Returns
Price data without the superseded pre-recapitalisation epochs.
- Return type
Repair isolated share-price observations that disagree with their neighbours.
Scanner inputs can briefly jump because of oracle errors, bad transactions or other source anomalies and then return to the surrounding level. The cleaner replaces an observation only when both time-scaled neighbours corroborate one another. The original value remains available for audit in
raw_share_price. See thecheck-share-pricescript for individual investigations.Arcus pTokens retain their observed NAV because leveraged market moves can satisfy the generic anomaly heuristic without being scanner errors.
Case Fluegel DAO:
timestamp
chain
address
block_number
share_price
total_assets
total_supply
2024-07-16 15:02:57
8453
0x277a3c57f3236a7d458576074d7c3d7046eb26c
17176415
1.60
373,740.21
232,929.92
2024-07-16 16:02:57
8453
0x277a3c57f3236a7d458576074d7c3d7046eb26c
17178215
1.63
379,832.59
232,929.92
2024-07-16 17:02:57
8453
0x277a3c57f3236a7d458576074d7c3d7046eb26c
17180015
0.33
75,744.97
232,929.92
2024-07-16 18:02:57
8453
0x277a3c57f3236a7d458576074d7c3d7046eb26c
17181815
1.64
382,282.78
232,929.92
- Parameters
prices_df (pandas.DataFrame) – Price rows sorted by vault identifier and timestamp. The frame must contain
idand numericshare_pricecolumns and use a datetime index for time-based window scaling.logger (Callable[[str], None]) – Progress callback accepting one message.
max_diff (float) – Symmetric relative-change threshold used to identify an outlier.
look_back_hours (int) – Nominal look-back window in hours.
look_ahead_hours (int) – Nominal look-ahead window in hours.
- Returns
A frame with repaired
share_pricevalues and the original values retained inraw_share_price.- Return type
- sort_and_index_vault_prices(prices_df, priority_ids)
Sort observations into the stable order expected by cleaning stages.
Priority vaults are placed first for interactive diagnostics; all rows are then ordered by identifier and timestamp. Pandas’ multi-key lexicographical sorter retains the input order of identical keys, including duplicate timestamps; later positional kernels treat that order as authoritative. The single-key
kindoption is deliberately not cited as the guarantee because Pandas ignores it for multi-key sorts.- Parameters
prices_df (pandas.DataFrame) – Price rows with a datetime index and canonical
idcolumn.priority_ids (list[str]) – Vault identifiers that should be processed before the remaining rows.
- Returns
Sorted rows with
timestamprestored as the index.- Return type
- process_raw_vault_scan_data(rows, prices_df, logger=<built-in function print>, display=<function <lambda>>, diagnose_vault_id=None, *, denomination_families=None, crypto_min_tvl_usd=None)
Preprocess vault data for further analysis.
Assign unique names to vaults
Add denormalised vault data to prices DataFrame
Filter out non-stablecoin vaults
Calculate returns, rolling metrics
- Parameters
rows (Union[dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow], eth_defi.vault.vaultdb.VaultDatabase]) – Metadata rows from the vault database, or a loaded database instance.
prices_df (pandas.DataFrame) – Raw price observations containing at least chain, address, timestamp, share-price, total-assets and total-supply columns.
logger (Callable[[str], None]) – Notebook, console or structured-log callback accepting one message.
display (Callable[[pandas.DataFrame], None]) – Optional DataFrame display callback used for one-vault diagnostics.
diagnose_vault_id (Optional[str]) – Optional canonical vault identifier to show between cleaning stages.
denomination_families (Optional[collections.abc.Iterable[eth_defi.vault.denomination.DenominationFamily]]) – Denomination families to retain; defaults to stablecoins.
crypto_min_tvl_usd (Optional[decimal.Decimal]) – Optional USD TVL threshold converted into ETH/BTC denomination units.
- Returns
Cleaned, denormalised price observations ordered by vault and time.
- Return type
Baseline (2026-09-22 production run): stablecoin cleaning processed 22,552,978 raw rows and took about 11 minutes 25 seconds. The first optimisation pass filters before wide enrichment, reuses integer group codes and replaces the inactive-lead and outlier callbacks with positional array masks. The production-shaped rerun processed 22,552,978 raw rows, selected 10,338,606 stablecoin rows and produced 10,116,623 cleaned rows in 146.02 seconds, versus 11m25s in the source log (4.7x). Peak process RSS was 20.4 GiB versus no RSS measurement in the original log. The stage breakdown is emitted by this function’s timer logs; the exact input was the 333,430,642-byte, 38-column Parquet copy from 2026-09-22.
- materialise_daily_crypto_prices(prices_df)
Select valid daily closing observations and each vault’s first price.
The first valid observation is retained alongside the first day’s final valid observation so lifetime returns and young-vault charts include that day’s movement. Later days retain one valid closing observation. Missing timestamps, negative prices and non-finite prices are excluded from this derivative; the original hourly observations remain intact. Same-timestamp prices use the final block instead of creating an ambiguous duplicate. The exported parquet preserves real timestamps; the crypto bundle regularises these to calendar days when it calculates metrics: stablecoin vaults with
eth_defi.research.vault_metrics.calculate_sparse_daily_returns_for_all_vaults(), and ETH/BTC vaults one vault at a time ineth_defi.vault.crypto_vaults.- Parameters
prices_df (pandas.DataFrame) – Cleaned selected-family price rows with naive UTC timestamp/index, string
idand numeric or nullableshare_pricecolumns.- Returns
Chronologically sorted, observation-preserving daily price rows using the existing cleaned-price schema.
- Return type
- write_daily_crypto_prices_sidecar(prices_df, destination_path, logger=<built-in function print>)
Write an atomic daily sidecar from an already-cleaned price frame.
The scheduled scanner otherwise writes the hourly stablecoin Parquet and immediately reads all of its rows again when building the private crypto bundle. Materialising this small observation-preserving sidecar while the cleaned frame is already resident removes that second wide read. The derivative is written to a temporary sibling and verified before replace, so an interrupted scan cannot replace a valid previous sidecar with a partial file. A metadata version prevents readers from reusing a sidecar produced under the previous daily observation policy.
- Parameters
prices_df (pandas.DataFrame) – Settlement-annotated cleaned hourly rows with a timestamp index.
destination_path (pathlib.Path) – Atomic daily Parquet destination.
- Returns
Number of daily rows written.
- Return type
Baseline (2026-09-22 production run): crypto construction reread 10,116,623 hourly stablecoin rows before daily materialisation. In the 2026-09-22 production-shaped run, the sidecar contained 1,945,631 rows and its atomic write took 5.91 seconds. The old path reread and materialised 10,116,623 hourly rows; that wide reread was not isolated in the source log, so no standalone speed-up or sidecar RSS is claimed. The complete cleaner’s peak process RSS was 20.4 GiB.
- check_missing_metadata(rows, price_ids, prices_df, logger=<built-in function print>)
Check that we have metadata for all vaults in the prices DataFrame.
Vault id is in format:
56-0x10c90bfcfb3d2a7ae814da1548ae3a7fc31c35a0If there are vaults with price data but no metadata, they are logged at error level and their IDs returned so the caller can drop them.
- Parameters
rows (collections.abc.Mapping[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Metadata rows keyed by vault specification.
price_ids (pandas.Series) – Canonical identifier series corresponding to
prices_df.prices_df (pandas.DataFrame) – The full prices DataFrame, used to extract context for missing vaults.
logger (Callable[[str], None]) – Diagnostic callback accepting one message.
- Returns
Set of vault IDs that are missing from the metadata. These should be dropped from the price data before further processing.
- Return type
The previous implementation rescanned the full price frame once per missing identifier to build an error message. Build one grouped context table for the missing subset instead; normal runs with no missing IDs take the same cheap path.
- generate_cleaned_vault_datasets(vault_db_path=PosixPath('/home/runner/.tradingstrategy/vaults/vault-metadata-db.pickle'), price_df_path=PosixPath('/home/runner/.tradingstrategy/vaults/vault-prices-1h.parquet'), cleaned_price_df_path=PosixPath('/home/runner/.tradingstrategy/vaults/cleaned-vault-prices-1h.parquet'), settlement_db_path=None, logger=<built-in function print>, warning_logger=None, display=<function display>, diagnose_vault_id=None, vault_db=None, *, denomination_families=None, daily_materialisation=False, daily_price_df_path=None, crypto_min_tvl_usd=None, raw_vault_specs=None)
Clean raw scanned vault prices and atomically write an analysis dataset.
Reads
vault-prices-1h.parquetand generates a cleaned Parquet datasetCalculates returns and related fields included with price data
Cleans abnormal returns
Stamp the cleaned Parquet with the current Docker
metadata.versionprovenance, matching vault scanner JSON exports
Note
Defaults to stablecoin-only selection for compatibility. The isolated crypto bundle passes explicitly reviewed stablecoin, ETH and BTC families.
- Parameters
vault_db_path (pathlib.Path) – Vault metadata pickle path.
price_df_path (pathlib.Path) – Raw scanner Parquet source.
cleaned_price_df_path (pathlib.Path) – Atomic cleaned Parquet destination.
settlement_db_path (Optional[pathlib.Path]) – Optional settlement database used to annotate cleaned observations.
logger (Callable[[str], None]) – Progress callback accepting one message.
warning_logger (Optional[Callable[[str], None]]) – Optional warning callback for recoverable sidecar failures. Defaults to
loggerfor notebook callers without structured log levels.display (Callable[[pandas.DataFrame], None]) – Optional DataFrame display callback for diagnostics.
diagnose_vault_id (Optional[str]) – Optional canonical vault identifier to show between cleaning stages.
vault_db (Optional[eth_defi.vault.vaultdb.VaultDatabase]) – Optional preloaded vault metadata database. Supplying it avoids a second pickle read when callers derive
raw_vault_specsfrom the same metadata.denomination_families (Optional[collections.abc.Iterable[eth_defi.vault.denomination.DenominationFamily]]) – Denomination families to retain; defaults to stablecoins.
daily_materialisation (bool) – Whether the primary output itself should contain one row per UTC day.
daily_price_df_path (Optional[pathlib.Path]) – Optional atomic daily sidecar destination. When supplied, the sidecar is materialised from the settlement-annotated hourly frame before the frame is released, allowing the crypto bundle to avoid rereading the full stablecoin Parquet.
crypto_min_tvl_usd (Optional[decimal.Decimal]) – Optional USD TVL threshold for crypto-denominated vaults.
raw_vault_specs (Optional[collections.abc.Collection[eth_defi.vault.base.VaultSpec]]) – Optional source vault identities to push down to the Parquet reader. Raw Parquet stores these as
chainandaddressrather than the derivedidcolumn. The crypto-only cleaner uses this to avoid materialising unrelated raw histories before denomination selection. A targeted clean may produce a typed zero-row output. When omitted, a zero-row result is rejected to protect the last valid public output.
- Returns
None. The verified output is atomically installed atcleaned_price_df_path.- Return type
None
Baseline (2026-09-22 production log): the default stablecoin cleaner processed 22,552,978 raw rows to 10,116,623 cleaned rows in about 11m25s. The production-shaped rerun processed the same row counts in 146.02s (4.7x), with 20.4 GiB peak process RSS. The measured input fingerprint was the 333,430,642-byte, 38-column raw Parquet copy from 2026-09-22; output had 49 columns and 10,116,623 rows. This timer covers metadata filtering, all Python transforms, settlement annotation, Arrow conversion, write, verification and the optional sidecar when requested.
- replace_cleaned_vault_histories(vault_ids, *, vault_db_path=PosixPath('/home/runner/.tradingstrategy/vaults/vault-metadata-db.pickle'), raw_price_df_path=PosixPath('/home/runner/.tradingstrategy/vaults/vault-prices-1h.parquet'), cleaned_price_df_path=PosixPath('/home/runner/.tradingstrategy/vaults/cleaned-vault-prices-1h.parquet'), settlement_db_path=None, logger=<built-in function print>, require_all_cleaned=True)
Rebuild and atomically replace cleaned histories for selected vaults.
The normal cleaner is deliberately whole-dataset: it reads every raw row, applies its transformations, and emits a new Parquet file. A historical repair only changes a small number of vaults, however, and each cleaner transformation is independent between vault ids. Recompute the complete raw history for the selected ids, then stream-copy all other cleaned row groups into a replacement Parquet. This avoids expensive pandas cleaning for unrelated vaults while preserving their existing cleaned rows and physical
id, timestamporder.The destination remains a single Parquet file, so its bytes must still be rewritten before the atomic replace. The function does not silently drop columns: a selected vault whose cleaned columns do not match the existing output raises an error before replacing the original file.
- Parameters
vault_ids (set[str]) – Canonical lower-case
chain_id-addressids to replace.vault_db_path (pathlib.Path) – Metadata database used for denormalisation and stablecoin filtering.
raw_price_df_path (pathlib.Path) – Raw scanner Parquet containing the replacement histories.
cleaned_price_df_path (pathlib.Path) – Existing cleaned Parquet to update atomically.
settlement_db_path (Optional[pathlib.Path]) – Optional settlement database applied to the selected cleaned rows.
require_all_cleaned (bool) – Keep the default safety check that rejects a replacement when cleaning removes any selected id. Set to
Falseonly for an exhaustive discovery migration where valid but inactive vaults are expected to have no cleanable history. In that mode an existing selected cleaned history is deliberately replaced by no rows when its raw history is no longer suitable for publication.
- Returns
Number of cleaned rows written for the selected vaults.
- Return type
- forward_fill_vault(vault_df)
Forward fill missing vault prices up to max_gap_hours.
For displaying, calculating metrics, etc. we want continuous time series
Align random sample interval to 1h
- Parameters
vault_df (pandas.DataFrame) –
Price data for a single vault.
Assume 1h price data.
- Return type