Skip to main content

NumPy-based Technical Analysis library with focus on performance

Project description

numta logo

numta

Documentation Tests

Pure Python technical analysis library. A modern, high-performance alternative to TA-Lib with zero C dependencies.

๐Ÿ“– Documentation | ๐Ÿš€ Quick Start | ๐Ÿ“š API Reference

Highlights

  • Pure Python: No C compiler required, works everywhere Python runs
  • Fast: 5-10x speedup with optional Numba JIT compilation
  • GPU Batch Processing: Run any indicator on 26K+ tickers simultaneously with CUDA
  • Complete: 130+ indicators, 60+ candlestick patterns, chart pattern detection
  • Modern: Pandas integration, streaming support, Jupyter visualization

Installation

# Basic installation
pip install numta

# With Numba for 5-10x speedup
pip install "numta[numba]"

# With GPU batch processing (NVIDIA CUDA)
pip install "numta[gpu]"

# With pandas integration
pip install "numta[pandas]"

# Full installation with all features
pip install "numta[full]"

# From source
git clone https://github.com/deepentropy/numta.git
cd numta
pip install -e .

Quick Start

import numpy as np
from numta import SMA, EMA, RSI

# Create sample price data
close_prices = np.random.uniform(100, 200, 100)

# Calculate indicators
sma = SMA(close_prices, timeperiod=20)
ema = EMA(close_prices, timeperiod=12)
rsi = RSI(close_prices, timeperiod=14)

Features

Technical Indicators

numta provides 130+ technical indicators across multiple categories:

  • Overlap Studies: SMA, EMA, DEMA, TEMA, WMA, BBANDS, KAMA, MAMA, T3, SAR
  • Momentum: RSI, MACD, STOCH, ADX, CCI, MFI, ROC, MOM, WILLR
  • Volume: OBV, AD, ADOSC
  • Volatility: ATR, NATR, TRANGE
  • Cycle: Hilbert Transform functions
  • Statistical: LINEARREG, STDDEV, VAR, CORREL, BETA

See FUNCTION_IMPLEMENTATIONS.md for the complete list.

Pandas Integration

import pandas as pd
import numta  # Auto-registers the .ta accessor

df = pd.DataFrame({
    'open': [...], 'high': [...], 'low': [...],
    'close': [...], 'volume': [...]
})

# Calculate and return as Series
sma = df.ta.sma(timeperiod=20)

# Append indicators to DataFrame
df.ta.sma(timeperiod=20, append=True)   # Adds 'SMA_20'
df.ta.rsi(timeperiod=14, append=True)   # Adds 'RSI_14'
df.ta.macd(append=True)                 # Adds MACD columns

Pattern Recognition

Candlestick Patterns

from numta import CDLDOJI, CDLENGULFING, CDLHAMMER

# Returns +100 (bullish), -100 (bearish), or 0 (no pattern)
doji = CDLDOJI(open_, high, low, close)
engulfing = CDLENGULFING(open_, high, low, close)

# Via pandas accessor
df.ta.cdldoji(append=True)
df.ta.cdlengulfing(append=True)

Chart Patterns

from numta import (
    detect_head_shoulders, detect_double_top,
    detect_triangle, detect_wedge, detect_flag
)

# Detect patterns with confidence scores
patterns = detect_head_shoulders(highs, lows, order=5)

# Via pandas accessor
patterns = df.ta.find_patterns(pattern_type='all')
harmonics = df.ta.find_harmonic_patterns()

GPU Batch Processing

Process thousands of tickers simultaneously on NVIDIA GPUs:

import numpy as np
from numta import SMA_batch, RSI_batch, CDLDOJI_batch

# 2D arrays: (num_tickers, num_bars)
close = np.random.uniform(50, 150, (10000, 500))
high = close + np.random.uniform(0, 5, (10000, 500))
low = close - np.random.uniform(0, 5, (10000, 500))
open_ = close + np.random.uniform(-2, 2, (10000, 500))

# Run on all 10,000 tickers at once โ€” one CUDA thread per ticker
sma = SMA_batch(close, timeperiod=20)        # shape: (10000, 500)
rsi = RSI_batch(close, timeperiod=14)        # shape: (10000, 500)
doji = CDLDOJI_batch(open_, high, low, close) # shape: (10000, 500)

All 128 batch functions (*_batch) mirror the CPU API exactly โ€” same parameters, same output values. Requires an NVIDIA GPU with CUDA support.

Streaming/Real-Time

from numta.streaming import StreamingSMA, StreamingRSI, StreamingMACD

# Create streaming indicators
sma = StreamingSMA(timeperiod=20)
rsi = StreamingRSI(timeperiod=14)

# Process streaming data
for price in price_stream:
    sma_value = sma.update(price)
    rsi_value = rsi.update(price)
    
    if sma.ready and rsi.ready:
        print(f"SMA: {sma_value:.2f}, RSI: {rsi_value:.2f}")

Visualization

# Install visualization support
# pip install "numta[viz]"

from numta.viz import plot_ohlc, plot_with_indicators

# Basic candlestick chart
chart = plot_ohlc(df, volume=True)

# Chart with indicators
chart = plot_with_indicators(df, indicators={'SMA_20': sma_data})

# Plot detected patterns
chart = df.ta.plot(patterns=patterns)

Documentation

๐Ÿ“– Full Documentation - Comprehensive API reference and guides.

Notebooks

Performance

numta uses optimized algorithms and optional Numba JIT compilation:

Implementation Speed vs Default Requirements
numpy (default) 1.0x (baseline) None
cumsum ~3x faster None
numba 5-10x faster pip install numba
GPU batch 100x+ faster (multi-ticker) NVIDIA GPU + pip install "numta[gpu]"
from numta import SMA_auto, SMA_cumsum

# Automatic backend selection
sma = SMA_auto(close_prices, timeperiod=30, backend='auto')

# Or choose specific backend
sma_fast = SMA_cumsum(close_prices, timeperiod=30)

For batch processing across thousands of tickers, the GPU backend provides massive parallelism โ€” each CUDA thread processes one ticker's full time series. See GPU Batch Processing for details.

API Reference

See FUNCTION_IMPLEMENTATIONS.md for detailed implementation status of all indicators.

Requirements

  • Python >= 3.8
  • NumPy >= 1.20.0

Optional Dependencies

Feature Package Installation
Performance numba >= 0.56.0 pip install "numta[numba]"
GPU Batch numba-cuda >= 0.1.0 pip install "numta[gpu]"
Pandas pandas >= 1.3.0 pip install "numta[pandas]"
Visualization lwcharts >= 0.1.0 pip install "numta[viz]"
All features - pip install "numta[full]"

Project Structure

numta/
โ”œโ”€โ”€ src/numta/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ api/                 # Indicator implementations
โ”‚   โ”‚   โ””โ”€โ”€ batch.py         # GPU batch API (128 *_batch functions)
โ”‚   โ”œโ”€โ”€ cpu/                 # Numba-optimized CPU kernels
โ”‚   โ”œโ”€โ”€ gpu/                 # CUDA GPU kernels for batch processing
โ”‚   โ”œโ”€โ”€ patterns/            # Chart pattern detection
โ”‚   โ”œโ”€โ”€ streaming/           # Real-time indicators
โ”‚   โ”œโ”€โ”€ viz/                 # Visualization (lwcharts)
โ”‚   โ”œโ”€โ”€ pandas_ext.py        # DataFrame accessor
โ”‚   โ”œโ”€โ”€ backend.py           # Backend selection
โ”‚   โ”œโ”€โ”€ benchmark.py         # Performance tools
โ”‚   โ””โ”€โ”€ optimized.py         # Optimized implementations
โ”œโ”€โ”€ notebooks/               # Example notebooks
โ”œโ”€โ”€ tests/                   # Test suite
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Testing

# Install test dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with verbose output
pytest -v

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes with tests
  4. Ensure all tests pass
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Acknowledgments

This project implements technical analysis algorithms based on publicly available mathematical formulas. We acknowledge:

numta is an independent implementation and is not derived from TA-Lib's source code. All code is original work licensed under the MIT License.

Support

For issues, questions, or contributions: https://github.com/deepentropy/numta/issues

Citation

@software{numta,
  title={numta: NumPy-based Technical Analysis Library},
  author={numta contributors},
  url={https://github.com/deepentropy/numta},
  year={2025}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numta-0.2.0.tar.gz (362.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numta-0.2.0-py3-none-any.whl (192.8 kB view details)

Uploaded Python 3

File details

Details for the file numta-0.2.0.tar.gz.

File metadata

  • Download URL: numta-0.2.0.tar.gz
  • Upload date:
  • Size: 362.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numta-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0428e82a67c86a464621c0487236b0850ea67a939604327deba1ecbcaadc263b
MD5 9aa3014b384e2ac62393f4f172bbe770
BLAKE2b-256 29c93a8007a02f2efa5eb6de267d8f1d2734718372aa0ecba1f4765973334b83

See more details on using hashes here.

Provenance

The following attestation bundles were made for numta-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on deepentropy/numta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numta-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: numta-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 192.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numta-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 991eaad229c40d28c944d8447b5f792185e41b49ec61768f80d09e6702364c56
MD5 8e4e83115818e0176d311ff675325697
BLAKE2b-256 c60c7bb14d395eafd03be47663e8449f4f040d337138f9d82e276853dd68cab9

See more details on using hashes here.

Provenance

The following attestation bundles were made for numta-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on deepentropy/numta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page