Inspiration
Retail investors drown in headlines. A 20-year-old saving for the long run and a 59-year-old five years from retirement read the same feed, react to the same noise, and often make the same impulsive moves. Existing apps either personalize what you see without saying why, or use AI summaries that sound confident but can't be checked. We wanted the opposite: show less, explain more, and make every explanation verifiable — while never telling anyone what to buy or sell.
What it does
AlphaForge is a simulation tool (no real transactions, no personalized advice) built around three investor profiles from the challenge — Amira (high risk, 15+ years), Mateo (moderate, ESG-minded) and Robert (low-to-moderate risk, near retirement) — or your own answers to a short questionnaire.
- Profile in plain language. Your answers are turned into a profile (horizon, risk tolerance, acceptable loss, limits per position and for volatile assets) by written rules, not by the model. An optional free-text note ("I'd rather avoid oil") is read by an agent that only proposes preferences, each backed by a quote from your note; you confirm what applies.
- Your portfolio, clearly. Upload a
ticker,amountCSV (or use a sample). We show asset-class weights, top-3 concentration, the share of very volatile assets against your profile's limit, and a data-quality check for every price series. - A news feed sorted for you. In one month, 2,024 unique headlines from 335 publishers across our 31 tracked assets. Each headline is classified (earnings, dividend, regulation, controversy, rumor…), then scored by rules against your horizon, your position weights and your preferences. Duplicates are grouped, noise is set aside — and every hidden headline is counted with its reason. Each card has a "Why?" panel: rules triggered, position weight, sourced claims, guardian status, and historical context ("in comparable situations…", never a forecast).
- "I'm considering buying X." Type any listed stock, ETF or crypto and a target weight. A tool-using agent gathers evidence (5-year risk metrics, 2022 calendar-year return, diversification impact, instrument risks, past earnings reactions); the verdict — coherent, in tension or incoherent — always comes from the rules. Example: Robert adding 20 % NVDA is incoherent, because it exceeds his 10 % per-position limit, NVDA's historical max drawdown (−66 %) far exceeds the loss he says he can accept, and his very-volatile share would double his limit.
- Calendar of upcoming earnings, ex-dividend dates and central-bank decisions for your holdings.
How we built it
Principle: the model never computes and never decides. Code computes every number and applies every rule; the LLM classifies headlines and writes short explanations from evidence — nothing else.
- Data. Five years of daily prices and dividends (Yahoo Finance via
yfinance), USD/CAD and Canadian rates from the Bank of Canada Valet API, U.S. rates/CPI from FRED. Everything converted to CAD, with documented gap-filling. Every series passes a quality gate (missing days, frozen prices, outlier jumps, odd splits) before any calculation. News and 1,144 events (earnings, ex-dividend dates, rate decisions) are frozen as snapshots for reproducibility. - Rules as data. Questionnaire, profile rules, news taxonomy, relevance rules, coherence rules and source-reliability tiers live in YAML files written by our finance member and validated against JSON Schemas — so the financial logic can change without touching code.
- Explainability mechanism. Every computed fact, rule hit or past event becomes an
Evidenceobject (id, value, inputs, source, function that produced it). The model writes claims with markers like{{ev_042}}and labels each one fact, hypothesis or scenario; code substitutes the real values. A guardian then checks each claim twice: deterministically (cited evidence exists, rendered values match, no advice wording, no unsourced number) and with a model check that the text is supported by its evidence. Unsupported claims are removed or flagged ⚠. If the model is unavailable, the app falls back to rules and raw evidence — never an invented explanation. - Agents. Headline classifier (offline batch, structured output, prompt-injection-resistant), explanation writer, guardian, preference extractor, and a tool-using orchestrator (Bedrock Converse API) for purchase tests, with a governance agent and a diversification analyst. Every tool call is logged and shown as a timeline in the UI.
- AWS. Amazon Bedrock (Claude) for classification, explanations and the guardian; AWS Lambda + API Gateway (HTTP API) for the backend; S3 for data, snapshots and the website; CloudFront for HTTPS delivery; CloudWatch for logs (no portfolio data logged) and a demo dashboard; all deployed with AWS SAM.
- Front end. React + TypeScript + Vite, Recharts, Vitest; all user-facing text centralized in French; no cookies or local storage — your portfolio is used during the request and never kept.
- Quality. 280+ automated backend tests (including golden tests on reference metrics), contract tests between front and back, and an evaluation of the classifier against hand-labeled headlines.
Challenges we ran into
- Staying under the 29-second API limit. A purchase test first took ~28 s and timed out. Profiling showed two culprits: news explanations the screen didn't even display, and a final agent turn whose text was discarded. Batching tool calls in one turn and skipping unused work brought it to ~10–12 s.
- Making the guardian useful, not decorative. It caught real model mistakes — e.g. reading "new source of risk" as less diversification, or citing the wrong limit. Our fix was to move those sentences back to code, verbatim from the evidence.
- Polarity in free text. "I want to invest in oil" was first understood as "exclude fossil fuels". We added a deterministic check: an exclusion requires an explicit avoidance cue in the same clause.
- Messy financial data. Mixed currencies, crypto trading 7 days a week vs. stock-exchange calendars, monthly macro series dated by reference month (look-ahead risk), a special distribution recorded as a split, survivorship bias in a 31-asset universe chosen in 2026.
- Packaging pandas, numpy and on-demand market data into a Lambda under the size limit.
Accomplishments that we're proud of
- Every number on screen traces back to an evidence object — you can click it and see its value, inputs, source and the function that computed it.
- An agentic system where the AI is constrained by design: rules decide, agents gather and explain, a guardian verifies, and the app degrades gracefully without the model.
- Two investors facing the same news get visibly different feeds, and each difference is explained by a named rule.
- A real end-to-end deployment on AWS, built by a four-person team (data & agents, cloud & API, front end, finance & validation) working in parallel on shared contracts.
What we learned
- Explainability is an architecture decision, not a prompt: separating computation (code), decision (rules) and wording (model) is what makes explanations verifiable.
- Guardrails need to be deterministic first; a model-based checker is a useful second layer, not the only one.
- Latency budgets shape agent design — fewer, batched tool calls beat chatty loops.
- Financial data is never "clean": currency, calendars and revisions matter as much as the model.
- A historical pattern is context, not a prediction — and the UI has to say so every time.
What's next for AlphaForge
- A profile that measures your capacity, not just your appetite for risk. Ask for the amount invested, your expenses, your emergency fund and the share of your savings at stake, then keep the more prudent of the two levels. Express every loss in dollars and in days of expenses: "a 2022-like drop on your $2,000 = −$360, about 3 days of spending".
- A fresh feed, every day. Scheduled ingestion (Amazon EventBridge + Lambda) to refresh news, events and prices daily, plus an optional alert when a highly relevant headline hits one of your positions.
- "Replay 2022 on my portfolio." A historical stress test that shows what your current portfolio would have gone through during the 2022 rate hikes, position by position. Context, never a forecast.
- Richer data. ESG ratings and fundamentals from public sources, a broader asset universe, and recognition of Canadian account types (TFSA, RRSP, non-registered) for income- and dividend-related news.
- Optional, private accounts. Save a profile and portfolio only with explicit consent, encrypted and deletable at any time, so you don't have to start over each visit.
- Measure and improve trust. A larger set of headlines labeled by humans to evaluate the classifier, tests with real users (beginners and near-retirees), and a public dashboard of the guardian's pass rate.
- Faster and multilingual. Pre-computed explanations and streaming for instant answers; an English version (all text is already centralized), then mobile.
Built With
- amazon-api-gateway
- amazon-bedrock
- amazon-cloudfront
- amazon-cloudwatch
- amazon-web-services
- aws-lambda
- aws-sam
- bank-of-canada-api
- claude
- fastapi
- fred-api
- jsonschema
- numpy
- pandas
- pydantic
- pytest
- python
- react
- recharts
- typescript
- vite
- yaml
- yfinance