StratCraftStratCraftEnglish
Strategy Type

Machine Learning Trading Algorithms

Open-Source ML Models for Quantitative Finance

Machine learning trading algorithms apply statistical learning models. Gradient boosting, neural networks, and transformers. To financial time-series data to predict price movements or generate trading signals. These open-source implementations cover both regression (price target) and classification (direction) formulations.

12 algorithms2 libraries

How ML algorithms connect across libraries

🧠ML Algorithms
πŸ€–
Freqtrade9 algos
πŸ”¬
Microsoft Qlib6 algos
LightGBMRegressorintermediate
LightGBMClassifierintermediate
XGBoostRegressorintermediate
XGBoostClassifierintermediate
PyTorchMLPRegressoradvanced
PyTorchTransformerRegressoradvanced
LGBModelintermediate
XGBModelintermediate
DNNModeladvanced
ALSTMadvanced
TFTModeladvanced
GATsadvanced

How ML algorithms work together in a trading system

1
πŸ“Š

Market Data Input

Price, volume, indicators

OHLCV price data
Technical indicators
Feature engineering
2
🧠

ML Signal Generation

Model predictions

LightGBM/XGBoost regression
Transformer sequence modeling
MLP classification
3
πŸ“ˆ

Entry Decision

Signal threshold filtering

Confidence score > 0.6
Direction: Long/Short
4
πŸ“‰

Exit Strategy

Profit taking & stop loss

Take profit (fixed % or trailing)
Stop loss (ATR-based)
5
πŸ›‘οΈ

Risk Management

Position sizing & portfolio

Position sizing (Kelly criterion)
Portfolio rebalancing

Compare ML algorithms across key dimensions

Algorithm Comparison MatrixClick a column to expand details
Metric
LightGBMRegressorFreqtrade
LightGBMClassifierFreqtrade
XGBoostRegressorFreqtrade
XGBoostClassifierFreqtrade
PyTorchMLPRegressorFreqtrade
PyTorchTransformerRegressorFreqtrade
LGBModelQlib (Microsoft)
XGBModelQlib (Microsoft)
DNNModelQlib (Microsoft)
ALSTMQlib (Microsoft)
TFTModelQlib (Microsoft)
GATsQlib (Microsoft)
🎯Complexity⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced
πŸ“ˆPrediction TypeRegressionClassificationRegressionClassificationRegressionRegressionMixedMixedMixedSequenceMixedMixed
⚑Training Speed⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑⚑
🎯AccuracyπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“ŠπŸ“Š
πŸ’‘Best ForTabular dataTabular dataTabular dataTabular dataNon-linear patternsTime series patternsGeneral purposeGeneral purposeGeneral purposeSequential dataGeneral purposeGraph relationships
Complexity:

Freqtrade

LightGBMRegressor
Freqtrade
Machine Learningintermediate

Gradient boosting regression model for price movement prediction using LightGBM.

Source:freqtrade/freqai/prediction_models/LightGBMRegressor.py
LightGBMClassifier
Freqtrade
Machine Learningintermediate

LightGBM classification model for user-defined discrete labels.

Source:freqtrade/freqai/prediction_models/LightGBMClassifier.py
XGBoostRegressor
Freqtrade
Machine Learningintermediate

XGBoost-based regression model for continuous value prediction.

Source:freqtrade/freqai/prediction_models/XGBoostRegressor.py
XGBoostClassifier
Freqtrade
Machine Learningintermediate

XGBoost classification model for user-defined discrete labels.

Source:freqtrade/freqai/prediction_models/XGBoostClassifier.py
PyTorchMLPRegressor
Freqtrade
Machine Learningadvanced

Multi-layer perceptron neural network for regression-based price prediction.

Source:freqtrade/freqai/prediction_models/PyTorchMLPRegressor.py
PyTorchTransformerRegressor
Freqtrade
Machine Learningadvanced

Transformer architecture for time-series regression using self-attention mechanism.

Source:freqtrade/freqai/prediction_models/PyTorchTransformerRegressor.py

Qlib (Microsoft)

LGBModel
Qlib (Microsoft)
Machine Learningintermediate

LightGBM model for stock return prediction using technical and fundamental features.

Key Parameters
num_leaves31Maximum number of leaves
learning_rate0.1Boosting learning rate
Source:qlib/contrib/model/gbdt.py
XGBModel
Qlib (Microsoft)
Machine Learningintermediate

XGBoost model for stock return prediction.

Source:qlib/contrib/model/xgboost.py
DNNModel
Qlib (Microsoft)
Machine Learningadvanced

Deep neural network for nonlinear feature extraction and return prediction.

Key Parameters
hidden_size256Hidden layer size
Source:qlib/contrib/model/pytorch_nn.py
ALSTM
Qlib (Microsoft)
Machine Learningadvanced

Attention-based LSTM for sequential stock data modeling with attention mechanism.

Key Parameters
hidden_size64LSTM hidden size
num_layers2Number of LSTM layers
Source:qlib/contrib/model/pytorch_alstm.py
TFTModel
Qlib (Microsoft)
Machine Learningadvanced

Temporal Fusion Transformer combining static and temporal features for multi-horizon prediction.

Source:qlib/contrib/model/pytorch_tft.py
GATs
Qlib (Microsoft)
Machine Learningadvanced

Graph Attention Networks modeling stock relationships for cross-stock prediction.

Source:qlib/contrib/model/pytorch_gats.py

Machine Learning Trading Algorithms, Algorithm Reference

LightGBMRegressor (Freqtrade)
Gradient boosting regression model for price movement prediction using LightGBM. Source: https://github.com/freqtrade/freqtrade/blob/c0a991f5632cb900075ff2864b6671ed71a319d7/freqtrade/freqai/prediction_models/LightGBMRegressor.py.
LightGBMClassifier (Freqtrade)
LightGBM classification model for user-defined discrete labels. Source: https://github.com/freqtrade/freqtrade/blob/c0a991f5632cb900075ff2864b6671ed71a319d7/freqtrade/freqai/prediction_models/LightGBMClassifier.py.
XGBoostRegressor (Freqtrade)
XGBoost-based regression model for continuous value prediction. Source: https://github.com/freqtrade/freqtrade/blob/c0a991f5632cb900075ff2864b6671ed71a319d7/freqtrade/freqai/prediction_models/XGBoostRegressor.py.
XGBoostClassifier (Freqtrade)
XGBoost classification model for user-defined discrete labels. Source: https://github.com/freqtrade/freqtrade/blob/c0a991f5632cb900075ff2864b6671ed71a319d7/freqtrade/freqai/prediction_models/XGBoostClassifier.py.
PyTorchMLPRegressor (Freqtrade)
Multi-layer perceptron neural network for regression-based price prediction. Source: https://github.com/freqtrade/freqtrade/blob/c0a991f5632cb900075ff2864b6671ed71a319d7/freqtrade/freqai/prediction_models/PyTorchMLPRegressor.py.
PyTorchTransformerRegressor (Freqtrade)
Transformer architecture for time-series regression using self-attention mechanism. Source: https://github.com/freqtrade/freqtrade/blob/c0a991f5632cb900075ff2864b6671ed71a319d7/freqtrade/freqai/prediction_models/PyTorchTransformerRegressor.py.
LGBModel (Qlib (Microsoft))
LightGBM model for stock return prediction using technical and fundamental features. Key parameters: num_leaves (Maximum number of leaves), learning_rate (Boosting learning rate).Source: https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/gbdt.py.
XGBModel (Qlib (Microsoft))
XGBoost model for stock return prediction. Source: https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/xgboost.py.
DNNModel (Qlib (Microsoft))
Deep neural network for nonlinear feature extraction and return prediction. Key parameters: hidden_size (Hidden layer size).Source: https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_nn.py.
ALSTM (Qlib (Microsoft))
Attention-based LSTM for sequential stock data modeling with attention mechanism. Key parameters: hidden_size (LSTM hidden size), num_layers (Number of LSTM layers).Source: https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_alstm.py.
TFTModel (Qlib (Microsoft))
Temporal Fusion Transformer combining static and temporal features for multi-horizon prediction. Source: https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_tft.py.
GATs (Qlib (Microsoft))
Graph Attention Networks modeling stock relationships for cross-stock prediction. Source: https://github.com/microsoft/qlib/blob/main/qlib/contrib/model/pytorch_gats.py.