Polars Extension for Ta-Lib
Version 0.2.0 bundles TA-Lib 0.8.1: all 201 batch indicators, including SuperTrend, VWAP, HMA, KDJ and Heikin-Ashi. Python 3.10+; Polars 1.20+. Binary wheels include the C library.
- Upgrade notes, platform matrix and source builds
- Install the skill for Codex, Claude Code or Cursor
- Reproducible performance results
Native AI plugin installation
The repository supports the same native marketplace/install flow as Shioaji:
# Claude Code
claude plugin marketplace add Yvictor/polars_ta_extension
claude plugin install polars-talib@polars-ta-extension
# Codex
codex plugin marketplace add Yvictor/polars_ta_extension
codex plugin add polars-talib@polars-ta-extension
See skill installation for invocation, updates, local checkouts, standalone installation, and Cursor support. The plugin supplies coding guidance; install the Python library separately.
Getting Started
pip install 'polars-talib==0.2.0'
and
import polars
import polars_talib as plta
Usage
single symbol usage
df.with_columns(
pl.col("close").ta.ema(5).alias("ema5"),
pl.col("close").ta.macd(12, 26, 9).struct.field("macd"),
pl.col("close").ta.macd(12, 26, 9).struct.field("macdsignal"),
pl.col("open").ta.cdl2crows(pl.col("high"), pl.col("low"), pl.col("close")).alias("cdl2crows"),
pl.col("close").ta.wclprice("high", "low").alias("wclprice"),
)
typed namespace access
plta.col(...) returns the same .ta namespace with a static return type, so
editors and type checkers resolve every indicator method:
df.with_columns(
plta.col("close").ema(5).alias("ema5"),
plta.col(pl.col("close") * 2).rsi(14).alias("rsi_doubled"),
)
multiple symbol usage using over syntax
Sort by symbol and timestamp before computing history-dependent indicators.
df.with_columns(
pl.col("close").ta.ema(5).over("symbol").alias("ema5"),
pl.col("close").ta.macd(12, 26, 9).over("symbol").struct.field("macd"),
pl.col("close").ta.macd(12, 26, 9).over("symbol").struct.field("macdsignal"),
pl.col("open").ta.cdl2crows(
pl.col("high"), pl.col("low"), pl.col("close")
).over("symbol").alias("cdl2crows"),
pl.col("close").ta.wclprice("high", "low").over("symbol").alias("wclprice"),
)
usage just like talib.abstract with more flexible
df.with_columns(
plta.ht_dcperiod(),
plta.ht_dcperiod(pl.col("close")),
plta.aroon(),
plta.aroon(pl.col("high"), pl.col("low"), timeperiod=10),
plta.wclprice(),
plta.wclprice(
pl.col("high"), pl.col("low"), pl.col("close"),
timeperiod=10
),
)
Performance
See the 0.2.0 release benchmark for a controlled comparison against 0.1.6, raw samples and a reproducible script. The notebook comparison below is historical and measures a different workload.
Polars with polars_talib
%%timeit
df = p.with_columns(
plta.sma(timeperiod=5).over("Symbol").alias("sma5"),
plta.macd(fastperiod=10, slowperiod=20, signalperiod=5).over("Symbol").alias("macd"),
plta.stoch(pl.col("high"), pl.col("low"), pl.col("close"), fastk_period=14, slowk_period=7, slowd_period=7).over("Symbol").alias("stoch"),
plta.wclprice().over("Symbol").alias("wclprice"),
).with_columns(
pl.col("macd").struct.field("macd"),
pl.col("macd").struct.field("macdsignal"),
pl.col("macd").struct.field("macdhist"),
pl.col("stoch").struct.field("slowk"),
pl.col("stoch").struct.field("slowd"),
).select(
pl.exclude("stoch")
).filter(
pl.col("Symbol") == "AAPL"
).collect()
135 ms ± 5.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Pandas with talib
%%timeit
df["sma5"] = df.groupby("Ticker")["close"].transform(lambda x: ta.SMA(x, timeperiod=5))
df["macd"] = df.groupby("Ticker")["close"].transform(lambda x: ta.MACD(x, fastperiod=10, slowperiod=20, signalperiod=5)[0])
df["macdsignal"] = df.groupby("Ticker")["close"].transform(lambda x: ta.MACD(x, fastperiod=10, slowperiod=20, signalperiod=5)[1])
df["macdhist"] = df.groupby("Ticker")["close"].transform(lambda x: ta.MACD(x, fastperiod=10, slowperiod=20, signalperiod=5)[2])
df["slowk"] = df.groupby("Ticker").apply(lambda x: ta.STOCH(x, fastk_period=14, slowk_period=7, slowd_period=7)).droplevel(0)["slowk"]
df["slowd"] = df.groupby("Ticker").apply(lambda x: ta.STOCH(x, fastk_period=14, slowk_period=7, slowd_period=7)).droplevel(0)["slowd"]
df["wclprice"] = df.groupby("Ticker").apply(lambda x: ta.WCLPRICE(x)).droplevel(0)
df.loc["AAPL"]
19.2 s ± 367 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
That historical notebook measured about 150x for this workload; see basic.ipynb
Supported Indicators and Functions
import polars_talib as plta
# list of functions
plta.get_functions()
# dict of functions by group
plta.get_function_groups()
The complete 201-indicator catalog includes every function in the pinned upstream release. New examples:
df.with_columns(
plta.supertrend().alias("supertrend"),
plta.vwap().alias("vwap"),
pl.col("close").ta.hma(timeperiod=20).alias("hma"),
plta.kdj().alias("kdj"),
)
Multi-output indicators return Struct columns. For example,
plta.supertrend().struct.field("trend") returns the Int32 trend flag.
Metadata
Release files for polars-talib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| polars_talib-0.2.0.tar.gz | 2.8 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| polars_talib-0.2.0-cp310-abi3-win_arm64.whl | CPython 3.10 | abi3 | Windows ARM64 | Details |
| polars_talib-0.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| polars_talib-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| polars_talib-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| polars_talib-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| polars_talib-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| polars_talib-0.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| polars_talib-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 37.6 MB
Release files / polars_talib-0.2.0.tar.gz
| Download URL | polars_talib-0.2.0.tar.gz |
|---|---|
| Size | 2.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0018d40bdab4b5f9e5a2e83f0d2f19b74c4868a5a33ea6548ca3ee1e5991558e
|
|
BLAKE2b-256 checksum How to use checksums |
d89763cf39dc9a7f083d5e1ed0dce395079ba0df3baa6fb3834c03f0beb2b5ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-win_arm64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5e77108760dad2b14dc633d9269957fb808195d851150557346933ee15c9b678
|
|
BLAKE2b-256 checksum How to use checksums |
8de05e7b17bce143b621e82e916e0ef8f916af8302c900af9694502ef1aa6b8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
049631dd43585791f1d35c324874d162f1d1b8ecaedc7ddda464181d4303b987
|
|
BLAKE2b-256 checksum How to use checksums |
fc0d28f4508f8c7f69dcd735ab7c8a4cab7b073b57868d23d6ac044b78b2f87e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
54c8d8358bceb7e984492ccdc2b0e62816f94c154e6775d07cdb745c0d09dd07
|
|
BLAKE2b-256 checksum How to use checksums |
a8f0ddfcfed977d0b51210a14ea91784fb0aa3b6e8455ad005bc517c987f2808
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
15665888ab2dcd4d5de56a9cad70fff9b9fef2cfefb84f94ecca3cf8db795261
|
|
BLAKE2b-256 checksum How to use checksums |
eb417845607e7303839b49fee30b7fe8cda173a9488f8c8aee6899e0101da7e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1aeec0930827ebec9321f0c23028cc9223fa90ad18dd9dc2c9f189c04b07c293
|
|
BLAKE2b-256 checksum How to use checksums |
5e9f809952e54263342328158bc4eb82c4ff7252a32ad39a18d2af15f7b67d77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0b6e45f6431d35296c9d5755f7f13ad25c6e1d762d8deeb656f429c1f00c2759
|
|
BLAKE2b-256 checksum How to use checksums |
84660e268e4fa3a3cb64293bad85c80ad8d8845b36cbba2cd5b3959db4aa396d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c8dba0ce264c28c8f5ea8612a32f44ace647fcae851624b242c906b1e101b973
|
|
BLAKE2b-256 checksum How to use checksums |
31aa7eb29a3dc60a1a303b1797c3bde656bcb026527324c4e4f40b4f3e13f35a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / polars_talib-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | polars_talib-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
fc2ef3926002f0510d3732e3d8bd24b612c885ec0b51afc18afedd209f8ac3c1
|
|
BLAKE2b-256 checksum How to use checksums |
472def8fe10856b9c88b49c6b2e3c63ceb9acacc6fe41f0f29ba370a08517e76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|