TradeBot Check
Trading involves a risk of losing money. Nothing on this site is financial advice and past results do not guarantee future results. Risk disclosure
Backtesting

skfolio

Python library for portfolio optimization and risk management built on scikit-learn, with cross-validation tools to test portfolio models on walk-forward and purged splits.

skfolio/skfolio★ 2,697 stars last commit 2026-12-04
Our take

Build, tune and cross-validate portfolio models with the same scikit-learn tools many Python users already know.

Who it is for

Python users and students who know scikit-learn and want to compare portfolio-construction methods with proper out-of-sample validation, for research and education.

Strengths

  • Follows the scikit-learn API, so it works with Pipeline, GridSearchCV and KFold.
  • Naive, mean-risk, risk-budgeting and clustering models such as hierarchical risk parity, plus ensemble stacking.
  • Walk-forward and combinatorial purged cross-validation to test models out of sample.
  • Constraints on weights, turnover, transaction costs and cardinality; installs with pip install -U skfolio.

Good to know

  • Needs Python 3.10 or later and some familiarity with scikit-learn and portfolio theory.
  • Results depend on the data and assumptions you provide; past data does not predict future returns.
  • A library, not a trading bot: it does not connect to brokers or place orders.
  • Any example is illustrative and never a promise of returns.

Custom bots are coming soon
We are preparing a service to build bots on tools like this one. Follow our Telegram channel to know when it opens.

Notify me

Real-life uses

Out-of-sample check for a portfolio idea

Before trusting a portfolio rule, run it with walk-forward splits so each period is tested on data the model has not seen, and compare the result with a simple equal-weight baseline. Illustrative only, never a promise of returns.

🧪 Walk-forward test done: 5 splits, rule beat equal-weight in 3 of 5 (example figures).
Built with:skfolioyfinance

Compare it with others

Guides that use it

Quick answers

How much does skfolio cost?

Free and open source (BSD-3-Clause). Prices change, so check the official website before you decide.

Is skfolio open source?

Yes. License: BSD-3-Clause.

Who is skfolio for?

Python users and students who know scikit-learn and want to compare portfolio-construction methods with proper out-of-sample validation, for research and education.

What is skfolio written in?

skfolio is written in Python.

What should I know before using skfolio?

Needs Python 3.10 or later and some familiarity with scikit-learn and portfolio theory. Results depend on the data and assumptions you provide; past data does not predict future returns. A library, not a trading bot: it does not connect to brokers or place orders. Any example is illustrative and never a promise of returns.

Want a bot like this when custom bots open? Get notified · All comparisons · Guides

Sources

Every fact on this page comes from these sources, checked on 2026-11-14. If something has changed, the source wins.

  1. https://github.com/skfolio/skfolio: purpose, optimization models, cross-validation, scikit-learn compatibility, constraints, pip install, Python 3.10+, BSD-3-Clause
  2. https://api.github.com/repos/skfolio/skfolio: BSD-3-Clause, about 2,600 stars, last push 2026-11-13, not archived

Alternatives in Backtesting