# File Objective : CLI to refresh keyword signals and print the ranked momentum table. # Scope : Dev script — verify signals.json is written and cache-aside works. # What it does : Calls fetch_signals() then prints all keywords sorted by momentum. # What it does not: Compute coverage or GapScore — that is the gap module's job. from __future__ import annotations import sys from vantage_core.adapters.signals_pytrends import fetch_signals def main() -> None: records = fetch_signals() if not records: print("No signals returned — check internet or pytrends rate limit.") sys.exit(1) print(f"\n── Signals ({len(records)} keywords) ────────────────────────────────────") for rec in sorted(records, key=lambda r: r.momentum_percentile, reverse=True): print(f" {rec.momentum_percentile:.4f} {rec.z_score:+.3f} {rec.keyword}") print() if __name__ == "__main__": main()