
Bruin Academy
Tutorial
Stock Analyst
Build an AI stock analyst that pulls FMP, Yahoo Finance, and FRED market data into a local DuckDB database, then answers real market questions with SQL-backed sources you can cite. The AI agent writes the code - every step is a plain-English prompt.

What
Learn the junior stock analyst toolkit in one sitting. Pull company fundamentals, market prices, and US macro data into a local database, then ask an AI agent market questions with SQL-backed sources.
- Pull four quarters of fundamentals for any ticker and compare them to peers
- Overlay stock price performance against the macro regime (e.g. "how did high-FCF companies perform when the yield curve was inverted?")
- Ask natural-language questions and get SQL-backed answers - with sources the agent can cite
How
- The AI agent does the typing - you prompt it in plain English and approve what it does
- Bruin CLI scaffolds the pipeline, and ingestr connectors handle the data pulls
- Bruin MCP gives Claude Code, Cursor, or Codex direct query access to your database
- Pipeline-scoped
AGENTS.mdplusbruin ai enhanceteach the agent finance context
Guide overview
- 1Set Up Your WorkspaceInstall your AI coding tool, then have it install Bruin CLI and wire up MCP for you. Every step from here on is a plain-English prompt.
- 2Scaffold Your ProjectCreate an empty Bruin project with DuckDB as the local database - the workspace your fundamentals, prices, and macro data will land into.
- 3Ingest FMP, Yahoo Finance, and FREDHave the AI agent write ingestr assets for three data sources - company fundamentals, stock prices, and US macro - and pull them into DuckDB.
- 4Build Staging + Report LayersAdd a clean middle layer on top of the raw data, then build a final report table that joins fundamentals, prices, and macro - the analysis-ready table your AI agent will query.
- 5Teach the AI Your DomainUse bruin ai enhance to document every column, then add a pipeline-scoped AGENTS.md with finance context so the agent reasons about your data like a real analyst.
- 6Ask the Real Analyst QuestionPut the stack to work. Combine FMP fundamentals, Yahoo prices, and FRED macro to answer the kind of question analysts actually get paid for.
Frequently asked questions
What is an AI stock analyst?
An AI stock analyst is a local setup where an AI coding agent pulls financial data into a database and answers market questions with SQL-backed results. In this tutorial you build one that ingests company fundamentals, stock prices, and US macro data into DuckDB, then queries it to compare tickers, overlay price performance against the macro regime, and cite the exact rows behind each answer.Do I need to know how to code to build this?
No. The AI agent does the typing. You prompt it in plain English and approve what it does. You should be comfortable reading results and reviewing changes, but you do not need to write SQL or Python yourself - the agent scaffolds the pipeline, writes the ingestion assets, and runs the queries.What data sources does the stock analyst use?
Three free sources: Financial Modeling Prep (FMP) for company fundamentals, Yahoo Finance for stock prices, and FRED (Federal Reserve Economic Data) for US macro indicators. Bruin's ingestr connectors pull all three into a local DuckDB database.Is this stock analyst tutorial free?
Yes. It runs entirely on your machine with the open-source Bruin CLI and a local DuckDB database. The FMP and FRED API keys are free and take about a minute each to sign up for, and Yahoo Finance needs no key.Which AI coding tools work with this tutorial?
Any agentic coding tool that supports MCP, including Claude Code, Cursor, and Codex. Bruin MCP gives the agent direct query access to your DuckDB database so it can run SQL and read the results while it reasons.Can I analyze any stock ticker?
Yes. Once the pipeline is set up you can pull four quarters of fundamentals and price history for any ticker the sources cover, compare it to peers, and ask follow-up questions in plain English.
Resources
Get help & contribute