fix: validate scraper metric semantics

This commit is contained in:
Hermes Agent
2026-07-26 23:15:37 +00:00
parent b06cabf3aa
commit 6655bcfa5a
4 changed files with 67 additions and 12 deletions
+9 -2
View File
@@ -114,8 +114,15 @@ def collect_onchain_history(progress_cb=None):
for metric_key, trace_name in cfg["traces"].items():
if trace_name is None:
# Grab first trace with numeric data
for candidate in traces:
if metric_key == "lth_supply":
from scrapers.lookintobitcoin import _find_lth_supply_trace
candidates = [_find_lth_supply_trace(traces)]
else:
candidates = traces
# Grab the first validated trace with numeric data.
for candidate in candidates:
if not candidate:
continue
y = candidate.get("y", [])
if y and any(v is not None for v in y[-10:]):
dates, values = _extract_series(candidate)