StratCraft
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.

13 algorithms2 libraries

How ML algorithms connect across libraries

🧠ML Algorithms
🤖
Freqtrade9 algos
🔬
Microsoft Qlib6 algos
LightGBMRegressorintermediate
LightGBMClassifierintermediate
XGBoostRegressorintermediate
XGBoostClassifierintermediate
CatboostRegressorintermediate
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
CatboostRegressorFreqtrade
PyTorchMLPRegressorFreqtrade
PyTorchTransformerRegressorFreqtrade
LGBModelQlib (Microsoft)
XGBModelQlib (Microsoft)
DNNModelQlib (Microsoft)
ALSTMQlib (Microsoft)
TFTModelQlib (Microsoft)
GATsQlib (Microsoft)
🎯Complexity⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced⭐⭐⭐intermediate⭐⭐⭐intermediate⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced⭐⭐⭐⭐advanced
📈Prediction TypeRegressionClassificationRegressionClassificationRegressionRegressionRegressionMixedMixedMixedSequenceMixedMixed
Training Speed⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡
🎯Accuracy📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊📊
💡Best ForTabular dataTabular dataTabular dataTabular dataGeneral purposeNon-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.

Speed⚡⚡⚡
Accuracy📊📊📊
Key Parameters
n_estimators1000Number of boosting rounds
learning_rate0.01Step size shrinkage
Source:freqai/prediction_models/LightGBMRegressor.py
LightGBMClassifier
Freqtrade
Machine Learningintermediate

Gradient boosting classification model for directional prediction (up/down/neutral).

Speed⚡⚡⚡
Accuracy📊📊📊
Key Parameters
n_estimators1000Number of boosting rounds
Source:freqai/prediction_models/LightGBMClassifier.py
XGBoostRegressor
Freqtrade
Machine Learningintermediate

XGBoost-based regression model for continuous value prediction.

Speed⚡⚡⚡
Accuracy📊📊📊
Key Parameters
n_estimators1000Number of boosting rounds
max_depth6Maximum tree depth
Source:freqai/prediction_models/XGBoostRegressor.py
XGBoostClassifier
Freqtrade
Machine Learningintermediate

XGBoost-based classification model for directional prediction.

Speed⚡⚡⚡
Accuracy📊📊📊
Key Parameters
n_estimators1000Number of boosting rounds
Source:freqai/prediction_models/XGBoostClassifier.py
CatboostRegressor
Freqtrade
Machine Learningintermediate

CatBoost gradient boosting model with native categorical feature support.

Speed⚡⚡
Accuracy📊📊📊
Key Parameters
iterations1000Number of boosting iterations
Source:freqai/prediction_models/CatboostRegressor.py
PyTorchMLPRegressor
Freqtrade
Machine Learningadvanced

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

Speed⚡⚡
Accuracy📊📊📊
Key Parameters
hidden_dim128Hidden layer dimension
dropout_percent0.2Dropout rate
Source:freqai/prediction_models/PyTorchMLPRegressor.py
PyTorchTransformerRegressor
Freqtrade
Machine Learningadvanced

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

Speed
Accuracy📊📊📊📊
Key Parameters
num_heads8Number of attention heads
num_layers2Number of transformer layers
Source:freqai/prediction_models/PyTorchTransformerRegressor.py

Qlib (Microsoft)

LGBModel
Qlib (Microsoft)
Machine Learningintermediate

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

Speed⚡⚡
Accuracy📊📊📊
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.

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

Deep neural network for nonlinear feature extraction and return prediction.

Speed⚡⚡
Accuracy📊📊📊
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.

Speed
Accuracy📊📊📊
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.

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

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

Speed⚡⚡
Accuracy📊📊📊
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. Key parameters: n_estimators (Number of boosting rounds), learning_rate (Step size shrinkage). Source: https://github.com/freqtrade/freqtrade/blob/develop/freqai/prediction_models/LightGBMRegressor.py.
LightGBMClassifier (Freqtrade)
Gradient boosting classification model for directional prediction (up/down/neutral). Key parameters: n_estimators (Number of boosting rounds). Source: https://github.com/freqtrade/freqtrade/blob/develop/freqai/prediction_models/LightGBMClassifier.py.
XGBoostRegressor (Freqtrade)
XGBoost-based regression model for continuous value prediction. Key parameters: n_estimators (Number of boosting rounds), max_depth (Maximum tree depth). Source: https://github.com/freqtrade/freqtrade/blob/develop/freqai/prediction_models/XGBoostRegressor.py.
XGBoostClassifier (Freqtrade)
XGBoost-based classification model for directional prediction. Key parameters: n_estimators (Number of boosting rounds). Source: https://github.com/freqtrade/freqtrade/blob/develop/freqai/prediction_models/XGBoostClassifier.py.
CatboostRegressor (Freqtrade)
CatBoost gradient boosting model with native categorical feature support. Key parameters: iterations (Number of boosting iterations). Source: https://github.com/freqtrade/freqtrade/blob/develop/freqai/prediction_models/CatboostRegressor.py.
PyTorchMLPRegressor (Freqtrade)
Multi-layer perceptron neural network for regression-based price prediction. Key parameters: hidden_dim (Hidden layer dimension), dropout_percent (Dropout rate). Source: https://github.com/freqtrade/freqtrade/blob/develop/freqai/prediction_models/PyTorchMLPRegressor.py.
PyTorchTransformerRegressor (Freqtrade)
Transformer architecture for time-series regression using self-attention mechanism. Key parameters: num_heads (Number of attention heads), num_layers (Number of transformer layers). Source: https://github.com/freqtrade/freqtrade/blob/develop/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.