zeon-ta 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zeon_ta-0.3.0/.gitignore +17 -0
- zeon_ta-0.3.0/BENCHMARKS.md +76 -0
- zeon_ta-0.3.0/CHANGELOG.md +826 -0
- zeon_ta-0.3.0/CONTRIBUTING.md +211 -0
- zeon_ta-0.3.0/LICENSE +21 -0
- zeon_ta-0.3.0/PKG-INFO +198 -0
- zeon_ta-0.3.0/README.md +140 -0
- zeon_ta-0.3.0/benchmarks/README.md +13 -0
- zeon_ta-0.3.0/benchmarks/run.py +110 -0
- zeon_ta-0.3.0/docs/_config.yml +4 -0
- zeon_ta-0.3.0/docs/index.md +174 -0
- zeon_ta-0.3.0/docs/indicators/accbands.md +71 -0
- zeon_ta-0.3.0/docs/indicators/adl.md +66 -0
- zeon_ta-0.3.0/docs/indicators/adx.md +66 -0
- zeon_ta-0.3.0/docs/indicators/adxr.md +68 -0
- zeon_ta-0.3.0/docs/indicators/alma.md +70 -0
- zeon_ta-0.3.0/docs/indicators/approximate_entropy.md +70 -0
- zeon_ta-0.3.0/docs/indicators/aroon.md +70 -0
- zeon_ta-0.3.0/docs/indicators/atr.md +64 -0
- zeon_ta-0.3.0/docs/indicators/awesome_oscillator.md +69 -0
- zeon_ta-0.3.0/docs/indicators/bbands.md +70 -0
- zeon_ta-0.3.0/docs/indicators/bias.md +68 -0
- zeon_ta-0.3.0/docs/indicators/bop.md +66 -0
- zeon_ta-0.3.0/docs/indicators/candles.md +72 -0
- zeon_ta-0.3.0/docs/indicators/cci.md +65 -0
- zeon_ta-0.3.0/docs/indicators/center_of_gravity.md +69 -0
- zeon_ta-0.3.0/docs/indicators/chaikin_oscillator.md +69 -0
- zeon_ta-0.3.0/docs/indicators/chaikin_volatility.md +68 -0
- zeon_ta-0.3.0/docs/indicators/chandelier_exit.md +70 -0
- zeon_ta-0.3.0/docs/indicators/choppiness_index.md +68 -0
- zeon_ta-0.3.0/docs/indicators/cmf.md +68 -0
- zeon_ta-0.3.0/docs/indicators/cmo.md +68 -0
- zeon_ta-0.3.0/docs/indicators/connors_rsi.md +70 -0
- zeon_ta-0.3.0/docs/indicators/coppock_curve.md +70 -0
- zeon_ta-0.3.0/docs/indicators/cpr.md +68 -0
- zeon_ta-0.3.0/docs/indicators/cumulative_return.md +66 -0
- zeon_ta-0.3.0/docs/indicators/cyber_cycle.md +69 -0
- zeon_ta-0.3.0/docs/indicators/dema.md +68 -0
- zeon_ta-0.3.0/docs/indicators/dfa.md +68 -0
- zeon_ta-0.3.0/docs/indicators/divergence.md +70 -0
- zeon_ta-0.3.0/docs/indicators/donchian.md +66 -0
- zeon_ta-0.3.0/docs/indicators/dpo.md +68 -0
- zeon_ta-0.3.0/docs/indicators/drawdown.md +66 -0
- zeon_ta-0.3.0/docs/indicators/ease_of_movement.md +68 -0
- zeon_ta-0.3.0/docs/indicators/efficiency_ratio.md +68 -0
- zeon_ta-0.3.0/docs/indicators/elder_ray.md +69 -0
- zeon_ta-0.3.0/docs/indicators/ema.md +64 -0
- zeon_ta-0.3.0/docs/indicators/ema_ribbon.md +68 -0
- zeon_ta-0.3.0/docs/indicators/emd_imf1.md +70 -0
- zeon_ta-0.3.0/docs/indicators/even_better_sinewave.md +69 -0
- zeon_ta-0.3.0/docs/indicators/fib_retracement.md +73 -0
- zeon_ta-0.3.0/docs/indicators/fisher_transform.md +69 -0
- zeon_ta-0.3.0/docs/indicators/force_index.md +68 -0
- zeon_ta-0.3.0/docs/indicators/frama.md +68 -0
- zeon_ta-0.3.0/docs/indicators/garman_klass_volatility.md +68 -0
- zeon_ta-0.3.0/docs/indicators/gmma.md +83 -0
- zeon_ta-0.3.0/docs/indicators/heikin_ashi.md +69 -0
- zeon_ta-0.3.0/docs/indicators/hma.md +68 -0
- zeon_ta-0.3.0/docs/indicators/hurst_exponent.md +68 -0
- zeon_ta-0.3.0/docs/indicators/ichimoku.md +80 -0
- zeon_ta-0.3.0/docs/indicators/ift_rsi.md +69 -0
- zeon_ta-0.3.0/docs/indicators/instantaneous_trendline.md +68 -0
- zeon_ta-0.3.0/docs/indicators/kama.md +70 -0
- zeon_ta-0.3.0/docs/indicators/kdj.md +71 -0
- zeon_ta-0.3.0/docs/indicators/keltner.md +68 -0
- zeon_ta-0.3.0/docs/indicators/klinger_volume_oscillator.md +71 -0
- zeon_ta-0.3.0/docs/indicators/kst.md +77 -0
- zeon_ta-0.3.0/docs/indicators/kurtosis.md +68 -0
- zeon_ta-0.3.0/docs/indicators/laguerre_rsi.md +68 -0
- zeon_ta-0.3.0/docs/indicators/linreg.md +69 -0
- zeon_ta-0.3.0/docs/indicators/log_return.md +68 -0
- zeon_ta-0.3.0/docs/indicators/ma_cross.md +68 -0
- zeon_ta-0.3.0/docs/indicators/macd.md +68 -0
- zeon_ta-0.3.0/docs/indicators/mad.md +68 -0
- zeon_ta-0.3.0/docs/indicators/mass_index.md +69 -0
- zeon_ta-0.3.0/docs/indicators/mcgd.md +68 -0
- zeon_ta-0.3.0/docs/indicators/mfi.md +68 -0
- zeon_ta-0.3.0/docs/indicators/momentum.md +68 -0
- zeon_ta-0.3.0/docs/indicators/natr.md +68 -0
- zeon_ta-0.3.0/docs/indicators/nvi.md +66 -0
- zeon_ta-0.3.0/docs/indicators/obv.md +66 -0
- zeon_ta-0.3.0/docs/indicators/ou_half_life.md +68 -0
- zeon_ta-0.3.0/docs/indicators/parabolic_sar.md +73 -0
- zeon_ta-0.3.0/docs/indicators/parkinson_volatility.md +68 -0
- zeon_ta-0.3.0/docs/indicators/permutation_entropy.md +70 -0
- zeon_ta-0.3.0/docs/indicators/pivot_points.md +73 -0
- zeon_ta-0.3.0/docs/indicators/ppo.md +72 -0
- zeon_ta-0.3.0/docs/indicators/psl.md +68 -0
- zeon_ta-0.3.0/docs/indicators/pvi.md +66 -0
- zeon_ta-0.3.0/docs/indicators/pvt.md +66 -0
- zeon_ta-0.3.0/docs/indicators/qqe.md +71 -0
- zeon_ta-0.3.0/docs/indicators/qstick.md +68 -0
- zeon_ta-0.3.0/docs/indicators/reflex_trendflex.md +69 -0
- zeon_ta-0.3.0/docs/indicators/relative_volatility_index.md +69 -0
- zeon_ta-0.3.0/docs/indicators/relative_volume.md +65 -0
- zeon_ta-0.3.0/docs/indicators/roc.md +68 -0
- zeon_ta-0.3.0/docs/indicators/rogers_satchell_volatility.md +68 -0
- zeon_ta-0.3.0/docs/indicators/roofing_filter.md +69 -0
- zeon_ta-0.3.0/docs/indicators/rsi.md +64 -0
- zeon_ta-0.3.0/docs/indicators/rvgi.md +69 -0
- zeon_ta-0.3.0/docs/indicators/sample_entropy.md +70 -0
- zeon_ta-0.3.0/docs/indicators/skewness.md +68 -0
- zeon_ta-0.3.0/docs/indicators/sma.md +76 -0
- zeon_ta-0.3.0/docs/indicators/smi.md +72 -0
- zeon_ta-0.3.0/docs/indicators/smma.md +68 -0
- zeon_ta-0.3.0/docs/indicators/squeeze.md +69 -0
- zeon_ta-0.3.0/docs/indicators/stddev.md +69 -0
- zeon_ta-0.3.0/docs/indicators/stoch.md +67 -0
- zeon_ta-0.3.0/docs/indicators/stoch_rsi.md +72 -0
- zeon_ta-0.3.0/docs/indicators/super_smoother.md +68 -0
- zeon_ta-0.3.0/docs/indicators/supertrend.md +68 -0
- zeon_ta-0.3.0/docs/indicators/support_resistance.md +79 -0
- zeon_ta-0.3.0/docs/indicators/t3.md +69 -0
- zeon_ta-0.3.0/docs/indicators/tema.md +68 -0
- zeon_ta-0.3.0/docs/indicators/trend_channel.md +68 -0
- zeon_ta-0.3.0/docs/indicators/trima.md +68 -0
- zeon_ta-0.3.0/docs/indicators/trix.md +70 -0
- zeon_ta-0.3.0/docs/indicators/true_range.md +62 -0
- zeon_ta-0.3.0/docs/indicators/tsi.md +71 -0
- zeon_ta-0.3.0/docs/indicators/ulcer_index.md +68 -0
- zeon_ta-0.3.0/docs/indicators/ultimate_oscillator.md +70 -0
- zeon_ta-0.3.0/docs/indicators/variance.md +69 -0
- zeon_ta-0.3.0/docs/indicators/vertical_horizontal_filter.md +68 -0
- zeon_ta-0.3.0/docs/indicators/vidya.md +69 -0
- zeon_ta-0.3.0/docs/indicators/vortex.md +69 -0
- zeon_ta-0.3.0/docs/indicators/voss_predictive_filter.md +71 -0
- zeon_ta-0.3.0/docs/indicators/vwap.md +68 -0
- zeon_ta-0.3.0/docs/indicators/vwma.md +68 -0
- zeon_ta-0.3.0/docs/indicators/vwmacd.md +72 -0
- zeon_ta-0.3.0/docs/indicators/wavelet_denoise.md +70 -0
- zeon_ta-0.3.0/docs/indicators/wavelet_variance.md +74 -0
- zeon_ta-0.3.0/docs/indicators/williams_ad.md +66 -0
- zeon_ta-0.3.0/docs/indicators/williams_fractals.md +69 -0
- zeon_ta-0.3.0/docs/indicators/williams_r.md +68 -0
- zeon_ta-0.3.0/docs/indicators/wma.md +68 -0
- zeon_ta-0.3.0/docs/indicators/yang_zhang_volatility.md +68 -0
- zeon_ta-0.3.0/docs/indicators/zlema.md +68 -0
- zeon_ta-0.3.0/docs/indicators/zscore.md +68 -0
- zeon_ta-0.3.0/docs/methodology.md +78 -0
- zeon_ta-0.3.0/examples/README.md +37 -0
- zeon_ta-0.3.0/examples/accessor_pipeline.py +70 -0
- zeon_ta-0.3.0/examples/basic_usage.py +98 -0
- zeon_ta-0.3.0/examples/cross_asset.py +66 -0
- zeon_ta-0.3.0/examples/next_gen_indicators.py +97 -0
- zeon_ta-0.3.0/examples/signal_walkthrough.py +64 -0
- zeon_ta-0.3.0/pyproject.toml +120 -0
- zeon_ta-0.3.0/src/zeonta/__init__.py +361 -0
- zeon_ta-0.3.0/src/zeonta/_core/__init__.py +59 -0
- zeon_ta-0.3.0/src/zeonta/_core/registry.py +185 -0
- zeon_ta-0.3.0/src/zeonta/_core/rolling.py +157 -0
- zeon_ta-0.3.0/src/zeonta/_core/smoothing.py +114 -0
- zeon_ta-0.3.0/src/zeonta/_core/types.py +16 -0
- zeon_ta-0.3.0/src/zeonta/_core/validation.py +171 -0
- zeon_ta-0.3.0/src/zeonta/accessor.py +66 -0
- zeon_ta-0.3.0/src/zeonta/advanced.py +1205 -0
- zeon_ta-0.3.0/src/zeonta/cross_asset.py +309 -0
- zeon_ta-0.3.0/src/zeonta/foundations.py +611 -0
- zeon_ta-0.3.0/src/zeonta/moving_averages.py +1779 -0
- zeon_ta-0.3.0/src/zeonta/oscillators.py +2726 -0
- zeon_ta-0.3.0/src/zeonta/py.typed +0 -0
- zeon_ta-0.3.0/src/zeonta/statistics.py +438 -0
- zeon_ta-0.3.0/src/zeonta/trend.py +1198 -0
- zeon_ta-0.3.0/src/zeonta/volatility.py +1198 -0
- zeon_ta-0.3.0/src/zeonta/volume.py +1130 -0
- zeon_ta-0.3.0/tests/conftest.py +32 -0
- zeon_ta-0.3.0/tests/data/ohlcv.csv +301 -0
- zeon_ta-0.3.0/tests/data/tv_spy_daily.csv +301 -0
- zeon_ta-0.3.0/tests/helpers.py +24 -0
- zeon_ta-0.3.0/tests/test_accessor.py +54 -0
- zeon_ta-0.3.0/tests/test_advanced.py +543 -0
- zeon_ta-0.3.0/tests/test_contracts.py +352 -0
- zeon_ta-0.3.0/tests/test_core.py +236 -0
- zeon_ta-0.3.0/tests/test_cross_asset.py +182 -0
- zeon_ta-0.3.0/tests/test_docs.py +82 -0
- zeon_ta-0.3.0/tests/test_examples.py +23 -0
- zeon_ta-0.3.0/tests/test_foundations.py +227 -0
- zeon_ta-0.3.0/tests/test_moving_averages.py +754 -0
- zeon_ta-0.3.0/tests/test_oscillators.py +878 -0
- zeon_ta-0.3.0/tests/test_registry.py +159 -0
- zeon_ta-0.3.0/tests/test_statistics.py +129 -0
- zeon_ta-0.3.0/tests/test_tradingview_parity.py +218 -0
- zeon_ta-0.3.0/tests/test_trend.py +534 -0
- zeon_ta-0.3.0/tests/test_volatility.py +447 -0
- zeon_ta-0.3.0/tests/test_volume.py +407 -0
zeon_ta-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Performance
|
|
2
|
+
|
|
3
|
+
zeon-ta is built on NumPy, pandas and PyWavelets — no build step, every
|
|
4
|
+
dependency ships prebuilt wheels. This page answers the question that
|
|
5
|
+
raises: is it actually fast enough? Numbers below are real, reproducible
|
|
6
|
+
measurements, not estimates.
|
|
7
|
+
|
|
8
|
+
## Methodology
|
|
9
|
+
|
|
10
|
+
`benchmarks/run.py` times every registered indicator, called with its
|
|
11
|
+
default parameters, against a deterministic synthetic OHLCV series (a seeded
|
|
12
|
+
random walk with realistic high/low/open ordering — no zero-range bars). Each
|
|
13
|
+
indicator is timed once per size with `time.perf_counter`; sizes tested are
|
|
14
|
+
10,000, 100,000 and 1,000,000 bars.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python benchmarks/run.py # all three sizes
|
|
18
|
+
python benchmarks/run.py --sizes 100000 # a single size, for a quicker pass
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Measured on: Apple M5, Python 3.12.14, NumPy 2.5.2, pandas 3.0.5, macOS.
|
|
22
|
+
Your numbers will differ by hardware, but the relative shape — which
|
|
23
|
+
indicators are cheap, which are expensive, and why — will not.
|
|
24
|
+
|
|
25
|
+
## Headline numbers
|
|
26
|
+
|
|
27
|
+
At **1,000,000 bars** (roughly 2,700 years of daily data, or ~2 years of
|
|
28
|
+
minute bars — far beyond what almost any real backtest needs):
|
|
29
|
+
|
|
30
|
+
- **32 of 47 indicators complete in under half a second; 44 of 47 in under
|
|
31
|
+
a second.**
|
|
32
|
+
- **The slowest, `ema_ribbon`, takes 1.86 seconds** — expected, since it is
|
|
33
|
+
six full EMA passes by design, not a bottleneck to fix.
|
|
34
|
+
- Every other indicator using a Wilder-style or stateful recursion (`adx`,
|
|
35
|
+
`parabolic_sar`, `supertrend`, `kama`) stays under 1.3 seconds despite
|
|
36
|
+
being unable to vectorize away their bar-by-bar state.
|
|
37
|
+
- At 10,000 bars — a realistic size for years of daily data — **every
|
|
38
|
+
single indicator completes in under 20 milliseconds**, most in well under
|
|
39
|
+
1ms.
|
|
40
|
+
|
|
41
|
+
Nothing in the registry shows worse-than-linear scaling: every indicator's
|
|
42
|
+
time roughly tracks its input size 10x-to-10x, with no quadratic blowups.
|
|
43
|
+
|
|
44
|
+
## What was found and fixed
|
|
45
|
+
|
|
46
|
+
The benchmark's first run surfaced two real bottlenecks, both from a
|
|
47
|
+
per-bar Python loop where a vectorized alternative existed:
|
|
48
|
+
|
|
49
|
+
- **`support_resistance`**: 2.48s -> 0.06s at 1M bars (**~40x**). Its pivot
|
|
50
|
+
detection (`_pivot_flags`) moved from a `for` loop with per-bar array
|
|
51
|
+
slicing to a single `sliding_window_view` pass; its confirmed-pivot
|
|
52
|
+
carry-forward moved from a second per-bar loop to a shift + `ffill`,
|
|
53
|
+
the same pattern `obv()` already used for its own gap handling.
|
|
54
|
+
- **`divergence`** (which reuses `_pivot_flags` for its own swing
|
|
55
|
+
detection): 3.30s -> 0.77s (**~4.3x**) from the same fix. Its remaining
|
|
56
|
+
time is a genuinely sequential pass over *confirmed pivots only*
|
|
57
|
+
(comparing each new swing against the last one to detect a divergence),
|
|
58
|
+
not over every bar — a much smaller, harder-to-vectorize loop with
|
|
59
|
+
diminishing returns for the complexity it would add.
|
|
60
|
+
|
|
61
|
+
Both changes are bit-identical to the previous output (existing golden-value
|
|
62
|
+
and doctest coverage caught this immediately) and added no new dependency.
|
|
63
|
+
|
|
64
|
+
## Why no numba (yet)
|
|
65
|
+
|
|
66
|
+
The remaining slowest indicators (`adx`, `parabolic_sar`, `supertrend`,
|
|
67
|
+
`kama`, `ema_ribbon`) are either inherently stateful/recursive by their own
|
|
68
|
+
published definition (see each one's docstring) or, in `ema_ribbon`'s case,
|
|
69
|
+
doing exactly as much work as its six EMA lines require. A JIT compiler
|
|
70
|
+
(numba) could speed up the stateful ones further, at the cost of a new
|
|
71
|
+
dependency, a JIT warm-up on first call, and a track record of lagging
|
|
72
|
+
behind new Python releases — a real tension with this project's own
|
|
73
|
+
latest-versions-first policy. Given every indicator already finishes in
|
|
74
|
+
under 2 seconds on a dataset far larger than any realistic backtest, that
|
|
75
|
+
trade isn't worth making right now. Revisit if a real workload shows
|
|
76
|
+
otherwise.
|