refresh_metrics_state
Documentation for eth_defi.research.metrics_freshness.refresh_metrics_state function.
- refresh_metrics_state(state, seen_ids, computed_ids, current_tvl_by_id, peak_tvl_by_id, family_by_id, now)
Refresh the freshness state after one metrics run.
metrics_updated_atadvances only for vault ids actually returned in the metrics frame: a vault that failed metric calculation stays due next run instead of being stamped fresh for three days. The cheap TVL observations are refreshed for every vault seen in the price data, and vaults no longer present in the price data are dropped.- Parameters
state (dict) – Mutable loaded state mapping.
seen_ids (set[str]) – Vault ids present in the current price data.
computed_ids (set[str]) – Vault ids actually returned by the metrics calculation.
current_tvl_by_id (dict[str, float | None]) – Current TVL per vault.
peak_tvl_by_id (dict[str, float | None]) – Peak TVL per vault.
family_by_id (dict[str, str]) –
DenominationFamilyvalue per vault.now (datetime.datetime) – Current naive UTC datetime.
- Returns
The mutated state mapping.
- Return type