Markets — Live Intraday

New York
Hong Kong
Tokens today
Tokens all-time
Claude $ today
Claude $ all-time
$ remaining

Recent ±2% S&P 500 intraday swings · explained

What this dashboard does

Tracks three indices live (S&P 500, Nasdaq Composite, Hang Seng) and runs a small fleet of Claude agents that explain market moves and email you summaries. All data flows through one Flask backend on US Lightsail; news comes from Benzinga (via Massive), Polygon, the Federal Reserve press feed, SEC EDGAR 8-K filings, and Yahoo per-symbol headlines.

Sub-agents and processes

Function Model(s) When it runs What it does
Swing-explainer (3-stage cascade) Sonnet 4.6 × 3 On every ±2% S&P 500 intraday breach during US session (Nasdaq + HSI are watched by the live charts but not currently fed to the agent — toggle via SWING_MARKETS env var) Investigator picks candidate causes from news. Verifier checks citations. Synthesizer writes a 2–3 sentence plain-English explanation. Dashboard chart marks each breach + the panel below shows the prose.
Pre-market summary Opus 4.7 9:00 AM ET, trading days only Headline + 2 paragraphs + 5–7 bullets covering overnight news (midnight → 9 AM ET).
Mid-day summary Opus 4.7 12:00 PM ET, trading days only Same shape, covers 9 AM → noon ET.
Market-close summary Opus 4.7 4:00 PM ET, trading days only Same shape, covers noon → 4 PM ET.
Full-day recap Opus 4.7 (hierarchical) 12:00 AM ET, every day Folds in the 3 prior daily summaries plus 4 PM → midnight news, plus a futures-snapshot block predicting the next session's open.
Daily stocks watchlist Opus 4.7 12:05 AM ET, every day 43-ticker watchlist (across 9 buckets). Per-ticker daily move + after-hours move + company-specific news + relevant macro/peer/geo context.
Weekly stocks recap Opus 4.7 Mon 12:10 AM ET only Same 43 tickers but framed as a 7-day recap with weekly % move per ticker, weekly themes, and a "Setting up Monday's open" block citing live futures vs spot deltas.

Estimated annual Claude cost

Function Per run Frequency Annual
Swing-explainer (3 × Sonnet 4.6) $0.135 ~252/yr $34
Pre-market summary $0.83 252/yr (trading days) $209
Mid-day summary $1.29 252/yr $325
Market-close summary $1.29 252/yr $325
Full-day recap $0.49 365/yr $179
Daily stocks watchlist $0.65 365/yr $237
Weekly stocks recap $0.70 52/yr (Mondays) $36
Claude API total ~$1,345 / yr

Plus Massive Stocks Basic + Benzinga News add-on at $99/mo ($1,188/yr) and the US Lightsail box at $5/mo ($60/yr). All-in project cost: ~$2,590/yr. Hard-cap kill-switch via CLAUDE_BUDGET_USD on the server (default $250) blocks further paid calls once that ceiling is hit.

Data sources and routing

  • News — Benzinga real-time wire (api.massive.com/benzinga/v2/news), Polygon news endpoint, Fed monetary-policy RSS, SEC EDGAR 8-K Atom feed, and Yahoo per-symbol headlines for ^GSPC / ^IXIC / ^HSI. Items are tagged with tickers + market ids + topic channels and persisted to SQLite so the weekly window survives service restarts.
  • Live index prices — Singapore-hosted Yahoo proxy (13.229.43.38/yahoo), 1-second polling per symbol. The detector watches the % change vs. previous close.
  • Futures — Direct Yahoo (query2.finance.yahoo.com) for ES=F + NQ=F. HSI has no public futures feed so we surface the spot close.
  • Per-stock prices for watchlist — Direct Yahoo, 41 parallel HTTPS calls (max 10 concurrent), runs once per day at midnight ET.
  • Email — Gmail SMTP via hkgcteetimebooker@gmail.com, async fire-and-forget, sends to bh2858@columbia.edu.

Reliability + safety rails

  • Trading-day gate — pre-market / mid-day / market-close summaries skip on weekends + 30 hard-coded NYSE/Nasdaq holidays through 2028.
  • Idempotency — every summary row has UNIQUE(slot, date_et); auto-fires never duplicate even if the scheduler wakes twice in its 5-minute fire window.
  • Manual override — every slot has a "Run now" button on its tab; bypasses the trading-day and weekday gates so you can fire any slot any time.
  • Graceful degradation — agent disabled when ANTHROPIC_API_KEY isn't set; news adapters return cached payloads on upstream failure; chart annotations clipped to data range to prevent x-axis blow-out.
  • Cost tracking — every Claude call writes input+output+cache tokens and $ to the same DB; the four header boxes (Tokens today / Tokens all-time / Claude $ today / Claude $ all-time) read from a unified aggregator across all slot types.