// Hourly quote ingest โ€” CLI entry for the systemd timer (and manual runs). // // bun run quote_ingest.ts AAPL MSFT CAT # ingest a specific list // bun run quote_ingest.ts # refresh every tracked ticker // // Writes multi-source consensus snapshots into the local SQLite cache // (data/_quote_cache/quotes.db). See quotes.ts for the aggregation logic. import { ingestQuotes, trackedTickers } from "./quotes.ts"; const args = process.argv.slice(2).map((s) => s.toUpperCase()); const t0 = Date.now(); const tracked = trackedTickers(); const target = args.length ? args : tracked; if (!target.length) { console.log( "[quote_ingest] nothing to ingest โ€” cache is empty and no tickers passed.\n" + " Seed it by passing symbols (e.g. `bun run quote_ingest.ts AAPL CAT HD`),\n" + " or just hit the profiler once so the serving path warms the cache.", ); process.exit(0); } console.log( `[quote_ingest] ${args.length ? "explicit list" : "refreshing tracked universe"}: ${target.length} tickers`, ); const r = await ingestQuotes(target); console.log( `[quote_ingest] done in ${Date.now() - t0}ms โ€” ${r.written}/${r.requested} written` + (r.failed.length ? ` ยท no source answered for: ${r.failed.join(", ")}` : ""), );