2026-03-03 22:11:35 -08:00
# quantalib
2026-02-28 14:14:35 -08:00
2026-03-03 22:11:35 -08:00
[](https://pypi.org/project/quantalib/)
[](https://pypi.org/project/quantalib/)
[](https://github.com/mihakralj/quantalib/blob/main/LICENSE)
2026-02-28 14:14:35 -08:00
2026-09-25 13:44:00 -07:00
447 technical analysis indicators compiled to native code via .NET NativeAOT, called from Python through `ctypes` . Same SIMD-accelerated engine as the [QuanTAlib ](https://github.com/mihakralj/quantalib ) .NET package. Zero Python math reimplementation.
2026-02-28 14:14:35 -08:00
2026-03-01 21:35:19 -08:00
```bash
pip install quantalib
```
2026-02-28 14:14:35 -08:00
2026-03-01 21:35:19 -08:00
## Quick Start
2026-02-28 14:14:35 -08:00
2026-03-01 21:35:19 -08:00
```python
import numpy as np
import quantalib as qtl
2026-02-28 14:14:35 -08:00
2026-03-03 22:11:35 -08:00
close = np . random . default_rng ( 42 ) . normal ( 100 , 2 , size = 500 )
2026-03-01 21:35:19 -08:00
2026-03-03 22:11:35 -08:00
sma = qtl . sma ( close , period = 20 )
rsi = qtl . rsi ( close , period = 14 )
upper , mid , lower = qtl . bbands ( close , period = 20 , std = 2.0 )
```
2026-03-01 21:35:19 -08:00
2026-03-03 22:11:35 -08:00
Works with **pandas** , **polars** , and **pyarrow** — same-type-in, same-type-out:
2026-03-01 21:35:19 -08:00
2026-03-03 22:11:35 -08:00
```python
# pandas — preserves index
2026-03-01 21:35:19 -08:00
import pandas as pd
s = pd . Series ( close , name = "close" )
2026-03-03 22:11:35 -08:00
rsi = qtl . rsi ( s , period = 14 ) # → pd.Series
# polars — zero-copy-friendly
import polars as pl
s = pl . Series ( "close" , close )
rsi = qtl . rsi ( s , period = 14 ) # → pl.Series
bb = qtl . bbands ( s , period = 20 ) # → pl.DataFrame (upper, mid, lower)
# pyarrow — for Arrow-native pipelines
import pyarrow as pa
a = pa . array ( close , type = pa . float64 ())
rsi = qtl . rsi ( a , period = 14 ) # → pa.Array
2026-03-01 21:35:19 -08:00
```
2026-03-03 22:11:35 -08:00
> **pandas-ta users:** `length=` is accepted everywhere as an alias for `period=`.
Install optional backends:
```bash
pip install quantalib[ pandas] # pandas / pd.Series support
pip install quantalib[ polars] # polars / pl.Series support
pip install quantalib[ pyarrow] # pyarrow / pa.Array support
pip install quantalib[ all] # all three
```
2026-09-27 16:28:10 -07:00
## Performance (500,000 bars)
2026-03-03 22:11:35 -08:00
2026-09-27 16:28:10 -07:00
| Indicator | quantalib | wickra | pandas-ta |
| --------- | --------: | -----: | --------: |
| SMA | 1,298 μs | 12,548 μs | 63,721 μs |
| EMA | 1,067 μs | 12,179 μs | 4,280 μs |
| WMA | 1,139 μs | 12,547 μs | 83,903 μs |
| HMA | 2,647 μs | 14,768 μs | 152,733 μs |
2026-03-03 22:11:35 -08:00
2026-09-27 16:28:10 -07:00
quantalib calls the same SIMD-optimized NativeAOT core as the .NET package through a single `ctypes` call (5-15 μs overhead). wickra (Rust/PyO3) returns stdlib `array.array` ; pandas-ta stays in pure Python/numpy. For arrays above a few hundred bars, NativeAOT wins by an order of magnitude or more.
2026-03-03 22:11:35 -08:00
2026-03-01 21:35:19 -08:00
## Categories
| Category | Module | Examples |
2026-03-03 22:11:35 -08:00
| -------- | ------ | -------- |
2026-03-16 12:45:13 -07:00
| Channels | `channels` | bbands, kc, dc, aberr |
2026-03-01 21:35:19 -08:00
| Core | `core` | ha, midpoint, avgprice, typprice |
| Cycles | `cycles` | ht_dcperiod, ht_sine, cg, dsp |
| Dynamics | `dynamics` | adx, aroon, ichimoku, supertrend |
| Errors | `errors` | mse, rmse, mae, mape, huber |
| Filters | `filters` | kalman, sgf, hp, butter2, wavelet |
| Momentum | `momentum` | rsi, macd, roc, mom, tsi |
| Numerics | `numerics` | fft, normalize, sigmoid, slope |
| Oscillators | `oscillators` | stoch, cci, fisher, qqe, willr |
2026-03-16 12:45:13 -07:00
| Reversals | `reversals` | sar, pivot, fractals, swings |
| Statistics | `statistics` | zscore, correl, entropy, linreg |
2026-03-01 21:35:19 -08:00
| Trends FIR | `trends_fir` | sma, wma, hma, alma, trima |
| Trends IIR | `trends_iir` | ema, dema, tema, kama, jma |
| Volatility | `volatility` | atr, bbw, stddev, hv, tr |
| Volume | `volume` | obv, vwma, mfi, cmf, adl |
2026-03-03 22:11:35 -08:00
## Requirements
2026-03-01 21:35:19 -08:00
2026-03-03 22:11:35 -08:00
- Python 3.10+
- NumPy >= 1.24
2026-09-27 16:28:10 -07:00
Pre-built wheels — the NativeAOT core is compiled per platform in CI and ships inside the wheel, so there is no source build and no C++ toolchain:
| Platform | Wheel tag |
| --- | --- |
| Windows x64 | `win_amd64` |
| Linux x64 | `manylinux_2_17_x86_64` |
| Linux arm64 (AWS Graviton) | `manylinux_2_17_aarch64` |
| macOS arm64 (Apple Silicon) | `macosx_11_0_arm64` |
| macOS x64 (Intel) | `macosx_10_13_x86_64` |
2026-03-01 21:35:19 -08:00
2026-03-03 22:11:35 -08:00
### Optional dependencies
2026-03-01 21:35:19 -08:00
2026-03-03 22:11:35 -08:00
| Extra | Minimum version | Enables |
| ----- | --------------- | ------- |
| `pandas` | ≥ 1.5 | `pd.Series` / `pd.DataFrame` round-trip |
| `polars` | ≥ 0.20 | `pl.Series` / `pl.DataFrame` round-trip |
| `pyarrow` | ≥ 14.0 | `pa.Array` / `pa.ChunkedArray` round-trip |
2026-03-01 21:35:19 -08:00
## License
feat: add new indicators (Decay, Edecay, MinusDi, MinusDm, PlusDi, PlusDm, Maxindex, Minindex, Sarext) and update pine scripts, core libs, validation tests, and python bindings
2026-03-09 13:45:46 -07:00
[Apache License 2.0 ](https://github.com/mihakralj/quantalib/blob/main/LICENSE )