#1414th of 88 in Learning and cookbooksFor finance and business, trading, stocks and crypto, finance and accounting

machine-learning-for-trading

Code for the book on ML trading strategies, with nine case studies

Stars
21.8k
License
MIT
Last commit
Nov 2026
Last release
Sep 2026
Language
Jupyter Notebook
Stars, last 29 weeks+4,863
21 Apr 2026: 16,921 stars28 Apr 2026: 16,997 stars5 May 2026: 17,090 stars12 May 2026: 17,138 stars19 May 2026: 17,181 stars26 May 2026: 17,231 stars2 Jun 2026: 18,478 stars9 Jun 2026: 18,903 stars16 Jun 2026: 18,988 stars23 Jun 2026: 19,079 stars30 Jun 2026: 19,294 stars7 Jul 2026: 19,428 stars14 Jul 2026: 19,710 stars21 Jul 2026: 19,863 stars28 Jul 2026: 20,006 stars4 Aug 2026: 20,155 stars11 Aug 2026: 20,279 stars18 Aug 2026: 20,386 stars25 Aug 2026: 20,533 stars1 Sept 2026: 20,649 stars8 Sept 2026: 20,752 stars15 Sept 2026: 20,826 stars22 Sept 2026: 20,911 stars29 Sept 2026: 21,067 stars6 Oct 2026: 21,202 stars13 Oct 2026: 21,301 stars20 Oct 2026: 21,457 stars27 Oct 2026: 21,595 stars3 Nov 2026: 21,700 stars10 Nov 2026: 21,784 stars

16,921 on 21 Apr 202621,784 on 10 Nov 2026

From GitHub's daily star counts.

Checked on GitHub.

Overview

Companion code for Stefan Jansen's Machine Learning for Trading, 3rd edition: 27 chapter directories of Jupyter notebooks covering data, features, models, backtesting, costs, risk and live trading. Nine case studies (ETFs, crypto perps, options, FX, futures, equities) run through the same pipeline. Models range from ridge and gradient boosting to PatchTST, RL and RAG over SEC filings.

Who it is for: Quant researchers and engineers learning to build and test ML trading strategies

Strengths

  • 27 chapter guides map book sections to notebooks and list the data each needs
  • Nine case studies apply one pipeline across ETFs, crypto, options, FX and futures
  • Covers overfitting controls: walk-forward CV, Deflated Sharpe Ratio, White's Reality Check
  • Second edition kept intact on the second-edition branch

Weaknesses

  • Written to accompany a paid book; the book carries no code listings
  • Some case studies need real compute or licensed data, per the README
  • Wide dependency stack (Polars, PyTorch, Optuna and more) makes setup heavy
  • README embeds course and workshop promotion that changes daily

What it needs

  • Compose
  • Needs Docker, Interactive Brokers, Alpaca, QuantConnect
  • Models: XGBoost, LightGBM, CatBoost, PyTorch

Quick answers

Is machine-learning-for-trading open source?

Yes. Its code is on GitHub under the MIT license.

Can you run machine-learning-for-trading with Docker?

Yes. Its repository has a Docker setup: a Dockerfile, a Compose file or a published image.

Also in Learning and cookbooks

See all 88
Also in Learning and cookbooks
RankProjectScore
1ai-engineering-from-scratchHands-on AI engineering curriculum with 542 lessons across 20 phases78.5k stars+10,997 (+16%) in 30 daysMIT91 out of 100
2generative-ai-for-beginners21-lesson course on building generative AI apps in Python and TypeScript123.4k stars+2,347 (+1.9%) in 30 daysMIT83 out of 100
3rag_techniquesCollection of 42 runnable notebooks implementing RAG techniques30.3k stars+563 (+1.9%) in 30 dayscustom license81 out of 100
#4cs249r_bookOpen textbook and course materials for machine learning systems engineering30.1k stars+1,266 (+4.4%) in 30 dayscustom license81 out of 100
#5ai-for-beginners24-lesson AI curriculum with notebooks in PyTorch and TensorFlow Live demo ↗ (opens in a new tab)70.7k stars+1,156 (+1.7%) in 30 daysMIT80 out of 100