Minimal Technical Analysis Library for Python
This package offers a curated list of technical analysis indicators implemented in Cython for optimal performance. The library is built around numpy arrays and integrates with pandas DataFrames and Series.
[!NOTE] This project is experimental and the interface can change.
Interfaces
Mintalib offers two interfaces for different workflows:
- Functions (
mintalib.functions) — concrete functions for arrays and pandas objects. - Indicators (
mintalib.indicators) — pandas-only composable indicators that bind an indicator with its calculation parameters.
Conventions
Prices DataFrames are expected to have lower case column names open, high, low, close, volume. If your DataFrame has different column name capitalization you can use the normalize_prices utility function to normalize the column names.
from mintalib.utils import normalize_prices
prices = normalize_prices(rawprices)
Functions
Concrete functions are available from the mintalib.functions module with names in lower case like sma, atr, macd, etc.
Functions accept NumPy arrays, pandas Series, or pandas DataFrames as appropriate.
The first parameter of a function is either prices or series depending on whether
the function expects a dataframe of prices or a single series.
import mintalib.functions as ta
prices = ... # pandas DataFrame
sma = ta.sma(prices['close'], 50)
atr = ta.atr(prices, 14)
Composable Indicators
For workflows that benefit from reusable or chained calculations, mintalib.indicators binds a function and its parameters into a callable object.
Indicators work with pandas DataFrames and Series. They are callable, and chain with | or the equivalent .then() method.
from mintalib.indicators import SMA, EMA, ROC, RSI, MACD
prices = ... # pandas DataFrame
result = prices.assign(
ema20 = EMA(20),
rsi = RSI(14),
trend = EMA(20) | ROC(1)
)
Function Reference
abs(series) |
Absolute Value |
adx(prices, period=14) |
Average Directional Index |
alma(series, period=9, offset=0.85, sigma=6.0) |
Arnaud Legoux Moving Average |
atr(prices, period=14) |
Average True Range |
avgprice(prices) |
Average Price |
bbands(series, period=20, nbdev=2.0) |
Bollinger Bands |
bbp(series, period=20, nbdev=2.0) |
Bollinger Bands Percent (%B) |
bbw(series, period=20, nbdev=2.0) |
Bollinger Bands Width |
bop(prices) |
Balance of Power |
cci(prices, period=20) |
Commodity Channel Index |
clag(series, period=1) |
Confirmation Lag |
cmf(prices, period=20) |
Chaikin Money Flow |
crossover(series, level=0.0) |
Cross Over |
crossunder(series, level=0.0) |
Cross Under |
dema(series, period) |
Double Exponential Moving Average |
diff(series, period=1) |
Difference |
dmi(prices, period=14) |
Directional Movement Indicator |
donchian(prices, period=20) |
Donchian Channel |
ema(series, period, *, adjust=False) |
Exponential Moving Average |
exp(series) |
Exponential |
flag(series) |
Flag Value |
hma(series, period) |
Hull Moving Average |
kama(series, period=10, fastn=2, slown=30) |
Kaufman Adaptive Moving Average |
keltner(prices, period=20, nbatr=2.0) |
Keltner Channel |
ker(series, period=10) |
Kaufman Efficiency Ratio |
lag(series, period) |
Lag Function |
linreg(series, period=20, offset=0) |
Linear Regression (least squares moving average) |
linreg_rmse(series, period=20) |
Linear Regression Root Mean Square Error |
linreg_rvalue(series, period=20) |
Linear Regression R-Value |
linreg_slope(series, period=20) |
Linear Regression Slope |
log(series) |
Logarithm |
lroc(series, period=1) |
Logarithmic Rate of Change |
macd(series, n1=12, n2=26, n3=9) |
Moving Average Convergence Divergence |
macdv(prices, n1=12, n2=26, n3=9) |
Moving Average Convergence Divergence - Volatility Normalized |
mad(series, period=14) |
Rolling Mean Absolute Deviation |
mav(series, period=20, *, matype='sma') |
Generic Moving Average |
max(series, period) |
Rolling Maximum |
mdi(prices, period=14) |
Minus Directional Index |
medprice(prices) |
Median Price |
mfi(prices, period=14) |
Money Flow Index |
min(series, period) |
Rolling Minimum |
natr(prices, period=14) |
Normalized Average True Range |
pdi(prices, period=14) |
Plus Directional Index |
ppo(series, n1=12, n2=26, n3=9) |
Price Percentage Oscillator |
price(prices, item=None) |
Generic Price |
quadreg(series, period=20, offset=0) |
Quadratic Regression (parabolic moving average) |
quadreg_curve(series, period=20) |
Quadratic Regression Curve |
quadreg_rmse(series, period=20) |
Quadratic Regression Root Mean Square Error |
quadreg_rvalue(series, period=20) |
Quadratic Regression R-Value |
quadreg_slope(series, period=20, offset=0) |
Quadratic Regression Slope |
rma(series, period) |
Rolling Moving Average (RSI style) |
roc(series, period=1) |
Rate of Change |
rocp(series, period=1) |
Rate of Change Percentage |
rsi(series, period=14) |
Relative Strength Index |
sar(prices, afs=0.02, maxaf=0.2) |
Parabolic Stop and Reverse |
sign(series) |
Sign |
sma(series, period) |
Simple Moving Average |
stdev(series, period=20) |
Standard Deviation |
step(series, threshold=1.0) |
Step Function |
stoch(prices, period=14, fastn=3, slown=3) |
Stochastic Oscillator |
streak(series) |
Consecutive streak of values above zero |
sum(series, period) |
Rolling sum |
tema(series, period=20) |
Triple Exponential Moving Average |
trange(prices, *, log_prices=False, percent=False) |
True Range |
typprice(prices) |
Typical Price |
updown(series, up_level=0.0, down_level=0.0) |
Flag for value crossing up & down levels |
wclprice(prices) |
Weighted Close Price |
wma(series, period) |
Weighted Moving Average |
zlema(series, period) |
Zero-Lag Exponential Moving Average |
Example Notebooks
Example notebooks are available in the examples folder.
Installation
pip install mintalib
Mintalib requires Python 3.11 or newer. The base install includes only NumPy; add pandas to use the indicator interface or pandas objects.
Dependencies
- python >= 3.11
- numpy
- pandas [optional]
Related Projects
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mintalib-0.1.7.tar.gz.
File metadata
- Download URL: mintalib-0.1.7.tar.gz
- Upload date:
- Size: 848.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7ae4dbe099f3ab89f630ce68ba50d4c33cfa067aae1e2706cf024f9778e2da0
|
|
| MD5 |
419e517f1efe8166a7ceef6847426c91
|
|
| BLAKE2b-256 |
156b359ff4ae93754c0a06a04aa50a82f288149afc8fcc3e8c8e2f0b24651989
|
File details
Details for the file mintalib-0.1.7-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: mintalib-0.1.7-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3893daf122c80b2efd04aa53a1e76adb6149fcf8fd7d1a693f5507441c680264
|
|
| MD5 |
6cfd1d70477cf8478ba916a269ca6dd0
|
|
| BLAKE2b-256 |
ca93e375791688b525d803821bfde08d19ed7ea42dbb6a2004e62abeeb199e46
|
File details
Details for the file mintalib-0.1.7-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: mintalib-0.1.7-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e4067ca8b878602fd0332e6098541515682d2b4663ee0dc68706186715d688d
|
|
| MD5 |
cd2f33fb6a1a7129ce1a9372dc196fed
|
|
| BLAKE2b-256 |
d2ef0939fe297f468b8df985bdf0defdcd96adcd1cd00bca5557e9ad89230c2b
|
File details
Details for the file mintalib-0.1.7-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: mintalib-0.1.7-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b4e444f269854aab488e5d17af4884677575d99f9ec4ab537c258189795da9c
|
|
| MD5 |
74eaa6088039d81094e05c59aebbe84d
|
|
| BLAKE2b-256 |
ee5860f7c67189a3ee9fca435f456207e922e51c42f89a16f1db522af3611bdf
|
File details
Details for the file mintalib-0.1.7-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: mintalib-0.1.7-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f281f9a35a5063c66cb41a4ecee1f7e118561d49ed9bf9267e530587a3a4c0
|
|
| MD5 |
7045bfbcd2af431c27a4073467f8e7fe
|
|
| BLAKE2b-256 |
7568fd123c8a1672c29645e5f361196a0691a7d271fd15aae635182fcec17b9f
|
File details
Details for the file mintalib-0.1.7-cp311-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: mintalib-0.1.7-cp311-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01ef5d69edce83baee3ff21879c42fe2ea5614f4e586a61928cdf9ad6aaf3846
|
|
| MD5 |
be6f5ff4f5914ce4b9a4924d9ad0776c
|
|
| BLAKE2b-256 |
00d405b9a550832306c9574ceb6a546be0573aa66146bd3b583aa394ed6e60df
|