FullStack Alpha logo BestAITradingTools.com by FullStack Alpha
Red and green candlestick chart recovering after a pullback on a dark background

Quant and ML deep dive

Machine Learning for Trading Review | Legendary Repo, Messy New Edition

Machine Learning for Trading logoMachine Learning for Tradingstefan-jansen/machine-learning-for-trading

Machine Learning for Trading is the free, open-source code companion to Stefan Jansen's book, with notebooks covering everything from raw market data to machine learning models and live broker connections. For years it was the go-to self-study path for machine learning for algorithmic trading. The catch: the new third edition is drawing sharp criticism from quants, and a notebook course is not a trading system.

Think of it as a giant cookbook with every recipe pre-measured on the counter: you learn fast by cooking along, but nobody promises the dishes will sell.

Listen · 1:35 audio briefing · voice: EricMachine Learning for Trading | The Free Cookbook Quants Argue About
Read the transcript

For years, this was the free textbook for learning AI trading. Then the new edition dropped, and quants started arguing. Here's what you need to know.

Machine Learning for Trading is the free code companion to Stefan Jansen's book. Think of a giant cookbook with every ingredient pre-measured. You learn fast by cooking along. Nobody promises the dishes will sell.

Why's it popular? It covers the whole path in one place.

Five things we like. One, a huge set of free notebooks. Two, it goes from raw data to models to backtests. Three, live trading chapters connect to brokers. Four, earlier editions were widely recommended. Five, an MIT license on the code.

Live chapters work with Interactive Brokers, Alpaca and QuantConnect, and it runs in Docker.

Here's the debate. In a fresh Reddit thread, some quants call the third edition AI-written and overpriced. That's their view, not a verdict, but read samples before you buy.

Treat it like a course, one chapter a week, and you'll understand what most AI trading tools are doing under the hood.

Two cautions. Learning isn't an edge. Finishing the notebooks won't make a strategy profitable. And the setup is heavy, with big downloads.

Best for coders who want a structured self-study path. Scroll down for the scorecard and alternatives.

This is education, not financial advice. Your market edge starts with the right tool. Stay alpha.

FullStack Alpha Editorial Team

Reviewed by Jay Rocco, Chief Editor

What Is Machine Learning for Trading and What Does It Actually Do?

GitHub page for Machine Learning for Trading (stefan-jansen/machine-learning-for-trading)
stefan-jansen/machine-learning-for-trading on GitHub · 2026

This is a repo (a project's folder of code on GitHub) with more than 21,000 stars, built by author Stefan Jansen. It holds the code for his book on applying machine learning to markets. The current version is the third edition, with 27 chapters each in their own folder, and the older second edition is preserved on a separate branch for anyone who preferred it.

The code arrives as Jupyter notebooks, which are documents that mix plain-English explanation, runnable code and charts in one scrollable page. Topics span market microstructure (how orders actually meet), feature engineering, gradient boosting, deep time-series models, causal machine learning, reinforcement learning, and newer material on retrieval-augmented generation, knowledge graphs and autonomous AI agents. Nine case studies cover ETFs, crypto perpetual futures, NASDAQ-100 intraday data, S&P 500 options, FX and CME futures.

The third edition also goes further than most courses. It compares fast and realistic backtesting engines (tests that replay a strategy on old prices), and chapter 25 covers live trading through Interactive Brokers, Alpaca and QuantConnect, with later chapters on drift detection and circuit breakers that stop a misbehaving model. A download script grabs about 4 GB of free data with no API keys, including AlgoSeek daily bars shared with permission.

Community Score

87 / 100

How we score
Adoption · How many people starred it
26 / 30
Maintenance · How recently the code was updated
25 / 25
Community sentiment · What traders say on Reddit and Hacker News
13 / 20
Builder activity · How many people built their own copy
13.1 / 15
License clarity · Whether you are clearly allowed to use it
10 / 10

GitHub data checked 2026. Community read: mixed.

Stars
21,624
Forks (people who built on it)
5,741
Written in
Jupyter Notebook
License
MIT
Last update
2026-10-23
Markets
Stocks
Skill level
Intermediate

Works with

Any AI, through your own code
View stefan-jansen/machine-learning-for-trading on GitHub ↗

Is Machine Learning for Trading Right for You?

Good fit if you are

  • Python learners who want a structured, hands-on path into machine learning for trading
  • Data scientists moving into finance who need market-specific context fast
  • Self-directed traders who learn best by running and breaking real code
  • Builders curious how AI agents and language models fit into a research workflow

Skip it if you are

  • You want a ready-made bot that trades for you. This is a learning resource, not a product.
  • You expect the latest edition to carry the same reputation as earlier ones. Recent reviews on r/quant are harsh.

The jargon, in plain English

Repo
A project's folder of code on GitHub that anyone can download.
Jupyter notebook
A document that mixes explanation, runnable code and charts in one page.
Backtest
Replaying a strategy on old prices to see what would have happened.
Feature engineering
Turning raw prices and data into useful inputs, like momentum or volatility, that a model can learn from.
Gradient boosting
A popular model that stacks many small decision trees, each one fixing the last one's mistakes.
Overfitting
When a model memorizes past noise and fails on new data, the most common way machine learning strategies die.
Paper trading
Trading with fake money against real, live prices.
Drift
When market behavior changes so a model trained on the past slowly stops working.

What Do Traders Say About Machine Learning for Trading?

The reputation of this project is split by edition. Earlier editions and their notebooks were long recommended across Hacker News and r/quant as a solid starting point for machine learning in trading, mostly because of the sheer amount of working code.

The third edition has met a cold reception. In a recent r/quant thread, commenters criticized the new text and notebooks as appearing AI-written, questioned the price, and pointed out the author does not come from a systematic trading firm. One reader's verdict after a quick look was blunt. Is that fair to years of free code? Partly not. But it is a fair warning about the new material.

“Took a quick look, don't recommend”
scchess, r/quant, 2026

What they like

  • Huge, free code companion
  • Earlier editions long recommended as a starting point
  • Covers data, models, backtesting and live trading in one place
  • MIT-licensed code

What they complain about

  • Third edition criticized as AI-written text and notebooks
  • Book price seen as high for the content
  • Author lacks systematic-firm background, per commenters
  • Large environment and data downloads

How Do You Set Up Machine Learning for Trading Safely?

Plain steps, fake money first. Keep your keys in a private settings file, never pasted into the code.
  1. 01Pick your editionThe main branch holds the third edition; the second edition lives on the second-edition branch. Choose the one that matches the book you own or the reviews you trust.
  2. 02Install with DockerThe README's easiest path is docker compose pull ml4t, which needs no compiler. Plan for roughly 16 GB of disk space.
  3. 03Or use a local uv setupOn macOS, Linux or WSL2, install uv and run uv sync. This route needs a C or C++ compiler.
  4. 04Download the dataRun the data download script to fetch about 4 GB of free datasets with no API keys. Respect the attribution terms on the AlgoSeek files.
  5. 05Work through notebooks in orderRun each chapter's notebooks and change one thing at a time. Breaking the code on purpose teaches more than reading it.
  6. 06Paper trade before any live chapterBefore using the live trading chapter, connect a broker's paper account first. Keep broker API keys in an environment file, never inside a notebook you might share.

What Do You Need to Run Machine Learning for Trading?

  • Docker or a Python setup with uv

    Docker avoids compiler headaches; the local uv route needs a C or C++ compiler.

    Docker
  • Disk space and a solid computer

    The README suggests about 16 GB of disk, and deep learning chapters run faster with more memory.

  • A broker account with an API (only for live chapters)

    Chapter 25 connects strategies to brokers for live or paper trading.

  • The book (optional)

    The notebooks follow the book's chapters. The code is free; the book is sold separately.

    Amazon
  • Working Python knowledge

    You will read, run and edit code constantly. This is not a video course.

What Are the Risks of Using Machine Learning for Trading?

  • Quality concerns in the third edition

    Community reviewers say the new text and notebooks read as AI-written. Cross-check key ideas against other sources before trusting them.

  • Learning is not an edge

    Every reader gets the same notebooks and the same free data. Strategies copied straight from a popular book are the most crowded ones on earth.

  • Overfitting temptation

    Machine learning makes it easy to find patterns in noise. A model that shines on the book's data can fail on fresh prices.

  • Heavy setup

    Large environments, compilers and gigabytes of data can stall beginners before chapter one.

  • Live trading risk

    The live chapter connects to real brokers. A notebook bug with a live account can place real orders, so stay in paper mode until you understand every line.

Not ready to run code yourself? Our hands-on AI stock tool reviews on AIStockPickerApp.com score finished products on five pillars, the AI stock tools directory at AIStockPickerApps.com sorts 200+ tools by the job they do, and AIStockTradingBots.com walks through broker APIs, bot setup and backtesting step by step. Or head back to the Trading Workflows home page to match tools to your own routine and budget.

What Are the Best Machine Learning for Trading Alternatives?

Should You Use Machine Learning for Trading? Our Verdict

Machine Learning for Trading earns its Community Score of 87 on adoption, maintenance and an MIT license, with mixed sentiment pulled down by reaction to the third edition. As a free, organized tour from raw data to live execution, it is still one of the most complete resources on machine learning for algorithmic trading anywhere.

Use it as a curriculum, not a strategy source. If the new edition's quality worries you, the second-edition branch is still there. Run the notebooks, break them, rebuild them on your own data, and paper trade anything that survives. Skills compound. Copied strategies do not. The repo's real value is the habit it builds: test, measure, doubt, repeat.

Community Score

87

out of 100 · method

More Machine Learning for Trading Questions, Answered

Is Machine Learning for Trading by Stefan Jansen worth it?

The free code is worth exploring for its breadth. The third edition book has drawn harsh reviews on r/quant over quality and price, so read reviews before buying, or start with the free notebooks and the second-edition branch.

Is the Machine Learning for Trading code free?

Yes. The notebooks are free on GitHub under the MIT license. The book text is copyrighted and sold separately.

What is the best way to learn machine learning for algorithmic trading?

Learn by building and testing, not by reading alone. Repos like this one give you working notebooks to modify, and paper trading tests whether ideas survive real prices. Keep a written log of what you tried and why.

Can I build a Python machine learning trading bot from this repo?

You can learn the pieces. The third edition covers live trading through Interactive Brokers, Alpaca and QuantConnect, but turning a notebook into a safe, always-on bot takes extra engineering and long paper trading.

Does Machine Learning for Trading cover AI agents and LLMs?

Yes. The third edition adds chapters on retrieval-augmented generation, knowledge graphs and autonomous agents alongside classic models like gradient boosting and deep time-series networks.

Sources we checked

Incoming transmission | Free weekly newsletter

Stop paying for tools that don't earn their seat.

FullStack Alpha has tested 200 AI stock tools. Be honest: how many of yours do the same job, and which one did you forget you signed up for?

One email a week fixes that: which tools are worth the money, what they cost right now, and how the traders on this site wire them into a routine. Five minutes to read. Zero noise.

Free. One email a week. Unsubscribe in one click. We never sell your email.

  • Hot stock picks
  • Paid signal pitches
  • Fake countdown timers
  • Gurus selling courses

Inside every issue

5 MIN READ

  1. 01

    The Verdict

    One AI trading tool tested and scored. What it does well, what it costs, and the catch the sales page leaves out.

  2. 02

    Price Watch

    Price changes and live promos on the tools traders actually use, monthly and annual side by side, so you stop overpaying.

  3. 03

    Workflow Teardown

    One educator's routine taken apart: the scan, the chart, the tools, and the free swap for every paid one.

  4. 04

    Scan of the Week

    Exact scanner settings you can copy, pulled from the educator's own lesson with the timestamp.

Process beats prediction. This is the email that keeps your process honest.

FullStack Alpha logo

FullStack Alpha Network