Back to directory

Machine Learning for Trading — 3rd Edition

A book companion repository with code, case studies and libraries for building, testing and deploying machine learning-based trading strategies, from data sourcing through live execution.

Machine Learning for Trading — 3rd Edition

This repository holds the code for the third edition of "Machine Learning for Trading" by Stefan Jansen, organized around one workflow: developing a research idea into a strategy that can run, and keep running, in a live market. Nine case studies walk through the book's 27 chapters, from raw data through features, models, backtests, costs and risk to deployment.

The new edition adds generative AI and autonomous agents, bringing retrieval-augmented generation, knowledge graphs and multi-agent systems into financial research, and widens the model toolkit with gradient boosting, deep time-series architectures, and tabular and latent-factor models. New chapters cover transaction costs, risk management, portfolio construction and strategy synthesis.

A companion website provides primers, agent skills and production Python libraries, and a production track covers live trading through brokers such as Interactive Brokers and Alpaca, along with MLOps practices such as drift detection and safe rollout.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.