Skip to main content

v1indicators

Technical analysis indicators for Python

Pandas Series in, pandas Series or DataFrame out — named, typed, and indexed like the input.

PyPI Version Tests Python Version License: MIT


supertrend and RSI computed on synthetic OHLC data

supertrend(high, low, close, length=10, mult=3.0) and rsi(close, length=14) on synthetic data · generated with matplotlib by docs/assets/make_example_chart.py

The scope is deliberate: indicator math only. No charting, no broker integrations, no strategy execution framework.

Contents

Installation

Install from PyPI:

pip install v1indicators

Or install from source for development:

git clone https://github.com/Vatthu/v1indicators.git
cd v1indicators
pip install -e ".[dev]"

Requires Python 3.10+, numpy, pandas, numba.

Quick start

import pandas as pd
from v1indicators import rsi, macd, supertrend

df = pd.read_csv("data.csv")

# single output -> named Series
df["RSI_14"] = rsi(df["close"], length=14)

# multiple outputs -> DataFrame with stable column names
macd_df = macd(df["close"], fast=12, slow=26, signal=9)
st_df = supertrend(df["high"], df["low"], df["close"], length=10, mult=3.0)
Output kind Return type Example columns
Single value pd.Series RSI_14
Multiple values pd.DataFrame MACD, MACD_SIGNAL, MACD_HIST

Every output preserves the input index and length.

Correctness guarantees

Enforced by tests and CI (Python 3.10 / 3.12 / 3.14). A regression in any of them fails the build.

Guarantee What it means Enforced by
No look-ahead bias Values on the first K bars never change when future bars are appended test_causality.py · test_causality_params.py
Textbook parity ~30 core indicators match naive reference loops at 1e-9 test_parity_core.py · test_reference_math.py
NaN warmup Outputs stay NaN until enough history exists test_warmup_contract.py
Calendar correctness Day/week/month and session levels are right on gapped exchange calendars test_calendar_sessions.py
Interoperability All outputs align on index and length across nine scenarios test_interoperability_matrix.py
No look-ahead bias — how the suite rules out repainting

An indicator that changes its past values when future bars arrive repaints, and any backtest built on it is wrong.

  • Every public function is checked on several synthetic datasets.
  • The check repeats under non-default parameter values.
  • Pivot indicators activate levels only once the pivot is confirmed.
  • ichimoku emits Chikou as close - close.shift(kijun) — same information, no future bars.
  • causal=False (retrospective plotting mode) repaints by definition and raises a UserWarning.
  • dpo and vp were removed: no causal form of either exists.
Textbook parity — what is compared against reference loops

Covers the moving-average family, Bollinger Bands, Donchian, MACD, Stochastic, Williams %R, CMO, Ultimate, Aroon, ADX, PSAR, ATR, Parkinson, Garman-Klass, Choppiness, OBV, AD, CMF, VWAP and rolling statistics — each compared against a plain-Python loop written from its textbook formula.

NaN warmup — how much history each output needs

Outputs are NaN until enough history exists for the value to mean something.

  • length observations for a single window or ewm stage.
  • Nested chains add up: TEMA needs 3*(length-1) bars, MACD signal slow+signal-2.
  • Kernel-based averages (kama, vidya, mcgd, ssf, hwma, kalman_filter) and psar seed from the first bars by algorithm definition — feed warmup history.

What is not verified

⚠️ Warning: Six indicators compose the primitives above into trading signals. Their outputs are causal by construction — that is all this library claims about them. Nothing here measures whether their signals predict anything.

Signal engine Output
range_filter_confluence gated trend signals with a strength score
precision_confluence preset-aware confluence entries with SL/TP ladder
dual_score_signals dual-score entries with a five-step TP ladder
htf_reversal_divergence higher-timeframe reversal patterns with RSI divergence
swing_trend_entry moving-average touch entries
swing_leg_profile per-swing-leg volume profile

Validate on your own data before trading any of them.

Conventions

Situation Behavior
Unsorted input index ValueError — bar i+1 must follow bar i
Boolean flag columns False when inputs are NaN or insufficient
Session/calendar tools Index-local clock, no timezone conversion; "prior day" = prior trading day
vwap Anchored to the first bar of the input — slice for a session VWAP
Short names kc = keltner, squeeze = squeeze_momentum, uo = ultimate_oscillator, willr = williams_r

API layout

Import from the root:

from v1indicators import ema, sma, rsi, atr, obv

or from a family module:

from v1indicators.momentum import rsi, stoch
Family Symbols Examples
overlap 43 ema, sma, bbands, donchian, keltner
momentum 52 rsi, macd, stochastic, williams_r
trend 38 supertrend, adx, psar, aroon
volatility 13 atr, parkinson, garman_klass, chop
volume 17 obv, ad, cmf, vwap, pvt
statistics 11 stdev, zscore, hurst, entropy
levels 4 support_resistance, pivot_points
performance 4 log_return, drawdown

A second namespace mirrors how indicators are built:

from v1indicators.foundational.overlap import ema   # direct from price/volume
from v1indicators.derived.trend import supertrend   # built on other indicators

Family modules re-export both layers and remain the compatibility surface.

ℹ️ Note: New work incubates in experimental/ in the repository, which is not shipped in the binary PyPI package.

Most indicators take close only; range-based ones take high/low/close; volume indicators add volume. Series must share an index.

Development

Test commands
pytest                                     # full suite (~7 s)
pytest -q tests/test_causality.py          # prefix invariance, all functions
pytest -q tests/test_causality_params.py   # same, non-default parameters
pytest -q tests/test_parity_core.py        # textbook reference parity
pytest -q tests/test_interoperability_matrix.py

🛡️ Guarantees: The causality gates discover public functions automatically: a new repainting indicator fails the suite without a test being written for it.

See CHANGELOG.md for full release history. License: MIT.

Metadata

Release files for v1indicators 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for v1indicators 1.0.1
File Size Uploaded Provenance
v1indicators-1.0.1.tar.gz 124.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for v1indicators 1.0.1
File Interpreter ABI Platform
v1indicators-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 283.8 kB

Release files / v1indicators-1.0.1.tar.gz

Download URL v1indicators-1.0.1.tar.gz
Size 124.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2276b92cf4ce0e902de4a37a3e034cb4c84c48ca33f5f1c6eb40ec9432bfa81c
BLAKE2b-256 checksum
How to use checksums
e16dfaa05951a201d69d91c6d733c3d86cb68e2a20cfbea154ec5a9bf2134ffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / v1indicators-1.0.1-py3-none-any.whl

Download URL v1indicators-1.0.1-py3-none-any.whl
Size 159.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23a2e1227d246e45c3bde36bfb3b556fea2e4575d306866033f150346be24626
BLAKE2b-256 checksum
How to use checksums
ae4e39f14917633336375eedb2ab2987a9789e0eec7aa6c0210bdd2cbe81cbb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for v1indicators 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page