load_metrics_state

Documentation for eth_defi.research.metrics_freshness.load_metrics_state function.

load_metrics_state(path, now)

Load freshness state, self-healing from a corrupt file.

A corrupt state file (malformed JSON, wrong schema version, wrong structure) is moved aside with a .corrupt-<timestamp> suffix and an empty state is returned: one full recompute follows and the gate applies from the next run.

A valid state from an older calculation version also triggers a full recomputation, without quarantining the state or changing price history.

Parameters
Returns

Loaded state mapping.

Return type

dict