← All projects
Finance & trading

Machine Learning for Trading

The companion code for a book on using machine learning to design and test trading strategies.

What it does

This repository holds the code for the third edition of the book Machine Learning for Trading: 27 chapters and nine case studies. It follows one path from collecting data and researching ideas to testing and running a strategy.

Topics include forecasting models, risk management, AI that reads company filings, and reinforcement learning. The earlier edition is kept on a separate branch.

Who it's for

Readers of the book, finance students and developers learning data-driven trading.

Can I use it without coding?

Developers only. Python notebooks that need programming knowledge. New to this? Start here.

Can I run it?

API key
Not needed

Try it

Using Claude Code, Cursor or another AI coding assistant? Paste the prompt and it will walk you through the setup.New to this?

Before you install

  • Only download from the official GitHub page. Copies with similar names exist for many popular projects.
  • License (MIT): Very permissive: free to use, change and share, including for business.
  • More on staying safe