This is the companion code repository for the third edition of the book Machine Learning for Trading by Stefan Jansen. It walks through one end-to-end workflow, from data sourcing and strategy research to deployment and monitoring, across 27 chapters and nine case studies. It is aimed at readers who want to build, test, and run ML-driven trading strategies.
stefan-jansen/machine-learning-for-trading is a third-party open-source project, listed here from public GitHub data. ImuTechz did not write it and has not reviewed or security-audited its code. Read the source and its permissions before you install or run it.
Features
27 chapter guides plus nine case studies covering ETFs, crypto perpetuals, intraday equities, options, FX, futures, and equity factor panels
Model toolkit spanning gradient boosting, deep time-series architectures, and tabular and latent-factor models
Dedicated chapters on transaction costs, risk management, portfolio construction, and strategy synthesis
Production track covering live trading systems, MLOps, drift detection, and safe rollout
Generative AI, causal ML, reinforcement learning, and synthetic financial data material
Data layer built on Polars, with reproducible Docker environments per chapter
Best for
Learning an end-to-end ML trading workflow
Studying worked case studies across several asset classes
Practising walk-forward validation and overfitting controls
Exploring deployment and monitoring of trading strategies
Pros
Traces a single workflow from data infrastructure through deployment and monitoring
Ships reproducible Docker environments so results repeat across machines
Draws an explicit evidence boundary between tuning and evaluation
Includes nine case studies run through the same pipeline
Cons
Requires Docker environments for reproducible results
The second edition lives on a separate branch, not the default one
Qlib is an AI-oriented Quant investment platform that aims to use AI tech to empower Quant Research, from exploring ideas to implementing productions. Qlib supports…