Expected: 225028 bytes, 4739 lines (includes the /api/lists endpoint for named watchlists, the /api/movers endpoint for S&P 500 movers, the /api/groups/* endpoints for shared groups, threads and calls, fundamentals currency conversion — Finnhub home-currency values converted to the listing currency — the /api/congress endpoint for congressional trades via Alpha Vantage, the Yahoo chart freshness guard so TSX quotes never read yesterday's close as today's price, the /api/metrics endpoint for the fundamental filter screen — lean batched Finnhub metric fetch, 24h per-symbol cache, second-key budget — the /api/symbols endpoint for the full US stock list (Cmd+K search — Finnhub /stock/symbol?exchange=US, Common Stock only, 7-day edge cache), gold and silver futures in /api/market, and the blueprint build-all: the /api/regime endpoint (market regime gate — VIX term structure, RSP/SPY breadth, HYG/IEF credit, 1h cache), the /api/edgar endpoint (SEC EDGAR XBRL company facts — no key, 24h cache), the /api/intraday endpoint (Yahoo 5m bars, with range/interval params for the Price Action intraday scan and the chart 5m/15m/1h switcher), the past field on /api/earnings (last 8 true report dates for the earnings-move table), insider recent widened to 40 rows for cluster detection, and the stop_loss column on group_calls with server-side validation for R-multiples — plus the EDGAR year fix: fiscal years derived from each row's end date (not fy), revenue fallback to the contract-revenue concept, shares fallback to the Entity concept — plus current/quick ratio in /api/metrics (fetchMetricRow) for the expanded screeners — plus the evening cron warming for the expanded screeners: the universe_tech and universe_events Neon tables with the /api/tech-universe and /api/events-universe snapshot endpoints (latest-date rows), the /api/warm?stage=tech|events manual ticks, and the evening dispatcher (tech first, then events, never both in one tick) driven by the */5 22-23,0-9 * * 2-7 trigger — plus the warming batch fix: tech 10/tick and events 6/tick, because the 20/11 batches exceeded Cloudflare's 50-subrequest cap in production (a cold Yahoo fetch costs ~3 subrequests, a Neon query ~2) — and the 9/tick events batch failed too, its real cost running ~8 above the model — plus paste #7 (metrics full fields + daily history): fetchMetricRow keeps 13 extra metric fields (52-week high/low, EPS TTM, revenue/book value per share, price-to-sales/book, EV/EBITDA, FCF per share, dividend per share, ROA, payout ratio, EPS growth), universe_metrics is keyed by (symbol, snapshot_date) with a once-a-day housekeeping tick that migrates the old symbol-only PK and prunes rows older than 730 days, /api/metrics-universe serves the latest date's rows, the new /api/metric-history?symbol=X endpoint returns a symbol's stored daily rows, and events rows now also store the full monthly recommendation series + insider buy/sell totals — plus paste #8 (Ask chatbot): the /api/chat endpoint (POST, Clerk JWT required, signed-in only) — Gemini gemini-3.5-flash-lite (Quick) / gemini-3.6-flash (Deep), round-robin across the 5 GEMINI_API_KEY secrets with failover on 429/5xx, structured JSON answers, and a per-user limit of 5 successful queries/day (midnight PT, Neon chat_usage table — failed calls never consume one) — plus paste #9 (Ask ticker resolution): the Worker resolves the ticker/company a question names before calling Gemini — symbol tokens, then company-name match against the same Finnhub US list /api/symbols serves, then a small alias map (google→GOOGL, facebook→META) — rebuilds the context server-side for the resolved ticker (Finnhub quote + metrics, tech/events from the snapshot tables, regime from the screen; Yahoo bars for .TO prices), names the context ticker explicitly in the system prompt, requires the model's JSON to echo a symbol field and checks it (one retry on mismatch, then clean 502 symbol_mismatch consuming nothing), and returns the resolved symbol + reanchored + snapshot so the SPA re-anchors the deck to it — plus paste #10 (Time Machine): /api/intraday accepts the 60d range (Yahoo's longest 5-minute range, regular-session bars only, 5-minute edge cache), so the SPA can fetch the 60-day 5m pool the Time Machine replays from — no other endpoint changes — plus paste #11 (Ask redesign + 9 Gemini keys + no daily limit + Tavily web search): the Ask tab is gone — a small floating chatbot button (bottom-right, above the tab bar) on every screen opens the deck in an overlay (bottom sheet on phones, right-side panel on desktop), with the same sign-in gate inside for signed-out users; /api/chat now grounds answers with one Tavily web search (POST https://api.tavily.com/search, search_depth: basic, max_results: 5, snippets only — result pages are never fetched) when the question needs fresh/external info (re-anchored ticker, news/recent-events wording, or a general market question with no ticker context), injects the top results into the Gemini prompt, and returns sources (title + URL, shown as tappable links on deck page 1) plus webSearch / webSearchUnavailable flags — a missing TAVILY_API_KEY secret or a failed search never fails the question; the system prompt now allows any stocks/financial-markets question; Gemini rotation now covers all 9 keys (GEMINI_API_KEY + GEMINI_API_KEY2..9, round-robin from a random index, up to 9 attempts); and the per-user 5/day limit is removed entirely (no chat_usage writes or reads, no daily_limit 429, no remaining field, no counter in the UI) — the only caps left are Gemini's own free-tier quotas.
Loading worker.js…
If the button does not work, select all text below and copy it manually, or open worker.js directly.