machine-learning-for-trading

Code for Machine Learning for Trading, 3rd edition — from data sourcing to live execution.

What is machine-learning-for-trading?

Code for Machine Learning for Trading, 3rd edition — from data sourcing to live execution.

Overview of machine-learning-for-trading

What it is

Code for Machine Learning for Trading, 3rd Edition by Stefan Jansen. It provides the implementation for 27 chapters and nine case studies that follow one end-to-end workflow: from data sourcing and strategy research, across an evidence boundary that separates tuning from evaluation, to deployment and monitoring, with a feedback loop that retrains, pauses, or retires a strategy as its edge decays.

Key features

  • A wider model toolkit: gradient boosting (XGBoost, LightGBM, CatBoost), deep time-series architectures (PatchTST, iTransformer, TSMixer, TCN, Mamba), and newer tabular and latent-factor models (TabPFN, TabM, conditional and supervised autoencoders).
  • Dedicated strategy-design chapters: transaction costs and risk management are now full chapters, joining portfolio construction and strategy synthesis.
  • A full production track: live trading systems (Interactive Brokers, Alpaca, QuantConnect), MLOps and governance (drift detection, safe rollout, circuit breakers, feature stores, experiment tracking).
  • Generative AI: retrieval-augmented generation grounded in SEC filings, knowledge graphs and Graph RAG, and autonomous, multi-agent research systems.
  • Causal machine learning: Double ML, Bayesian structural time series, and causal discovery.
  • Reinforcement learning: optimal execution, market making with inventory, and deep hedging.
  • Synthetic financial data: TimeGAN, Tail-GAN, Sig-CWGAN, and diffusion-based generators.

Use cases

Building, testing, and deploying ML-driven trading strategies across multiple asset classes and frequencies. The nine case studies cover ETFs, crypto perpetuals, intraday equities, options, FX, futures, and equity factor panels, each carried through the same pipeline from raw data to deployment assessment.

Getting started

See the repository README for quick-start instructions on installation, data download, and running the first notebook.

License and pricing

MIT license. Open source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/stefan-jansenmachine-learning-for-trading.svg)](https://yunodb.com/tools/stefan-jansenmachine-learning-for-trading?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/stefan-jansenmachine-learning-for-trading?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/stefan-jansenmachine-learning-for-trading.svg" alt="Featured on YunoDB" height="20"></a>