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 you'll build

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.md plus bruin ai enhance teach the agent finance context

Before you start

  • An AI coding tool - Claude Code, Cursor, or Codex (the agent does the typing)
  • Bruin CLI - the agent installs this for you in Step 1
  • Free API keys for FMP and FRED (both take 1 minute to sign up)

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.

Get help & contribute

Sign up to our newsletter

Practical updates on open-source data pipelines, AI analysts, governance, and what we are shipping at Bruin.

The signup form is hosted by Brevo. Allow marketing cookies to load it.