4.2k stars · BSD-3-Clause · v1.14.1 (2026-02-08) · Track this in Scout
Matrix profile — finds every repeating shape and every anomaly in a long time series without being told what to look for.
▶Repo detailsthe review · specs · pros & cons
What it is
It computes the matrix profile of a time series, which finds every repeated shape (motif) and every anomaly (discord) in a long series — without you specifying what to look for. It scales to millions of points using Numba, multiprocessing or Dask.
What it is good for. Anyone hunting a repeatable entry signal usually attacks the problem by guessing indicator combinations. This inverts it: the data tells you which price shapes actually recur, and each discovered motif becomes a candidate entry signal you can hand straight to a backtester. stumpy.match() then detects that same shape on live bars. It is the difference between searching and hunting.
- Finds patterns with no labels, no training, no ML expertise required
- BSD-3 — no restriction on shipping it inside a commercial product
- Well documented, with finance-flavoured tutorials and a real maintainer team
- Memory and CPU scale with series length — three years of M1 data is roughly a million points and will need chunking
- Raw motifs are not strategies. Most repeating shapes have no forward edge, so expect heavy filtering
- Choosing the window length is a judgement call that changes everything downstream
Pair with kernc/backtesting.py to test each surviving motif.
