machine-learning-for-trading
Copilot instructions22k starsChanged 23 days agoMITView on GitHub
This is the companion code repository for Machine Learning for Trading, 3rd Edition. The conventions below are deliberate and repository-wide. Please do not flag adherence to them as defects, and do apply them when reviewing. - No em dashes. The repository standardizes on the ASCII hyphen (-) in all prose, markdown, docstrings, figure titles, and printed output. Em dashes (—) are being removed repository-wide; a file that uses a hyphen where a sibling still has an em dash is ahead…
We split this copilot-instructions.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Every notebook is a paired .py + .ipynb managed by jupytext.
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repository conventions for code review
This is the companion code repository for Machine Learning for Trading, 3rd Edition. The conventions below are deliberate and repository-wide. Please do not flag adherence to them as defects, and do apply them when reviewing.
Prose and comment style
- No em dashes. The repository standardizes on the ASCII hyphen (
-) in all prose, markdown, docstrings, figure titles, and printed output. Em dashes (—) are being removed repository-wide; a file that uses a hyphen where a sibling still has an em dash is ahead of the sweep, not a regression. Do not suggest reintroducing em dashes for "consistency" with files that have not been cleaned yet.
Notebooks
- Every notebook is a paired
.py+.ipynbmanaged by jupytext. The.pyis the source of truth; the.ipynbis generated. Edit the.pyand runjupytext --sync; never hand-edit the.ipynb. - A committed
.ipynbis a production re-execution of its paired.py, stamped inmetadata.ml4t_provenance. Cell outputs are real, not illustrative. - Notebook output must carry no machine-specific paths (no
/tmp/..., no home directory, no absolute checkout path). Print repo-root-relative paths instead, e.g.output_path.relative_to(get_case_study_dir("etfs").parents[1]).
Data schema
- The canonical schema is
symbol(entity identifier) +timestamp(all frequencies, daily and intraday). Thecme_futuresdataset usesproductinstead ofsymbol. These are intentional; do not suggest renaming toasset,date,ticker, orpair.
Results and DataFrames
- The sole source of truth for model/backtest/strategy results is
run_log/registry.dbin each case study.results/*.jsonfiles are a deprecated legacy format and must not be treated as ground truth. - Polars-first. DataFrame operations use Polars; pandas appears only at visualization boundaries. Do not suggest converting Polars code to pandas.
Library corrections
- The six
ml4t-*libraries are the production implementations. When a PR updates numbers because a library estimator was corrected (for example a beta/correlation fix), that is a deliberate correctness change, not an unexplained result drift.
Trending
Quiet since September.about the whole repository
Who's talking about stefan-jansen/machine-learning-for-trading
- @github-trending.bsky.social“🔥 Hot Repo!(100+ new stars today) 🔥 📦 stefan-jansen / machine-learning-for-trading ⭐ 8,063 (+172) 🗒 …”Bluesky · Jun 12, 2023 · 1 likes
- A Hacker News story“Notebooks Accompanying the Book Machine Learning for Algorithmic Trading”Hacker News · Jun 26, 2020 · 1 points
- merovinh/best-of-algorithmic-trading“Add new algorithmic trading resources”GitHub · Mar 16, 2026
- Sultan9062/Sultan“Markets Track”GitHub · Mar 15, 2025
- stefan-jansen/zipline-reloaded“Issue while backtesting using custom data with Zipline-reloaded”GitHub · Oct 7, 2024
The biggest 5 of 18 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 18
Talked about on GitHub, Stack Overflow, the web, Hacker News and Bluesky (18 times).
On GitHub · 8
- Mar 16, 2026Add new algorithmic trading resources — merovinh/best-of-algorithmic-trading0 reactions
- Mar 15, 2025Markets Track — Sultan9062/Sultan0 reactions
- Oct 7, 2024Issue while backtesting using custom data with Zipline-reloaded — stefan-jansen/zipline-reloaded0 reactions · 2 comments
- Nov 18, 2021plot_rolling_returns: Passing list-likes to .loc or [] with any missing labels is no longer supported. — stefan-jansen/pyfolio-reloaded0 reactions · 1 comment
- Jul 4, 2021ValueError: Unable to determine domain for Pipeline — quantopian/zipline0 reactions · 3 comments
3 more on GitHub
- May 12, 2021running code on MacOS / Jupyter Notebook files / Gym OpenGL on MacOS — PacktPublishing/Tensorflow-2-Reinforcement-Learning-Cookbook0 reactions · 10 comments
- Mar 29, 2021Comparable Libraries and Packages to InferTrade — ta-oliver/infertrade0 reactions · 2 comments
- Oct 12, 2020Python随身听-2020-10-12技术精选 — pythonradio/pythonradio.github.io0 reactions · 1 comment
On Stack Overflow · 4
- Jan 4, 2022Why does this code use MinMaxScaler to preprocess S&P 500 index data?0 votes
- Sep 21, 2021How does the output layer of this network which has 10 nodes correspond to an integer?0 votes · 1 answer
- Sep 14, 2021Why is width the first dimension in this code?0 votes
- Feb 12, 2021How to change code from PandasRollingOLS to just RollingOLS?0 votes · 1 answer
On the web · 4
- Sep 19, 2026ML for Trading download — sourceforge.net
- Jun 19, 2026ML4T 3rd Edition Code Rollout Begins — google.com
- Jun 2, 2026GitHub - stefan-jansen/machine-learning-for-trading — google.com
- Mar 19, 2021github.com-stefan-jansen-machine-learning-for-trading_- ... — archive.org
On Hacker News · 1
- Jun 26, 2020Notebooks Accompanying the Book Machine Learning for Algorithmic Trading1 point
On Bluesky · 1
- Jun 12, 2023🔥 Hot Repo!(100+ new stars today) 🔥 📦 stefan-jansen / machine-learning-for-trading ⭐ 8,063 (+172) 🗒 Jupyter Notebook Code f... — @github-trending.bsky.social1 likes and repost
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

