Skip to content

mihakralj/QuanTAlib

Repository files navigation

Codacy grade codecov Security Rating CodeFactor Nuget GitHub last commit Nuget .NET

Indicators Classes Files Methods Lines of Code Public APIs Comments

QuanTAlib

393 technical indicators. One library. Brutal architectural trade-offs for absolute speed.

QuanTAlib grinds through half a million bars of SMA in 328 microseconds. Faster than an L1 cache miss. The same indicators run in C#, Python, and PineScript. Cross-validated against TA-Lib, Tulip, Skender, and every other implementation worth testing.

We achieve this by trading object allocation for contiguous memory spans and forcing SIMD vectorization. You want speed? We dictate the heap.

Pick your weapon:

Platform Install Guide
C# / .NET 10 dotnet add package QuanTAlib Architecture . API Reference
Python pip install quantalib Python Guide
PineScript v6 Copy-paste from lib/ PineScript Guide

Quick Start

C# Streaming (Real-time incoming data)

using QuanTAlib;

// No allocations in the update loop. State is maintained internally.
var sma = new Sma(period: 14);
var result = sma.Update(110.4);

if (result.IsHot)
    Console.WriteLine($"SMA: {result.Value}");

C# — batch (500K bars in microseconds)

// We evaluate code, not promises.
// This processes as contiguous memory using AVX-512 vectorization.
// Zero allocations. The Garbage Collector sleeps.
double[] prices = LoadHistoricalData();
double[] results = new double[prices.Length];

Sma.Batch(prices.AsSpan(), results.AsSpan(), period: 14);

Python

import quantalib as qtl
import numpy as np

prices = np.random.default_rng(42).normal(100, 2, size=500_000)
sma = qtl.sma(prices, period=14)       # 393 indicators, similar syntax

Works with NumPy, pandas, polars, and PyArrow. Full Python guide →

PineScript

Every indicator ships as a standalone .pine file. Open it. Copy it. Paste it into TradingView. No magic, just math. Full PineScript guide →


393 Indicators

Category Count What It Measures Examples
Core 8 Price transforms, building blocks AVGPRICE, MEDPRICE, TYPPRICE, HA
Trends (FIR) 33 Finite impulse response averages SMA, WMA, HMA, ALMA, TRIMA, LSMA
Trends (IIR) 36 Infinite impulse response averages EMA, DEMA, TEMA, T3, JMA, KAMA, VIDYA
Filters 37 Signal processing, noise reduction Kalman, Butterworth, Gaussian, Savitzky-Golay
Oscillators 48 Bounded/centered oscillators RSI, MACD, Stochastic, CCI, Fisher, Williams %R
Dynamics 21 Trend strength and direction ADX, Aroon, SuperTrend, Ichimoku, Vortex
Momentum 19 Speed of price changes ROC, Momentum, Velocity, TSI, Qstick
Volatility 26 Price variability ATR, Bollinger Width, Historical Vol, True Range
Volume 27 Trading activity OBV, VWAP, MFI, CMF, ADL, Force Index
Statistics 35 Statistical measures Correlation, Variance, Skewness, Z-Score
Channels 23 Price boundaries Bollinger Bands, Keltner, Donchian
Cycles 14 Cycle analysis Hilbert Transform, Homodyne, Ehlers Sine Wave
Reversals 12 Pattern detection Pivot Points, Fractals, Swings
Forecasts 1 Predictive indicators Time Series Forecast
Errors 26 Error metrics, loss functions RMSE, MAE, MAPE, SMAPE, R²
Numerics 27 Mathematical transforms Log, Exp, Sigmoid, Normalize, FFT

Browse all 393 indicators →


Performance

500,000 bars. Period 220. .NET 10.0, AVX-512. Zero allocations.

Library SMA Time Allocations vs QuanTAlib
QuanTAlib 328 μs 0 B
TA-Lib 365 μs 32 B 1.1× slower
Tulip 370 μs 0 B 1.1× slower
Skender 68,436 μs 42 MB 209× slower
Ooples 347,453 μs 151 MB 1,060× slower

That is 0.66 nanoseconds per value — faster than a single L1 cache miss. Full benchmarks →


Documentation

Architecture & API

Analysis & Validation

Code Quality

Static analysis: NDepend · Codacy · SonarCloud · CodeFactor

⚠️ Fair Warning

This library is not yet 1.0.0. There is exactly one grumpy engineer behind it, fueled by mass amounts of caffeine and an irrational belief that all technical indicators should be correct down to the 10th decimal place.

Implemented indicators are not yet complete. Things will break. APIs will change. Some indicators might produce values that make your quantitative models question the meaning of life. If you find something broken and don't open an issue, the grumpy dev will have absolutely no idea what needs fixing — and the backlog of things to fix, improve, and add is already longer than a Bollinger Band on a meme stock.

Your bug reports make this library better. Your silence makes the dev mass more coffee.

License

Licensed under Apache 2.0. Not MIT. Not BSD. Deliberately.

Full rationale →

About

C# TA library for real-time financial analysis, offering ~100 indicators. Available on NuGet, Quantower compatible. Ensures early validity of calculated data, calculation accuracy tested against four TA libraries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors