Project · Serverless · LLM
MarketPulse
A serverless app that reads a stock's chart for you. It computes trend, momentum and risk indicators from two years of prices, pulls recent headlines, and has Claude explain what the numbers mean together, with no invented figures and no advice.
01The problem
Most trading dashboards show numbers and leave the interpretation to you. MarketPulse explains what a stock is doing (trend, momentum, volatility, key levels) in a few sentences, next to the figures, the chart and the headlines it was written from.
02Architecture
- Static frontendHosted on GitHub Pages. Ticker dropdown with search, a watchlist kept in the browser, and shareable links.
- API GatewayRoutes
/api/quote,/api/briefand/api/newsto Lambda. Rate limited, and CORS only answers the site. - LambdaOne Python function fetches prices and feeds, computes the indicators, and calls Claude for the brief.
- S3 cacheQuotes and news are kept for 30 minutes and briefs for 6 hours, so repeat lookups skip the fetch and the model call.
- EventBridge scheduleInvokes the function every 30 minutes to refresh the market headlines.
All infrastructure is defined in one AWS SAM template: the private, encrypted cache bucket, a least-privilege IAM role, the schedule, and a budget alarm wired to a kill switch. The repository's README has the full diagram.
03How it works
- Indicators in plain Python. Returns from a week to a year, 20/50/200-day moving averages and trend slope, RSI-14, ATR-14, 30-day realized volatility, year-to-date max drawdown, the 52-week range, volume against its 20-day average, and beta and relative strength against SPY. Dropping pandas and NumPy cut the package size and brought an uncached quote from about 10 seconds to under one.
- Grounded briefs from Claude. The computed facts and up to six headlines go to Claude Sonnet with a JSON schema for the output (title, one-line summary, narrative, positives, risks, levels to watch, news context). The prompt allows only the numbers provided and rules out advice and price targets. Headlines are passed as untrusted text, so instructions hidden in a feed are ignored.
- News that refreshes itself. Ticker headlines come from Yahoo Finance's feed and market headlines from CNBC, MarketWatch and Yahoo Finance. Only the headline, source and link are kept, and each link goes to the publisher.
- Graceful degradation. The chart and numbers load first and the brief follows. If the model is unavailable or the daily allowance is used up, the page says so and everything else still works.
- Interactive frontend. Candlesticks with volume, switchable moving averages, an RSI panel, a comparison against the S&P 500, and a key-numbers table that explains each metric in a line.
04Security and cost controls
- No key in the code or config. The Claude API key is a SecureString in SSM Parameter Store, read at run time. The function's role can read that one parameter, its own cache bucket and its logs, and nothing else.
- A locked-down page. A Content Security Policy with no inline or third-party scripts, feed text rendered as plain text, and only
httpslinks accepted. Ticker input is validated before anything is fetched. - A budget that enforces itself. If the month's AWS bill reaches $1, AWS Budgets notifies an SNS topic and a small Lambda sets the API's concurrency to zero. Model spend is bounded separately by a daily cap on briefs, caching and a token ceiling per brief.
05Screenshots


