kernc/backtesting.py

AlgoScore
73
Use it
★9.4k
Forks1.6k
Issues+PR118
Push4 mo
LicenseAGPL-3.0

Editorial verdict Use itchecked 05.12.2026

What it is good at

A strategy is a class with two methods: init() declares indicators and next() makes a decision on every bar. You pass a DataFrame of OHLCV candles and get back about thirty metrics (return, CAGR, Sharpe, Sortino, Calmar, max drawdown, profit factor, SQN, Kelly criterion), a trade table and an interactive chart with entries and exits. A SAMBO-based parameter optimizer is built in, along with a small library of base strategies and helpers like crossover. Indicators are bring-your-own: plain functions, TA-Lib or pandas-ta all work. The codebase is small enough to read in an evening, so you can see exactly how orders, stops and commissions are handled. Release 0.6.6 fixed CAGR and annualized return calculations and made trade plotting roughly nine times faster.

Weak spots

The AGPL-3.0 license means that embedding it in a network service obliges you to publish that service's source, which rules it out for many commercial uses. One Backtest handles one instrument, so a multi-coin portfolio is not supported out of the box; MultiBacktest only runs the same strategy over separate series. Order sizes are rounded to whole units, so fractional crypto sizes need FractionalBacktest. An issue about look-ahead bias in the TrailingStrategy ATR has been open since 2023. The last release, 0.6.6, shipped in July 2026; master has been quiet since August while pull requests for order expiry and intrabar margin calls wait for review.

Who it is for

Newcomers to algorithmic trading who want to test an idea on a single asset with clear bar-by-bar logic. Good for learning and for prototyping before moving a strategy into a heavier framework or a live bot.

Versus alternatives

Its API and docs are simpler than vectorbt or backtrader, and the default report is easier to read. It loses to vectorbt on sweep speed and multi-asset work, and to backtrader on order types and broker modelling, though backtrader has not been updated since August 2024. The licenses restrict in different ways: the Commons Clause on vectorbt bans selling the engine itself, while AGPL here requires opening your service code.

  • Latest release 0.6.6 — 22 Jul 2026 (tag and CHANGELOG, no GitHub Releases)
  • Last commit on master — 5 Aug 2026
  • License: AGPL-3.0
  • SAMBO-based parameter optimizer
  • Install: pip install backtesting

Stars by day

Our star series started 05.12.2026: the chart appears after the second snapshot.

GitHub dataGitHub ↗

TopicAlgo trading & backtesting
LanguagePython
Created02.01.2019
Last release22.07.2026
Releases / tags0 / 27
Contributors46
Commits total / 90d461 / 0
Watchers119

AlgoScore breakdownmethodology →

Popularity16.6/20
Freshness7.2/20
Community15.7/20
Maturity15/15
Momentum—
Usage—

Topic neighboursAlgo trading & backtesting →

#RepositoryAlgoScore★30d growthPushLabel
1 nautechsystems/nautilus_traderProduction-grade Rust-native trading engine with deterministic event-driven architecture 90 32k — today Use it
2 vnpy/vnpy基于Python的开源量化交易平台开发框架 87 47k — 24 d
3 coding-kitties/investing-algorithm-frameworkFramework for quantitative trading. Complete framework for development, backtesting, and deploying automated trading algorithms and trading bots. 87 2.3k — 1 d
4 microsoft/qlibQlib is an AI-oriented Quant investment platform that aims to use AI tech to empower Quant Research, from exploring ideas to implementing productions. Qlib supports diverse ML modeling paradigms, including supervised learning, market dynamics modeling, and RL, and is now equipped with https://github 85 51k — today For research
5 QuantConnect/LeanLean Algorithmic Trading Engine by QuantConnect (Python, C#) 85 23k — today Use it
6 pst-group/pysystemtradeSystematic Trading in python 85 3.7k — 33 d
7 stefan-jansen/machine-learning-for-tradingCode for Machine Learning for Trading, 3rd edition — from data sourcing to live execution. 84 22k — today
8 polakowo/vectorbtThe research engine that gives you an unfair advantage. Run thousands of trading ideas before others finish one. 84 10k — 6 d Use it