sortefi-ta
Technical indicators, candlestick patterns, chart patterns and price maths for pandas.
Pure numpy + pandas: pip install sortefi-ta and go, no C library to compile.
Built and used in production by Sortefi, where you can describe a stock, crypto or forex screen in plain English and get the matching symbols.
Install
pip install sortefi-ta
Python 3.10+, numpy and pandas only.
Quick start
import pandas as pd
import sortefi_ta as ta
df = pd.read_csv("candles.csv") # columns: open, high, low, close, volume (oldest first)
rsi = ta.calc_rsi(df, period=14)["rsi"] # numpy array, one value per row
macd = ta.calc_macd(df) # {"macd", "signal", "histogram"}
pats = ta.calc_candlestick_patterns(df, ["hammer", "bullish_engulfing"])
print(rsi[-1]) # latest RSI
print(pats["hammer"][-1] == 1.0) # did the latest candle form a hammer?
Every function takes a DataFrame and returns a dict of numpy arrays aligned with the rows,
where [-1] is the latest candle. Warm-up rows are NaN. ta.INDICATOR_FUNCTIONS lists them all.
What's inside
| Group | Count | Functions |
|---|---|---|
| Momentum | 29 | ao, ao_divergence, bop, cci, cci_divergence, cmo, connors_rsi, coppock, fisher, kdj, kdj_divergence, laguerre_rsi, macd, macd_divergence, mfi, mfi_divergence, mom, ppo, roc, rsi, rsi_divergence, squeeze, stochastic, stochastic_divergence, stochrsi, trix, tsi, uo, williams_r |
| Trend & moving averages | 24 | adx, alligator, alma, aroon, chop, dema, dpo, ema, hma, ichimoku, kama, linreg, psar, sma, smma, ssl_channel, stage, supertrend, t3, tema, vortex, vwma, wma, zlema |
| Volatility | 18 | accbands, adr, atr, bbands, donchian, gk_volatility, hv, keltner, massi, natr, parkinson_vol, realized_vol, rvi, true_range, ui, vol_percentile, vol_ratio, yz_volatility |
| Volume | 15 | ad, adosc, anchored_vwap, cmf, cmf_divergence, efi, eom, kvo, nvi, obv, obv_divergence, pvt, rvol, volume_divergence, vwap |
| Price maths | 14 | avg_daily_range, body_size, change, cumulative_return, distance_from_high, distance_from_low, gap, level_state, midpoint, range, range_pct, range_state, relative_position, wick_ratio |
| Statistics | 7 | entropy, kurtosis, mad, skew, stdev, variance, zscore |
| Support & resistance | 6 | equal_levels, fibonacci_levels, fractals, fvg, pivot_points, sfp |
| Chart patterns | 6 | cup_handle, first_pullback, htf, nr7, three_weeks_tight, vcp |
| Divergence helpers | 2 | divergence_signal, divergence_strength |
| Candlestick patterns | 59 | advance_block, bearish_abandoned_baby, bearish_engulfing, bearish_harami, bearish_harami_cross, bearish_hikkake, bearish_kicking, bearish_meeting_lines, bearish_separating_lines, bearish_three_line_strike, bearish_tri_star, belt_hold, bullish_abandoned_baby, bullish_engulfing, bullish_harami, bullish_harami_cross, bullish_hikkake, bullish_kicking, bullish_meeting_lines, bullish_separating_lines, bullish_three_line_strike, bullish_tri_star, dark_cloud_cover, deliberation, doji, dragonfly_doji, evening_doji_star, evening_star, falling_three_methods, falling_window, gravestone_doji, hammer, high_wave, homing_pigeon, identical_three_crows, in_neck, inverted_hammer, ladder_bottom, long_legged_doji, marubozu, matching_low, morning_doji_star, morning_star, on_neck, piercing, rising_three_methods, rising_window, spinning_top, stick_sandwich, three_black_crows, three_inside_down, three_inside_up, three_outside_down, three_outside_up, three_white_soldiers, thrusting, tweezer_bottom, tweezer_top, upside_gap_two_crows |
Notes
- Candlestick patterns are shape-only. A hammer is a hammer whatever came before it;
combine with a trend tool (moving-average slope, ADX,
calc_stage) when you need "hammer after a downtrend". - Every threshold is in the source. Each pattern lives in its own short file with its
rule written out, e.g.
candlestick/hammer.py. - Numbers follow common charting conventions (EMA seeded with an SMA, Wilder smoothing for RSI/ATR/ADX, population standard deviation for Bollinger Bands).
Tests
pip install -e ".[test]" && pytest
License
Metadata
Release files for sortefi-ta 0.1.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 | Provenance | |
|---|---|---|---|---|
| sortefi_ta-0.1.0.tar.gz | 81.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sortefi_ta-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 233.3 kB
Release files / sortefi_ta-0.1.0.tar.gz
| Download URL | sortefi_ta-0.1.0.tar.gz |
|---|---|
| Size | 81.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
055833689bd5ef2aa51a55ede583c4c0bf2a5d673fb39946074c62ce0951fa17
|
|
BLAKE2b-256 checksum How to use checksums |
cfe32f0b6464035562daa868216177bed0d00f9782d8e0ca335dec0c99376d6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / sortefi_ta-0.1.0-py3-none-any.whl
| Download URL | sortefi_ta-0.1.0-py3-none-any.whl |
|---|---|
| Size | 151.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
206023b96325a69a9b4a64bf2e646838d1ce091a49f3fdfdcfbac963c71f293b
|
|
BLAKE2b-256 checksum How to use checksums |
6199f4aba93ff278c49414908b34ac635f9f5cf8c690ee4004a8e016c65c2115
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for sortefi-ta 0.1.0
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.