# machine-learning-for-trading | Stefan Jansen | Knowledge Base | Instagit

Code for Machine Learning for Algorithmic Trading, 2nd edition.

GitHub Stars: 18.1k

Repository: https://github.com/stefan-jansen/machine-learning-for-trading

---

## Articles

### [How to Use RNNs for Multivariate Time Series Prediction in Trading](/stefan-jansen/machine-learning-for-trading/how-to-use-rnns-for-multivariate-time-series-prediction-in-trading)

Master multivariate time series prediction in trading using RNNs and LSTM or GRU layers. Learn to capture non-linear dependencies and improve your trading strategies with this practical guide.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Implement Topic Modeling for Financial News: A Complete LDA Pipeline](/stefan-jansen/machine-learning-for-trading/how-to-implement-topic-modeling-for-financial-news)

Learn to implement topic modeling for financial news using LDA. Preprocess, vectorize, train, and visualize your results for actionable insights.

- Tags: tutorial
- Published: 2026-06-02

### [How to Use BERT for Financial Text Sentiment Analysis: A Complete Guide](/stefan-jansen/machine-learning-for-trading/how-to-use-bert-for-financial-text-sentiment-analysis)

Learn to use BERT for financial text sentiment analysis. Fine-tune transformers on SEC filings or earnings calls for accurate insights. Complete guide available.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Implement Autoencoders for Asset Pricing: A Complete Guide to Conditional Risk Factors](/stefan-jansen/machine-learning-for-trading/how-to-implement-autoencoders-for-asset-pricing)

Implement autoencoders for asset pricing to extract conditional risk factors. Discover hidden data-driven factors by learning compressed latent representations of asset returns.

- Tags: tutorial
- Published: 2026-06-02

### [How to Implement Autoencoders for Conditional Risk Factors: A Deep Learning Approach for Asset Pricing](/stefan-jansen/machine-learning-for-trading/how-to-implement-autoencoders-for-conditional-risk-factors)

Learn to implement autoencoders for conditional risk factors using deep learning for asset pricing. Extract latent risk factors by conditioning on firm characteristics. Explore machine learning for trading.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Evaluate Alpha Factors with Alphalens: A Step-by-Step Python Tutorial](/stefan-jansen/machine-learning-for-trading/how-to-evaluate-alpha-factors-with-alphalens)

Learn to evaluate alpha factors with Alphalens in this Python tutorial. Alphalens offers a standardized workflow to measure factor predictive power and generate statistical tear-sheets.

- Tags: tutorial
- Published: 2026-06-02

### [How to Extract Alpha Factors Using TA-Lib in Python: A Complete Guide](/stefan-jansen/machine-learning-for-trading/how-to-extract-alpha-factors-using-ta-lib)

Easily extract alpha factors with TA-Lib in Python. Learn how to load OHLCV data, compute vectorized indicators like RSI and MACD, clean, and standardize them for your trading models.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Implement Pairs Trading with Kalman Filter: A Python Guide](/stefan-jansen/machine-learning-for-trading/how-to-implement-pairs-trading-with-kalman-filter)

Implement pairs trading with Kalman filter using Python. Build a robust statistical arbitrage strategy using a dynamic hedge ratio and trade the z-score of the mean-reverting spread for profitable results.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Implement Pairs Trading with Cointegration: A Complete Python Workflow](/stefan-jansen/machine-learning-for-trading/how-to-implement-pairs-trading-with-cointegration)

Implement pairs trading with cointegration using Python. Learn to test asset pairs, select stable ones, and execute mean-reversion trades with backtrader.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Backtest ML-Driven Trading Strategies Using Backtrader](/stefan-jansen/machine-learning-for-trading/how-to-backtest-ml-driven-trading-strategies-using-backtrader)

Learn to backtest ML-driven trading strategies with Backtrader. Extend PandasData and create custom strategies for dynamic capital allocation based on ML model outputs.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Backtest ML-Driven Trading Strategies Using Zipline](/stefan-jansen/machine-learning-for-trading/how-to-backtest-ml-driven-trading-strategies-using-zipline)

Learn to backtest ML-driven trading strategies using Zipline. Register custom data, wrap your model, and convert predictions to portfolio allocations for robust testing.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Use LightGBM for Intraday Trading Strategies with SHAP Values: A Complete Implementation Guide](/stefan-jansen/machine-learning-for-trading/how-to-use-lightgbm-for-intraday-trading-strategies-with-shap-values)

Master LightGBM for intraday trading. Implement time-series CV, generate signals, and use SHAP values to uncover key features driving your trading decisions. Get the complete guide.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Use XGBoost for Intraday Trading Strategies with SHAP Values: A Complete Implementation Guide](/stefan-jansen/machine-learning-for-trading/how-to-use-xgboost-for-intraday-trading-strategies-with-shap-values)

Implement XGBoost for intraday trading strategies using SHAP values. Train a gradient boosting classifier on minute-level data and interpret features driving buy/sell signals. Complete implementation guide.

- Tags: how-to-guide
- Published: 2026-06-02

### [How to Implement a Custom Zipline Data Bundle for Intraday Trading Data](/stefan-jansen/machine-learning-for-trading/how-to-implement-custom-zipline-data-bundle-for-intraday-trading-data)

Learn how to implement a custom Zipline data bundle for intraday trading data Implement exchange calendars and data generators for your Zipline projects.

- Tags: how-to-guide
- Published: 2026-06-02

