{"data":{"slug":"stefan-jansen-machine-learning-for-trading","name":"machine-learning-for-trading","tagline":"Code for Machine Learning for Trading, 3rd edition, from data sourcing to live execution.","github_url":"https://github.com/stefan-jansen/machine-learning-for-trading","owner":"stefan-jansen","repo":"machine-learning-for-trading","owner_avatar_url":"https://avatars.githubusercontent.com/u/4275885?v=4","primary_language":"Jupyter Notebook","stars":20925,"forks":5620,"topics":["algorithmic-trading","artificial-intelligence","backtesting","data-science","deep-learning","finance","investment","investment-strategies","large-language-models","machine-learning","ml4t-workflow","polars","quantitative-finance","reinforcement-learning","synthetic-data","trading","trading-agent","trading-strategies"],"archived":false,"github_pushed_at":"2026-09-17T15:36:56+00:00","maintenance_label":"Very active","stars_delta_30d":445,"url":"https://www.graphcanon.com/tools/stefan-jansen-machine-learning-for-trading","markdown_url":"https://www.graphcanon.com/tools/stefan-jansen-machine-learning-for-trading.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/stefan-jansen-machine-learning-for-trading","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=stefan-jansen-machine-learning-for-trading","description":"Code for Machine Learning for Trading, 3rd edition — from data sourcing to live execution.","homepage_url":"https://ml4trading.io","license":"MIT","open_issues":3,"watchers":382,"ai_summary":"Repository contains code and resources for implementing machine learning techniques in trading, including data sourcing, backtesting, and live execution strategies.","readme_excerpt":"## Quick Start\n\n**New here? Read these three, in order.**\n\n1. **[What this repository is, and what it is not](docs/what-this-is.md)** - what reproduces with\n   one command, what a configuration change buys you, what needs real compute or licensed data,\n   and what is not promised. Five minutes, before you install anything.\n2. **[Installation](docs/installation.md)** - Linux, Windows WSL2, macOS, Docker, and GPU, in full.\n3. **[Running notebooks](docs/running-notebooks.md)** - the case-study pipeline, the run log, and\n   how to experiment without disturbing the downloaded results.\n\nEverything below is typed into a terminal on your own computer, not into GitHub, and run **from the\nrepository root**. New to the command line? Start with\n**[Before You Begin](docs/installation.md#before-you-begin)**.\n\n---\n\n### 1. Clone and install\n\n```bash\ngit clone https://github.com/stefan-jansen/machine-learning-for-trading.git\ncd machine-learning-for-trading\ncp .env.example .env   # the defaults work as-is; nothing in it needs editing to start\n```\n\nThen pick one environment. **Option A, Docker**, carries every dependency and needs no compiler:\n\n```bash\ndocker compose pull ml4t\n```\n\n**Option B, a local `uv` environment**, on macOS, Linux, or inside WSL2. Install `uv` with its own\ninstaller, not with `pip`, which is missing or refuses to install on most current systems:\n\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\nsource $HOME/.local/bin/env   # the installer's own line; puts uv on PATH here and now\nuv sync\n```\n\nOption B compiles several dependencies from source, `scikit-learn` among them, so it needs a C/C++\ncompiler and the Python headers: `sudo apt install build-essential python3-dev` on Ubuntu, Debian\nand WSL2, `xcode-select --install` on macOS. Budget about **16 GB** of disk (11 GB environment,\n4 GB free datasets, 0.9 GB of git history).\n\n| Platform | Take | Why |\n|----------|------|-----|\n| Linux | either | Both paths are exercised on every release |\n| macOS, Apple Silicon | **B** | Walked on real hardware before each release. Docker there earns its disk only for the twelve pre-executed `ml4t-py312` notebooks, which have no arm64 build, and Chapter 2's containerized database benchmarks |\n| macOS, Intel | **A** | PyTorch publishes no macOS x86_64 wheel, so the local path cannot resolve |\n| Windows | either, **inside WSL2** | Run `wsl --install -d Ubuntu` from an Administrator PowerShell, restart, then run it a second time: the first run usually installs the WSL runtime without a distribution. Then follow the Linux instructions in the Ubuntu terminal. Installing into Windows Python is unsupported and does not work |\n\n---\n\n# Option A, Docker. Then open http://localhost:8888 in your browser — no token.\ndocker compose up ml4t\n```\n\nThe `ML4T_DATA_PATH` prefix on the local path gives the loaders an absolute path, because Jupyter\nruns each notebook with its chapter folder as the working directory and the loaders would otherwise\nsearch inside that folder and report the datasets as missing. It keeps a value you have already\nexported and defaults to this repository's `data/`. The Docker path needs no prefix: the compose\nfile sets the variable inside the container. See\n**[running notebooks](docs/running-notebooks.md)** for the first-notebook walkthrough, case-study\npipelines, Papermill parameters, and the experiment workflow.\n\n---\n\n### Docker images\n\nMost notebooks run on the default **ml4t** image; a few need a specialized one, and each such notebook says so in its\npreamble. Full details in the **[Docker environments guide](envs/README.md)**.\n\n| Image        | Covers                                                           | When you need it        |\n|--------------|------------------------------------------------------------------|-------------------------|\n| `ml4t`       | All 27 chapters + 9 case studies (CPU)                           | Default for everything  |\n| `ml4t-gpu`   | Same `ml4t` image, run with the NVIDIA runtime (`--profil","github_created_at":"2018-05-09T12:33:08+00:00","created_at":"2026-07-07T17:33:21.585813+00:00","updated_at":"2026-09-20T04:33:22.283005+00:00","categories":[{"slug":"ai-agents","name":"AI Agents","url":"https://www.graphcanon.com/categories/ai-agents","markdown_url":"https://www.graphcanon.com/categories/ai-agents.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/ai-agents"},{"slug":"data-retrieval","name":"Data & Retrieval","url":"https://www.graphcanon.com/categories/data-retrieval","markdown_url":"https://www.graphcanon.com/categories/data-retrieval.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/data-retrieval"},{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"}],"tags":[{"slug":"algorithmic-trading","name":"algorithmic-trading"},{"slug":"artificial-intelligence","name":"artificial-intelligence"},{"slug":"backtesting","name":"backtesting"},{"slug":"data-science","name":"data-science"},{"slug":"deep-learning","name":"deep-learning"},{"slug":"finance","name":"finance"},{"slug":"investment","name":"investment"},{"slug":"investment-strategies","name":"investment-strategies"}],"trust":{"provenance":{"is_fork":false,"github_id":132754148,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-18T08:47:17.909Z","maintenance":{"label":"Very active","score":96,"methodology":"github_public_v1","releases_90d":3,"days_since_push":0,"last_release_at":"2026-07-24T08:08:45Z","stars_delta_30d":445,"open_issues_delta_30d":-2},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-09-18T08:47:20.042Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-18T08:47:16.837Z"},"deploy":{"source":"dockerfile:docker-compose.yml","self_host":true,"observed_at":"2026-09-18T08:47:16.837Z","managed_saas":false},"languages":{"value":["jupyter notebook","python"],"source":"github.language+pyproject.toml","observed_at":"2026-09-18T08:47:16.837Z"},"has_docker":{"value":true,"source":"dockerfile:docker-compose.yml","observed_at":"2026-09-18T08:47:16.837Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-18T08:47:16.837Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":{"notes":["Requires a C/C++ compiler and Python headers for local setup on macOS, Linux, or WSL2.","Docker setup is recommended for macOS with Intel and Windows (via WSL2)."],"min_ram_gb":8,"requires_docker":true},"constraints":{"min_ram_gb":8,"requires_docker":true},"when_to_use":["Use when you need a complete workflow from data sourcing to live trading execution, as the repository covers all stages of the trading process.","Ideal for those working on macOS with Apple Silicon, as the local environment setup is tested and supported on this hardware.","Suitable for users who prefer a Docker-based setup on macOS with Intel or Windows (via WSL2), as the local path cannot resolve PyTorch for these systems."],"when_not_to_use":["Avoid if you are working on Windows without WSL2, as the repository does not support installation into Windows Python.","Not recommended for users who do not have access to a C/C++ compiler and Python headers, as the local setup requires these for compiling dependencies.","Not ideal for those who prefer a lightweight setup, as the local environment requires about 16 GB of disk space."],"source":"enrich:decision_facts","observed_at":"2026-09-18T10:01:59.277Z"},"constraint_facets":{"min_ram_gb":8,"requires_docker":true},"decision_summary":[{"label":"Requirements","value":"Min 8 GB RAM; Requires Docker; Requires a C/C++ compiler and Python headers for local setup on macOS, Linux, or WSL2.; Docker setup is recommended for macOS with Intel and Windows (via WSL2)."},{"label":"Adopt for","value":"machine-learning-for-trading is a comprehensive repository for implementing machine learning techniques in trading, covering data sourcing, backtesting, and live execution strategies, all documented in Jupyter Notebooks."}]}}