How stefan-jansen/machine-learning-for-trading works
This repository is the code companion to *Machine Learning for Trading, 3rd Edition*: a broad set of chapter examples and nine case studies organized around taking a trading idea from data and research through evaluation, strategy design, and deployment. The graph emphasizes that documented workflow while retaining major capabilities such as causal methods, generative AI, reinforcement learning, and live-trading governance. Several connections come from the README or SOURCE INDEX; unsampled modules are represented only at supported paths, and their internal wiring is not inferred.
Main entry points: research_workflow.py Case-study workflows · 17_portfolio_construction Portfolio construction · backtest_runner.py Backtest runner · agent_schemas.py Agent schemas
Components 30
Data infrastructure
- Market data loaders
data/__init__.py - Data preparation
02_financial_data_universe/17_complete_pipeline.py - Data quality
02_financial_data_universe/13_data_quality_framework.py - Market microstructure
03_market_microstructure - Alternative data
04_fundamental_alternative_data
Research and evidence
- Case-study workflows
case_studies/cme_futures/research_workflow.py - Learning task
07_defining_the_learning_task - Feature engineering
case_studies/utils/feature_engineering.py - Research strategy
case_studies/research/strategy.py
Models and methods
- Modeling utilities
utils/modeling.py - Model families
12_gradient_boosting - Deep time-series models
13_dl_time_series - Causal methods
15_causal_estimation - Synthetic data
05_synthetic_data
Strategy design
- DeepM features
17_portfolio_construction/deepm/features.py - Portfolio construction
17_portfolio_construction - Costs and risk
18_transaction_costs - Backtest runner
case_studies/utils/backtest_runner.py - Case analytics
case_studies/utils/analytics.py
Deployment and operations
- Live trading
25_live_trading - MLOps governance
26_mlops_governance - Artifact paths
utils/paths.py - Reproducibility
utils/reproducibility.py
AI research systems
- Agent pipeline
24_autonomous_agents/agent_pipeline.py - Agent providers
24_autonomous_agents/agent_providers.py - Agent schemas
24_autonomous_agents/agent_schemas.py - Agent tools
24_autonomous_agents/agent_tools.py - Financial RAG
22_rag_financial_research - Knowledge graphs
23_knowledge_graphs
Other components
- Researcher
Connections 20
- Researcher → Market data loaders: sources data
README.md - Market data loaders → Data preparation: prepares data
README.md - Data preparation → Case-study workflows: supports research
README.md - Case-study workflows → Learning task: defines task
README.md - Learning task → Feature engineering: builds features
README.md - Feature engineering → Modeling utilities: enables modeling
README.md - Modeling utilities → Backtest runner: evaluates strategy
README.md - Backtest runner → Portfolio construction: informs design
README.md - Portfolio construction → Costs and risk: adds constraints
README.md - Costs and risk → Live trading: deploys strategy
README.md - Live trading → MLOps governance: monitors operation
README.md - MLOps governance → Case-study workflows: feeds retraining
README.md - Case-study workflows → Research strategy: uses strategy
case_studies/cme_futures/research_workflow.py - Case-study workflows → Backtest runner: uses runner
case_studies/cme_futures/research_workflow.py - Case-study workflows → Case analytics: uses analytics
case_studies/cme_futures/research_workflow.py - DeepM features → Portfolio construction: supports allocation
17_portfolio_construction/deepm/features.py - Agent pipeline → Agent schemas: uses schemas
24_autonomous_agents/agent_pipeline.py - Agent providers → Agent schemas: uses schemas
24_autonomous_agents/agent_providers.py - Agent tools → Agent schemas: uses schemas
24_autonomous_agents/agent_tools.py - Financial RAG → Knowledge graphs: related capability