From debfd82e3b573161fb346b51eb7f37fe5accf3c2 Mon Sep 17 00:00:00 2001 From: Kevin Johnson Date: Wed, 27 Mar 2024 13:23:54 -0700 Subject: [PATCH] ENH PERF #774 #771 #526 exhc TST stdev variance DOC speedtest --- .gitignore | 1 + README.md | 8 +- examples/Speed_Test.ipynb | 2650 ++++++++++++----------- examples/ni.py | 5 +- pandas_ta/__init__.py | 3 +- pandas_ta/_typing.py | 1 + pandas_ta/candles/cdl_doji.py | 4 +- pandas_ta/candles/cdl_inside.py | 5 +- pandas_ta/candles/cdl_pattern.py | 7 +- pandas_ta/candles/cdl_z.py | 4 +- pandas_ta/candles/ha.py | 4 +- pandas_ta/core.py | 17 +- pandas_ta/custom.py | 1 + pandas_ta/cycles/ebsw.py | 6 +- pandas_ta/cycles/reflex.py | 6 +- pandas_ta/ma.py | 3 +- pandas_ta/maps.py | 10 +- pandas_ta/momentum/__init__.py | 4 +- pandas_ta/momentum/ao.py | 5 +- pandas_ta/momentum/apo.py | 5 +- pandas_ta/momentum/bias.py | 4 +- pandas_ta/momentum/bop.py | 4 +- pandas_ta/momentum/brar.py | 5 +- pandas_ta/momentum/cci.py | 4 +- pandas_ta/momentum/cfo.py | 4 +- pandas_ta/momentum/cg.py | 4 +- pandas_ta/momentum/cmo.py | 3 - pandas_ta/momentum/coppock.py | 4 +- pandas_ta/momentum/crsi.py | 33 +- pandas_ta/momentum/cti.py | 4 +- pandas_ta/momentum/dm.py | 5 +- pandas_ta/momentum/er.py | 4 +- pandas_ta/momentum/eri.py | 5 +- pandas_ta/momentum/exhc.py | 124 ++ pandas_ta/momentum/fisher.py | 5 +- pandas_ta/momentum/inertia.py | 4 +- pandas_ta/momentum/kdj.py | 6 +- pandas_ta/momentum/kst.py | 5 +- pandas_ta/momentum/macd.py | 6 +- pandas_ta/momentum/mom.py | 18 +- pandas_ta/momentum/pgo.py | 4 +- pandas_ta/momentum/ppo.py | 6 +- pandas_ta/momentum/psl.py | 5 +- pandas_ta/momentum/qqe.py | 7 +- pandas_ta/momentum/roc.py | 29 +- pandas_ta/momentum/rsi.py | 4 +- pandas_ta/momentum/rsx.py | 4 +- pandas_ta/momentum/rvgi.py | 5 +- pandas_ta/momentum/slope.py | 32 +- pandas_ta/momentum/smi.py | 6 +- pandas_ta/momentum/squeeze.py | 14 +- pandas_ta/momentum/squeeze_pro.py | 17 +- pandas_ta/momentum/stc.py | 6 +- pandas_ta/momentum/stoch.py | 6 +- pandas_ta/momentum/stochf.py | 5 +- pandas_ta/momentum/stochrsi.py | 5 +- pandas_ta/momentum/td_seq.py | 91 - pandas_ta/momentum/tmo.py | 8 +- pandas_ta/momentum/trix.py | 5 +- pandas_ta/momentum/tsi.py | 5 +- pandas_ta/momentum/uo.py | 4 +- pandas_ta/momentum/willr.py | 4 +- pandas_ta/overlap/alligator.py | 6 +- pandas_ta/overlap/alma.py | 4 +- pandas_ta/overlap/dema.py | 4 +- pandas_ta/overlap/ema.py | 15 - pandas_ta/overlap/fwma.py | 4 +- pandas_ta/overlap/hilo.py | 6 +- pandas_ta/overlap/hl2.py | 5 +- pandas_ta/overlap/hlc3.py | 5 +- pandas_ta/overlap/hma.py | 4 +- pandas_ta/overlap/hwma.py | 4 +- pandas_ta/overlap/ichimoku.py | 9 +- pandas_ta/overlap/jma.py | 4 +- pandas_ta/overlap/kama.py | 4 +- pandas_ta/overlap/linreg.py | 4 +- pandas_ta/overlap/mama.py | 9 +- pandas_ta/overlap/mcgd.py | 4 +- pandas_ta/overlap/midpoint.py | 4 +- pandas_ta/overlap/midprice.py | 4 +- pandas_ta/overlap/ohlc4.py | 5 +- pandas_ta/overlap/pivots.py | 15 +- pandas_ta/overlap/pwma.py | 4 +- pandas_ta/overlap/rma.py | 4 +- pandas_ta/overlap/sinwma.py | 4 +- pandas_ta/overlap/sma.py | 25 +- pandas_ta/overlap/smma.py | 4 +- pandas_ta/overlap/ssf.py | 16 +- pandas_ta/overlap/ssf3.py | 11 +- pandas_ta/overlap/supertrend.py | 5 +- pandas_ta/overlap/swma.py | 4 +- pandas_ta/overlap/t3.py | 4 +- pandas_ta/overlap/tema.py | 4 +- pandas_ta/overlap/trima.py | 4 +- pandas_ta/overlap/vidya.py | 4 +- pandas_ta/overlap/wcp.py | 4 +- pandas_ta/overlap/wma.py | 8 +- pandas_ta/overlap/zlma.py | 4 +- pandas_ta/performance/drawdown.py | 6 +- pandas_ta/performance/log_return.py | 4 +- pandas_ta/performance/percent_return.py | 4 +- pandas_ta/statistics/entropy.py | 4 +- pandas_ta/statistics/kurtosis.py | 4 +- pandas_ta/statistics/mad.py | 4 +- pandas_ta/statistics/median.py | 4 +- pandas_ta/statistics/quantile.py | 4 +- pandas_ta/statistics/skew.py | 4 +- pandas_ta/statistics/stdev.py | 4 +- pandas_ta/statistics/tos_stdevall.py | 4 +- pandas_ta/statistics/variance.py | 4 +- pandas_ta/statistics/zscore.py | 4 +- pandas_ta/transform/cube.py | 5 +- pandas_ta/transform/ifisher.py | 5 +- pandas_ta/transform/remap.py | 4 +- pandas_ta/trend/adx.py | 7 +- pandas_ta/trend/alphatrend.py | 27 +- pandas_ta/trend/amat.py | 6 +- pandas_ta/trend/aroon.py | 6 +- pandas_ta/trend/chop.py | 4 +- pandas_ta/trend/cksp.py | 5 +- pandas_ta/trend/decay.py | 12 +- pandas_ta/trend/decreasing.py | 4 +- pandas_ta/trend/dpo.py | 7 +- pandas_ta/trend/ht_trendline.py | 21 +- pandas_ta/trend/increasing.py | 4 +- pandas_ta/trend/long_run.py | 4 +- pandas_ta/trend/psar.py | 7 +- pandas_ta/trend/qstick.py | 4 +- pandas_ta/trend/rwi.py | 6 +- pandas_ta/trend/short_run.py | 4 +- pandas_ta/trend/trendflex.py | 8 +- pandas_ta/trend/tsignals.py | 4 +- pandas_ta/trend/ttm_trend.py | 4 +- pandas_ta/trend/vhf.py | 4 +- pandas_ta/trend/vortex.py | 5 +- pandas_ta/trend/xsignals.py | 4 +- pandas_ta/trend/zigzag.py | 3 +- pandas_ta/utils/_candles.py | 1 + pandas_ta/utils/_core.py | 5 +- pandas_ta/utils/_math.py | 4 +- pandas_ta/utils/_metrics.py | 1 + pandas_ta/utils/_numba.py | 67 +- pandas_ta/utils/_signals.py | 1 + pandas_ta/utils/_stats.py | 1 + pandas_ta/utils/_study.py | 1 + pandas_ta/utils/_time.py | 1 + pandas_ta/utils/_validate.py | 19 + pandas_ta/volatility/aberration.py | 19 +- pandas_ta/volatility/accbands.py | 6 +- pandas_ta/volatility/atr.py | 4 +- pandas_ta/volatility/atrts.py | 8 +- pandas_ta/volatility/bbands.py | 8 +- pandas_ta/volatility/chandelier_exit.py | 6 +- pandas_ta/volatility/donchian.py | 6 +- pandas_ta/volatility/hwc.py | 10 +- pandas_ta/volatility/kc.py | 6 +- pandas_ta/volatility/massi.py | 4 +- pandas_ta/volatility/natr.py | 12 +- pandas_ta/volatility/pdist.py | 4 +- pandas_ta/volatility/rvi.py | 4 +- pandas_ta/volatility/thermo.py | 7 +- pandas_ta/volatility/true_range.py | 4 +- pandas_ta/volatility/ui.py | 6 +- pandas_ta/volume/ad.py | 4 +- pandas_ta/volume/adosc.py | 4 +- pandas_ta/volume/aobv.py | 8 +- pandas_ta/volume/cmf.py | 4 +- pandas_ta/volume/efi.py | 4 +- pandas_ta/volume/eom.py | 4 +- pandas_ta/volume/kvo.py | 5 +- pandas_ta/volume/mfi.py | 6 +- pandas_ta/volume/nvi.py | 4 +- pandas_ta/volume/obv.py | 4 +- pandas_ta/volume/pvi.py | 4 +- pandas_ta/volume/pvo.py | 6 +- pandas_ta/volume/pvol.py | 4 +- pandas_ta/volume/pvr.py | 1 + pandas_ta/volume/pvt.py | 4 +- pandas_ta/volume/vhm.py | 5 +- pandas_ta/volume/vp.py | 4 +- pandas_ta/volume/vwap.py | 7 +- pandas_ta/volume/vwma.py | 4 +- pandas_ta/volume/wb_tsv.py | 6 +- setup.py | 23 +- tests/config.py | 4 +- tests/test_indicator_momentum.py | 28 +- tests/test_indicator_statistics.py | 4 +- tests/test_indicator_trend.py | 6 + tests/test_indicator_volatility.py | 6 +- tests/test_numba.py | 16 +- 190 files changed, 1962 insertions(+), 2160 deletions(-) create mode 100644 pandas_ta/momentum/exhc.py delete mode 100644 pandas_ta/momentum/td_seq.py diff --git a/.gitignore b/.gitignore index 025ab069..b605fba4 100644 --- a/.gitignore +++ b/.gitignore @@ -114,6 +114,7 @@ env/** .vscode/** # zed settings +.zed .zed/** # Original Source (Dev) diff --git a/README.md b/README.md index 33e8133c..671945a9 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,7 @@ $ pip install pandas_ta[full] ## Development Version -The _development_ version, _0.4.11b_, includes _numerous_ bug fixes, speed improvements and better documentation since release, _0.3.14b_. +The _development_ version, _0.4.12b_, includes _numerous_ bug fixes, speed improvements and better documentation since release, _0.3.14b_. ```sh $ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development @@ -303,7 +303,7 @@ Contributions, feedback, and bug squashing are integral to the success of this l _Thank you for your contributions!_ - +
@@ -840,6 +840,8 @@ Back to [Contents](#contents) - _Directional Movement_: **dm** - _Efficiency Ratio_: **er** - _Elder Ray Index_: **eri** +- _Exhaustion Count_: **exhc** + - Similar to TD Sequential - _Fisher Transform_: **fisher** - _Inertia_: **inertia** - _KDJ_: **kdj** @@ -863,8 +865,6 @@ Back to [Contents](#contents) - _Stochastic Oscillator_: **stoch** - _Fast Stochastic Oscillator_: **stochf** - _Stochastic RSI_: **stochrsi** -- _TD Sequential_: **td_seq** - - Excluded from `df.ta.study()`. - _True Momentum Oscillator_: **tmo** - _Trix_: **trix** - _True strength index_: **tsi** diff --git a/examples/Speed_Test.ipynb b/examples/Speed_Test.ipynb index 05b8770b..51c4ee94 100644 --- a/examples/Speed_Test.ipynb +++ b/examples/Speed_Test.ipynb @@ -23,10 +23,10 @@ "output_type": "stream", "text": [ "Package Versions:\n", - "Pandas v1.4.2\n", - "Pandas TA v0.3.99b0\n", - "Numba v0.58.0\n", - "talib v0.4.21\n" + "Pandas v2.2.0\n", + "Pandas TA v0.4.12b0\n", + "Numba v0.59.0\n", + "talib v0.4.28\n" ] } ], @@ -74,7 +74,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[+] yf | SPY(1259, 7): 6721.5163 ms (6.7215 s)\n" + "[+] yf | SPY(1260, 8): 1809.2097 ms (1.8092 s)\n" ] } ], @@ -92,7 +92,7 @@ { "data": { "text/plain": [ - "(1259, 7)" + "(1260, 8)" ] }, "execution_count": 3, @@ -144,186 +144,187 @@ "output_type": "stream", "text": [ "\n", - "[+] aberration: 1.2820 ms (0.0013 s)\n", - "[+] accbands: 1.2743 ms (0.0013 s)\n", - "[+] ad: 0.9867 ms (0.0010 s)\n", - "[+] adosc: 2.3943 ms (0.0024 s)\n", - "[+] adx: 3.7175 ms (0.0037 s)\n", - "[+] alligator: 58.4777 ms (0.0585 s)\n", - "[+] alma: 0.7621 ms (0.0008 s)\n", - "[+] alphatrend: 4.2357 ms (0.0042 s)\n", - "[+] amat: 2.4880 ms (0.0025 s)\n", - "[+] ao: 0.4695 ms (0.0005 s)\n", - "[+] aobv: 3.6386 ms (0.0036 s)\n", - "[+] apo: 0.8691 ms (0.0009 s)\n", - "[+] aroon: 7.3594 ms (0.0074 s)\n", - "[+] atr: 1.4435 ms (0.0014 s)\n", - "[+] atrts: 2.0349 ms (0.0020 s)\n", - "[+] bbands: 1.3813 ms (0.0014 s)\n", - "[+] bias: 0.6276 ms (0.0006 s)\n", - "[+] bop: 0.7755 ms (0.0008 s)\n", - "[+] brar: 2.6403 ms (0.0026 s)\n", - "[+] cci: 15.0808 ms (0.0151 s)\n", - "[+] cdl_pattern: 7.3896 ms (0.0074 s)\n", - "[+] cdl_z: 1.5592 ms (0.0016 s)\n", - "[+] cfo: 0.3318 ms (0.0003 s)\n", - "[+] cg: 6.2051 ms (0.0062 s)\n", - "[+] chandelier_exit: 2.9417 ms (0.0029 s)\n", - "[+] chop: 1.1763 ms (0.0012 s)\n", - "[+] cksp: 1.3561 ms (0.0014 s)\n", - "[+] cmf: 1.0372 ms (0.0010 s)\n", - "[+] cmo: 1.6456 ms (0.0016 s)\n", - "[+] coppock: 0.3190 ms (0.0003 s)\n", - "[+] crsi: 2.7863 ms (0.0028 s)\n", - "[+] cti: 15.0775 ms (0.0151 s)\n", - "[+] cube: 0.6004 ms (0.0006 s)\n", - "[+] decay: 0.1622 ms (0.0002 s)\n", - "[+] decreasing: 0.2864 ms (0.0003 s)\n", - "[+] dema: 0.7745 ms (0.0008 s)\n", - "[+] dm: 2.0499 ms (0.0020 s)\n", - "[+] donchian: 0.7691 ms (0.0008 s)\n", - "[+] dpo: 0.3183 ms (0.0003 s)\n", - "[+] ebsw: 34.2073 ms (0.0342 s)\n", - "[+] efi: 0.3756 ms (0.0004 s)\n", - "[+] ema: 0.3783 ms (0.0004 s)\n", - "[+] entropy: 0.5902 ms (0.0006 s)\n", - "[+] eom: 0.9238 ms (0.0009 s)\n", - "[+] er: 0.4375 ms (0.0004 s)\n", - "[+] eri: 0.6157 ms (0.0006 s)\n", - "[+] fisher: 5.6681 ms (0.0057 s)\n", - "[+] fwma: 1.9081 ms (0.0019 s)\n", - "[+] ha: 0.5776 ms (0.0006 s)\n", - "[+] hilo: 42.1915 ms (0.0422 s)\n", - "[+] hl2: 0.2803 ms (0.0003 s)\n", - "[+] hlc3: 0.4520 ms (0.0005 s)\n", - "[+] hma: 0.4261 ms (0.0004 s)\n", - "[+] hwc: 8.5062 ms (0.0085 s)\n", - "[+] hwma: 7.5285 ms (0.0075 s)\n", - "[+] ifisher: 0.6965 ms (0.0007 s)\n", - "[+] increasing: 0.3380 ms (0.0003 s)\n", - "[+] inertia: 2.0829 ms (0.0021 s)\n", - "[+] jma: 24.0994 ms (0.0241 s)\n", - "[+] kama: 7.3705 ms (0.0074 s)\n", - "[+] kc: 0.9083 ms (0.0009 s)\n", - "[+] kdj: 1.3450 ms (0.0013 s)\n", - "[+] kst: 1.3582 ms (0.0014 s)\n", - "[+] kurtosis: 0.2645 ms (0.0003 s)\n", - "[+] kvo: 2.2730 ms (0.0023 s)\n", - "[+] linreg: 11.0057 ms (0.0110 s)\n", - "[+] log_return: 0.1800 ms (0.0002 s)\n", - "[+] long_run: 0.0012 ms (0.0000 s)\n", - "[+] macd: 1.8014 ms (0.0018 s)\n", - "[+] mad: 14.1169 ms (0.0141 s)\n", - "[+] mama: 0.4182 ms (0.0004 s)\n", - "[+] massi: 1.2321 ms (0.0012 s)\n", - "[+] mcgd: 1.8766 ms (0.0019 s)\n", - "[+] median: 0.7056 ms (0.0007 s)\n", - "[+] mfi: 3.0112 ms (0.0030 s)\n", - "[+] midpoint: 0.4546 ms (0.0005 s)\n", - "[+] midprice: 0.5246 ms (0.0005 s)\n", - "[+] mom: 0.1675 ms (0.0002 s)\n", - "[+] natr: 1.6340 ms (0.0016 s)\n", - "[+] nvi: 1.3963 ms (0.0014 s)\n", - "[+] obv: 0.8954 ms (0.0009 s)\n", - "[+] ohlc4: 0.3790 ms (0.0004 s)\n", - "[+] pdist: 1.1023 ms (0.0011 s)\n", - "[+] percent_return: 0.1662 ms (0.0002 s)\n", - "[+] pgo: 0.5911 ms (0.0006 s)\n", - "[+] pivots: 6.0602 ms (0.0061 s)\n", - "[+] ppo: 1.5558 ms (0.0016 s)\n", - "[+] psar: 53.9431 ms (0.0539 s)\n", - "[+] psl: 0.9305 ms (0.0009 s)\n", - "[+] pvi: 1.5093 ms (0.0015 s)\n", - "[+] pvo: 0.6487 ms (0.0006 s)\n", - "[+] pvol: 0.2480 ms (0.0002 s)\n", - "[+] pvr: 1.1587 ms (0.0012 s)\n", - "[+] pvt: 0.3346 ms (0.0003 s)\n", - "[+] pwma: 1.8628 ms (0.0019 s)\n", - "[+] qqe: 99.8817 ms (0.0999 s)\n", - "[+] qstick: 0.8505 ms (0.0009 s)\n", - "[+] quantile: 0.7477 ms (0.0007 s)\n", - "[+] reflex: 0.1978 ms (0.0002 s)\n", - "[+] remap: 0.1480 ms (0.0001 s)\n", - "[+] rma: 0.2027 ms (0.0002 s)\n", - "[+] roc: 0.3554 ms (0.0004 s)\n", - "[+] rsi: 1.1115 ms (0.0011 s)\n", - "[+] rsx: 7.3133 ms (0.0073 s)\n", - "[+] rvgi: 6.0868 ms (0.0061 s)\n", - "[+] rvi: 1.8693 ms (0.0019 s)\n", - "[+] rwi: 2.0012 ms (0.0020 s)\n", - "[+] short_run: 0.0015 ms (0.0000 s)\n", - "[+] sinwma: 7.8431 ms (0.0078 s)\n", - "[+] skew: 0.4854 ms (0.0005 s)\n", - "[+] slope: 0.2809 ms (0.0003 s)\n", - "[+] sma: 0.4560 ms (0.0005 s)\n", - "[+] smi: 1.3863 ms (0.0014 s)\n", - "[+] smma: 19.1926 ms (0.0192 s)\n", - "[+] squeeze: 2.8214 ms (0.0028 s)\n", - "[+] squeeze_pro: 4.3238 ms (0.0043 s)\n", - "[+] ssf: 0.1888 ms (0.0002 s)\n", - "[+] ssf3: 0.1439 ms (0.0001 s)\n", - "[+] stc: 24.7624 ms (0.0248 s)\n", - "[+] stdev: 0.3305 ms (0.0003 s)\n", - "[+] stoch: 2.1044 ms (0.0021 s)\n", - "[+] stochf: 1.5150 ms (0.0015 s)\n", - "[+] stochrsi: 1.0752 ms (0.0011 s)\n", - "[+] supertrend: 24.3632 ms (0.0244 s)\n", - "[+] swma: 1.7897 ms (0.0018 s)\n", - "[+] t3: 1.9121 ms (0.0019 s)\n", - "[+] td_seq: 809.4583 ms (0.8095 s)\n", - "[+] tema: 1.3203 ms (0.0013 s)\n", - "[+] thermo: 1.3618 ms (0.0014 s)\n", - "[+] tmo: 1.3092 ms (0.0013 s)\n", - "[+] tos_stdevall: 2.3369 ms (0.0023 s)\n", - "[+] trendflex: 0.1884 ms (0.0002 s)\n", - "[+] trima: 0.6082 ms (0.0006 s)\n", - "[+] trix: 1.6441 ms (0.0016 s)\n", - "[+] true_range: 1.0535 ms (0.0011 s)\n", - "[+] tsi: 1.8968 ms (0.0019 s)\n", - "[+] tsignals: 0.0014 ms (0.0000 s)\n", - "[+] ttm_trend: 1.7645 ms (0.0018 s)\n", - "[+] ui: 0.6965 ms (0.0007 s)\n", - "[+] uo: 2.5292 ms (0.0025 s)\n", - "[+] variance: 0.2646 ms (0.0003 s)\n", - "[+] vhf: 0.9753 ms (0.0010 s)\n", - "[+] vhm: 1.3896 ms (0.0014 s)\n", - "[+] vidya: 24.4690 ms (0.0245 s)\n", - "[+] vortex: 1.5175 ms (0.0015 s)\n", - "[+] vwap: 2.2810 ms (0.0023 s)\n", - "[+] vwma: 0.5093 ms (0.0005 s)\n", - "[+] wb_tsv: 2.4745 ms (0.0025 s)\n", - "[+] wcp: 0.5129 ms (0.0005 s)\n", - "[+] willr: 0.8930 ms (0.0009 s)\n", - "[+] wma: 9.1959 ms (0.0092 s)\n", - "[+] xsignals: 0.0022 ms (0.0000 s)\n", - "[+] zlma: 0.9088 ms (0.0009 s)\n", - "[+] zscore: 0.9809 ms (0.0010 s)\n", + "[+] aberration: 0.8624 ms (0.0009 s)\n", + "[+] accbands: 0.8761 ms (0.0009 s)\n", + "[+] ad: 0.6500 ms (0.0006 s)\n", + "[+] adosc: 1.3045 ms (0.0013 s)\n", + "[+] adx: 2.8430 ms (0.0028 s)\n", + "[+] alligator: 47.1401 ms (0.0471 s)\n", + "[+] alma: 0.8818 ms (0.0009 s)\n", + "[+] alphatrend: 3.6487 ms (0.0036 s)\n", + "[+] amat: 1.8549 ms (0.0019 s)\n", + "[+] ao: 0.4091 ms (0.0004 s)\n", + "[+] aobv: 2.7360 ms (0.0027 s)\n", + "[+] apo: 0.9364 ms (0.0009 s)\n", + "[+] aroon: 5.2525 ms (0.0053 s)\n", + "[+] atr: 1.3398 ms (0.0013 s)\n", + "[+] atrts: 1.8064 ms (0.0018 s)\n", + "[+] bbands: 1.0628 ms (0.0011 s)\n", + "[+] bias: 0.6855 ms (0.0007 s)\n", + "[+] bop: 0.5835 ms (0.0006 s)\n", + "[+] brar: 1.7600 ms (0.0018 s)\n", + "[+] cci: 13.1447 ms (0.0131 s)\n", + "[+] cdl_pattern: 6.2703 ms (0.0063 s)\n", + "[+] cdl_z: 1.2462 ms (0.0012 s)\n", + "[+] cfo: 0.2802 ms (0.0003 s)\n", + "[+] cg: 6.4479 ms (0.0064 s)\n", + "[+] chandelier_exit: 2.3593 ms (0.0024 s)\n", + "[+] chop: 0.8472 ms (0.0008 s)\n", + "[+] cksp: 1.0035 ms (0.0010 s)\n", + "[+] cmf: 0.7444 ms (0.0007 s)\n", + "[+] cmo: 0.9773 ms (0.0010 s)\n", + "[+] coppock: 0.2668 ms (0.0003 s)\n", + "[+] crsi: 2.2293 ms (0.0022 s)\n", + "[+] cti: 15.2671 ms (0.0153 s)\n", + "[+] cube: 0.4808 ms (0.0005 s)\n", + "[+] decay: 0.1362 ms (0.0001 s)\n", + "[+] decreasing: 0.2167 ms (0.0002 s)\n", + "[+] dema: 0.5917 ms (0.0006 s)\n", + "[+] dm: 1.5374 ms (0.0015 s)\n", + "[+] donchian: 0.5791 ms (0.0006 s)\n", + "[+] dpo: 0.2641 ms (0.0003 s)\n", + "[+] ebsw: 32.3526 ms (0.0324 s)\n", + "[+] efi: 0.2988 ms (0.0003 s)\n", + "[+] ema: 0.2940 ms (0.0003 s)\n", + "[+] entropy: 0.4258 ms (0.0004 s)\n", + "[+] eom: 0.7121 ms (0.0007 s)\n", + "[+] er: 0.3142 ms (0.0003 s)\n", + "[+] eri: 0.4772 ms (0.0005 s)\n", + "[+] exhc: 0.2422 ms (0.0002 s)\n", + "[+] fisher: 4.2052 ms (0.0042 s)\n", + "[+] fwma: 1.2505 ms (0.0013 s)\n", + "[+] ha: 0.4388 ms (0.0004 s)\n", + "[+] hilo: 32.7702 ms (0.0328 s)\n", + "[+] hl2: 0.3229 ms (0.0003 s)\n", + "[+] hlc3: 0.2713 ms (0.0003 s)\n", + "[+] hma: 0.3373 ms (0.0003 s)\n", + "[+] ht_trendline: 0.3456 ms (0.0003 s)\n", + "[+] hwc: 11.7341 ms (0.0117 s)\n", + "[+] hwma: 5.3421 ms (0.0053 s)\n", + "[+] ifisher: 0.4440 ms (0.0004 s)\n", + "[+] increasing: 0.2562 ms (0.0003 s)\n", + "[+] inertia: 1.6177 ms (0.0016 s)\n", + "[+] jma: 24.5618 ms (0.0246 s)\n", + "[+] kama: 4.5925 ms (0.0046 s)\n", + "[+] kc: 0.7386 ms (0.0007 s)\n", + "[+] kdj: 1.5595 ms (0.0016 s)\n", + "[+] kst: 1.4076 ms (0.0014 s)\n", + "[+] kurtosis: 0.2708 ms (0.0003 s)\n", + "[+] kvo: 2.1295 ms (0.0021 s)\n", + "[+] linreg: 12.0940 ms (0.0121 s)\n", + "[+] log_return: 0.2841 ms (0.0003 s)\n", + "[+] long_run: 0.0014 ms (0.0000 s)\n", + "[+] macd: 1.7334 ms (0.0017 s)\n", + "[+] mad: 12.7495 ms (0.0127 s)\n", + "[+] mama: 0.3669 ms (0.0004 s)\n", + "[+] massi: 0.9844 ms (0.0010 s)\n", + "[+] mcgd: 1.7720 ms (0.0018 s)\n", + "[+] median: 0.6321 ms (0.0006 s)\n", + "[+] mfi: 0.4535 ms (0.0005 s)\n", + "[+] midpoint: 0.3662 ms (0.0004 s)\n", + "[+] midprice: 0.4199 ms (0.0004 s)\n", + "[+] mom: 0.1270 ms (0.0001 s)\n", + "[+] natr: 1.5981 ms (0.0016 s)\n", + "[+] nvi: 1.2930 ms (0.0013 s)\n", + "[+] obv: 0.7807 ms (0.0008 s)\n", + "[+] ohlc4: 0.3358 ms (0.0003 s)\n", + "[+] pdist: 0.8378 ms (0.0008 s)\n", + "[+] percent_return: 0.1432 ms (0.0001 s)\n", + "[+] pgo: 0.5018 ms (0.0005 s)\n", + "[+] pivots: 9.0812 ms (0.0091 s)\n", + "[+] ppo: 1.4622 ms (0.0015 s)\n", + "[+] psar: 42.8820 ms (0.0429 s)\n", + "[+] psl: 0.6870 ms (0.0007 s)\n", + "[+] pvi: 1.2176 ms (0.0012 s)\n", + "[+] pvo: 0.4860 ms (0.0005 s)\n", + "[+] pvol: 0.2122 ms (0.0002 s)\n", + "[+] pvr: 0.9285 ms (0.0009 s)\n", + "[+] pvt: 0.2820 ms (0.0003 s)\n", + "[+] pwma: 1.2252 ms (0.0012 s)\n", + "[+] qqe: 76.1423 ms (0.0761 s)\n", + "[+] qstick: 0.5799 ms (0.0006 s)\n", + "[+] quantile: 0.6063 ms (0.0006 s)\n", + "[+] reflex: 0.1597 ms (0.0002 s)\n", + "[+] remap: 0.1209 ms (0.0001 s)\n", + "[+] rma: 0.1615 ms (0.0002 s)\n", + "[+] roc: 0.1135 ms (0.0001 s)\n", + "[+] rsi: 0.8457 ms (0.0008 s)\n", + "[+] rsx: 6.2984 ms (0.0063 s)\n", + "[+] rvgi: 3.9946 ms (0.0040 s)\n", + "[+] rvi: 1.4539 ms (0.0015 s)\n", + "[+] rwi: 1.6562 ms (0.0017 s)\n", + "[+] short_run: 0.0011 ms (0.0000 s)\n", + "[+] sinwma: 17.4577 ms (0.0175 s)\n", + "[+] skew: 0.2025 ms (0.0002 s)\n", + "[+] slope: 0.1285 ms (0.0001 s)\n", + "[+] sma: 0.3453 ms (0.0003 s)\n", + "[+] smi: 0.9188 ms (0.0009 s)\n", + "[+] smma: 15.1133 ms (0.0151 s)\n", + "[+] squeeze: 2.0582 ms (0.0021 s)\n", + "[+] squeeze_pro: 3.3051 ms (0.0033 s)\n", + "[+] ssf: 0.1588 ms (0.0002 s)\n", + "[+] ssf3: 0.1408 ms (0.0001 s)\n", + "[+] stc: 37.8693 ms (0.0379 s)\n", + "[+] stdev: 0.3233 ms (0.0003 s)\n", + "[+] stoch: 1.7133 ms (0.0017 s)\n", + "[+] stochf: 1.2160 ms (0.0012 s)\n", + "[+] stochrsi: 0.8076 ms (0.0008 s)\n", + "[+] supertrend: 16.8706 ms (0.0169 s)\n", + "[+] swma: 1.2157 ms (0.0012 s)\n", + "[+] t3: 1.4273 ms (0.0014 s)\n", + "[+] tema: 0.7380 ms (0.0007 s)\n", + "[+] thermo: 0.9419 ms (0.0009 s)\n", + "[+] tmo: 0.8521 ms (0.0009 s)\n", + "[+] tos_stdevall: 1.5836 ms (0.0016 s)\n", + "[+] trendflex: 0.1590 ms (0.0002 s)\n", + "[+] trima: 0.6093 ms (0.0006 s)\n", + "[+] trix: 1.2614 ms (0.0013 s)\n", + "[+] true_range: 0.9694 ms (0.0010 s)\n", + "[+] tsi: 1.2655 ms (0.0013 s)\n", + "[+] tsignals: 0.0011 ms (0.0000 s)\n", + "[+] ttm_trend: 1.1507 ms (0.0012 s)\n", + "[+] ui: 0.4515 ms (0.0005 s)\n", + "[+] uo: 2.0976 ms (0.0021 s)\n", + "[+] variance: 0.1966 ms (0.0002 s)\n", + "[+] vhf: 0.6991 ms (0.0007 s)\n", + "[+] vhm: 0.6778 ms (0.0007 s)\n", + "[+] vidya: 34.1496 ms (0.0341 s)\n", + "[+] vortex: 0.8700 ms (0.0009 s)\n", + "[+] vwap: 8.5635 ms (0.0086 s)\n", + "[+] vwma: 0.3592 ms (0.0004 s)\n", + "[+] wb_tsv: 1.6159 ms (0.0016 s)\n", + "[+] wcp: 0.2637 ms (0.0003 s)\n", + "[+] willr: 0.5554 ms (0.0006 s)\n", + "[+] wma: 0.2305 ms (0.0002 s)\n", + "[+] xsignals: 0.0015 ms (0.0000 s)\n", + "[+] zlma: 0.4540 ms (0.0005 s)\n", + "[+] zscore: 0.7855 ms (0.0008 s)\n", "\n", "============================================================\n", - " Slowest 10 Indicators [154]\n", - " Observations: 1259\n", + " Slowest 10 Indicators [155]\n", + " Observations: 1260\n", "============================================================\n", - " ms secs\n", - "Indicator \n", - "td_seq 809.4583 0.80946\n", - "qqe 99.8817 0.09988\n", - "alligator 58.4777 0.05848\n", - "psar 53.9431 0.05394\n", - "hilo 42.1915 0.04219\n", - "ebsw 34.2073 0.03421\n", - "stc 24.7624 0.02476\n", - "vidya 24.4690 0.02447\n", - "supertrend 24.3632 0.02436\n", - "jma 24.0994 0.02410\n", + " ms secs\n", + "Indicator \n", + "qqe 76.1423 0.07614\n", + "alligator 47.1401 0.04714\n", + "psar 42.8820 0.04288\n", + "stc 37.8693 0.03787\n", + "vidya 34.1496 0.03415\n", + "hilo 32.7702 0.03277\n", + "ebsw 32.3526 0.03235\n", + "jma 24.5618 0.02456\n", + "sinwma 17.4577 0.01746\n", + "supertrend 16.8706 0.01687\n", "\n", "============================================================\n", "Time Stats:\n", - " ms secs\n", - "min 0.001200 0.000000\n", - "50% 1.278150 0.001275\n", - "mean 9.757957 0.009758\n", - "max 809.458300 0.809460\n", - "total 1502.725400 1.502770\n", + " ms secs\n", + "min 0.001100 0.000000\n", + "50% 0.852100 0.000850\n", + "mean 3.948935 0.003949\n", + "max 76.142300 0.076140\n", + "total 612.085000 0.612100\n", "\n", "============================================================\n", "\n" @@ -344,41 +345,53 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -388,60 +401,60 @@ " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 mssecsmssecs
Indicator
td_seq809.4583000.809460qqe76.1423000.076140
qqe99.8817000.099880alligator47.1401000.047140
alligator58.4777000.058480psar42.8820000.042880
psar53.9431000.053940stc37.8693000.037870
hilo42.1915000.042190vidya34.1496000.034150
ebsw34.2073000.034210hilo32.7702000.032770
stc24.7624000.024760ebsw32.3526000.032350
vidya24.4690000.024470jma24.5618000.024560
supertrend24.3632000.024360sinwma17.4577000.017460
jma24.0994000.024100supertrend16.8706000.016870
\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 6, @@ -487,40 +500,40 @@ " \n", " \n", " min\n", - " 0.001200\n", + " 0.001100\n", " 0.000000\n", " \n", " \n", " 50%\n", - " 1.278150\n", - " 0.001275\n", + " 0.852100\n", + " 0.000850\n", " \n", " \n", " mean\n", - " 9.757957\n", - " 0.009758\n", + " 3.948935\n", + " 0.003949\n", " \n", " \n", " max\n", - " 809.458300\n", - " 0.809460\n", + " 76.142300\n", + " 0.076140\n", " \n", " \n", " total\n", - " 1502.725400\n", - " 1.502770\n", + " 612.085000\n", + " 0.612100\n", " \n", " \n", "\n", "" ], "text/plain": [ - " ms secs\n", - "min 0.001200 0.000000\n", - "50% 1.278150 0.001275\n", - "mean 9.757957 0.009758\n", - "max 809.458300 0.809460\n", - "total 1502.725400 1.502770" + " ms secs\n", + "min 0.001100 0.000000\n", + "50% 0.852100 0.000850\n", + "mean 3.948935 0.003949\n", + "max 76.142300 0.076140\n", + "total 612.085000 0.612100" ] }, "execution_count": 7, @@ -559,186 +572,187 @@ "output_type": "stream", "text": [ "\n", - "[+] aberration: 1.5806 ms (0.0016 s)\n", - "[+] accbands: 1.4873 ms (0.0015 s)\n", - "[+] ad: 0.5515 ms (0.0006 s)\n", - "[+] adosc: 0.4916 ms (0.0005 s)\n", - "[+] adx: 3.2889 ms (0.0033 s)\n", - "[+] alligator: 63.6065 ms (0.0636 s)\n", - "[+] alma: 0.5740 ms (0.0006 s)\n", - "[+] alphatrend: 1.6332 ms (0.0016 s)\n", - "[+] amat: 2.0833 ms (0.0021 s)\n", - "[+] ao: 0.4970 ms (0.0005 s)\n", - "[+] aobv: 2.4720 ms (0.0025 s)\n", - "[+] apo: 0.1935 ms (0.0002 s)\n", - "[+] aroon: 0.5432 ms (0.0005 s)\n", - "[+] atr: 0.4053 ms (0.0004 s)\n", - "[+] atrts: 0.5699 ms (0.0006 s)\n", - "[+] bbands: 0.8516 ms (0.0009 s)\n", - "[+] bias: 0.2836 ms (0.0003 s)\n", - "[+] bop: 0.4212 ms (0.0004 s)\n", - "[+] brar: 2.6350 ms (0.0026 s)\n", - "[+] cci: 0.3652 ms (0.0004 s)\n", - "[+] cdl_pattern: 7.3170 ms (0.0073 s)\n", - "[+] cdl_z: 1.6650 ms (0.0017 s)\n", - "[+] cfo: 0.3430 ms (0.0003 s)\n", - "[+] cg: 6.3938 ms (0.0064 s)\n", - "[+] chandelier_exit: 1.9723 ms (0.0020 s)\n", - "[+] chop: 1.1349 ms (0.0011 s)\n", - "[+] cksp: 1.3591 ms (0.0014 s)\n", - "[+] cmf: 1.0442 ms (0.0010 s)\n", - "[+] cmo: 0.1917 ms (0.0002 s)\n", - "[+] coppock: 0.3040 ms (0.0003 s)\n", - "[+] crsi: 0.9252 ms (0.0009 s)\n", - "[+] cti: 15.0930 ms (0.0151 s)\n", - "[+] cube: 0.7686 ms (0.0008 s)\n", - "[+] decay: 0.1639 ms (0.0002 s)\n", - "[+] decreasing: 0.3167 ms (0.0003 s)\n", - "[+] dema: 0.1870 ms (0.0002 s)\n", - "[+] dm: 0.4573 ms (0.0005 s)\n", - "[+] donchian: 0.8065 ms (0.0008 s)\n", - "[+] dpo: 0.3247 ms (0.0003 s)\n", - "[+] ebsw: 34.1789 ms (0.0342 s)\n", - "[+] efi: 0.5144 ms (0.0005 s)\n", - "[+] ema: 0.1521 ms (0.0002 s)\n", - "[+] entropy: 0.6452 ms (0.0006 s)\n", - "[+] eom: 0.9606 ms (0.0010 s)\n", - "[+] er: 0.4401 ms (0.0004 s)\n", - "[+] eri: 0.6672 ms (0.0007 s)\n", - "[+] fisher: 5.8747 ms (0.0059 s)\n", - "[+] fwma: 2.0135 ms (0.0020 s)\n", - "[+] ha: 0.6174 ms (0.0006 s)\n", - "[+] hilo: 42.5026 ms (0.0425 s)\n", - "[+] hl2: 0.4114 ms (0.0004 s)\n", - "[+] hlc3: 0.3812 ms (0.0004 s)\n", - "[+] hma: 0.4439 ms (0.0004 s)\n", - "[+] hwc: 8.3278 ms (0.0083 s)\n", - "[+] hwma: 7.4163 ms (0.0074 s)\n", - "[+] ifisher: 0.6913 ms (0.0007 s)\n", - "[+] increasing: 0.3617 ms (0.0004 s)\n", - "[+] inertia: 2.6664 ms (0.0027 s)\n", - "[+] jma: 24.4935 ms (0.0245 s)\n", - "[+] kama: 7.6691 ms (0.0077 s)\n", - "[+] kc: 0.9831 ms (0.0010 s)\n", - "[+] kdj: 1.3869 ms (0.0014 s)\n", - "[+] kst: 2.1433 ms (0.0021 s)\n", - "[+] kurtosis: 0.5025 ms (0.0005 s)\n", - "[+] kvo: 2.5644 ms (0.0026 s)\n", - "[+] linreg: 0.2143 ms (0.0002 s)\n", - "[+] log_return: 0.1922 ms (0.0002 s)\n", - "[+] long_run: 0.0016 ms (0.0000 s)\n", - "[+] macd: 0.4391 ms (0.0004 s)\n", - "[+] mad: 14.5326 ms (0.0145 s)\n", - "[+] mama: 0.6004 ms (0.0006 s)\n", - "[+] massi: 0.8779 ms (0.0009 s)\n", - "[+] mcgd: 2.0039 ms (0.0020 s)\n", - "[+] median: 0.7374 ms (0.0007 s)\n", - "[+] mfi: 0.4306 ms (0.0004 s)\n", - "[+] midpoint: 0.1615 ms (0.0002 s)\n", - "[+] midprice: 0.2310 ms (0.0002 s)\n", - "[+] mom: 0.1392 ms (0.0001 s)\n", - "[+] natr: 0.3186 ms (0.0003 s)\n", - "[+] nvi: 1.5691 ms (0.0016 s)\n", - "[+] obv: 0.2462 ms (0.0002 s)\n", - "[+] ohlc4: 0.3725 ms (0.0004 s)\n", - "[+] pdist: 1.1767 ms (0.0012 s)\n", - "[+] percent_return: 0.1712 ms (0.0002 s)\n", - "[+] pgo: 0.5866 ms (0.0006 s)\n", - "[+] pivots: 5.9886 ms (0.0060 s)\n", - "[+] ppo: 0.5523 ms (0.0006 s)\n", - "[+] psar: 55.9114 ms (0.0559 s)\n", - "[+] psl: 0.8440 ms (0.0008 s)\n", - "[+] pvi: 1.4066 ms (0.0014 s)\n", - "[+] pvo: 0.6285 ms (0.0006 s)\n", - "[+] pvol: 0.2493 ms (0.0002 s)\n", - "[+] pvr: 1.1745 ms (0.0012 s)\n", - "[+] pvt: 0.3394 ms (0.0003 s)\n", - "[+] pwma: 1.8115 ms (0.0018 s)\n", - "[+] qqe: 98.3270 ms (0.0983 s)\n", - "[+] qstick: 0.5156 ms (0.0005 s)\n", - "[+] quantile: 0.8809 ms (0.0009 s)\n", - "[+] reflex: 0.2061 ms (0.0002 s)\n", - "[+] remap: 0.1448 ms (0.0001 s)\n", - "[+] rma: 0.2006 ms (0.0002 s)\n", - "[+] roc: 0.1363 ms (0.0001 s)\n", - "[+] rsi: 0.1498 ms (0.0001 s)\n", - "[+] rsx: 7.7118 ms (0.0077 s)\n", - "[+] rvgi: 7.1158 ms (0.0071 s)\n", - "[+] rvi: 1.9210 ms (0.0019 s)\n", - "[+] rwi: 0.9288 ms (0.0009 s)\n", - "[+] short_run: 0.0013 ms (0.0000 s)\n", - "[+] sinwma: 7.4565 ms (0.0075 s)\n", - "[+] skew: 0.2469 ms (0.0002 s)\n", - "[+] slope: 0.2082 ms (0.0002 s)\n", - "[+] sma: 0.1408 ms (0.0001 s)\n", - "[+] smi: 1.1578 ms (0.0012 s)\n", - "[+] smma: 19.2323 ms (0.0192 s)\n", - "[+] squeeze: 2.8722 ms (0.0029 s)\n", - "[+] squeeze_pro: 4.2940 ms (0.0043 s)\n", - "[+] ssf: 0.1656 ms (0.0002 s)\n", - "[+] ssf3: 0.1457 ms (0.0001 s)\n", - "[+] stc: 25.1997 ms (0.0252 s)\n", - "[+] stdev: 0.1549 ms (0.0002 s)\n", - "[+] stoch: 0.5891 ms (0.0006 s)\n", - "[+] stochf: 0.5101 ms (0.0005 s)\n", - "[+] stochrsi: 1.0790 ms (0.0011 s)\n", - "[+] supertrend: 24.5619 ms (0.0246 s)\n", - "[+] swma: 1.7850 ms (0.0018 s)\n", - "[+] t3: 0.1574 ms (0.0002 s)\n", - "[+] td_seq: 809.2238 ms (0.8092 s)\n", - "[+] tema: 0.3596 ms (0.0004 s)\n", - "[+] thermo: 2.4621 ms (0.0025 s)\n", - "[+] tmo: 1.5925 ms (0.0016 s)\n", - "[+] tos_stdevall: 3.3580 ms (0.0034 s)\n", - "[+] trendflex: 0.2923 ms (0.0003 s)\n", - "[+] trima: 0.2047 ms (0.0002 s)\n", - "[+] trix: 1.3216 ms (0.0013 s)\n", - "[+] true_range: 0.4141 ms (0.0004 s)\n", - "[+] tsi: 0.9098 ms (0.0009 s)\n", - "[+] tsignals: 0.0017 ms (0.0000 s)\n", - "[+] ttm_trend: 1.5815 ms (0.0016 s)\n", - "[+] ui: 0.6897 ms (0.0007 s)\n", - "[+] uo: 0.3624 ms (0.0004 s)\n", - "[+] variance: 0.1521 ms (0.0002 s)\n", - "[+] vhf: 0.9536 ms (0.0010 s)\n", - "[+] vhm: 1.3467 ms (0.0013 s)\n", - "[+] vidya: 23.9921 ms (0.0240 s)\n", - "[+] vortex: 1.5467 ms (0.0015 s)\n", - "[+] vwap: 1.8215 ms (0.0018 s)\n", - "[+] vwma: 0.4105 ms (0.0004 s)\n", - "[+] wb_tsv: 2.2791 ms (0.0023 s)\n", - "[+] wcp: 0.3457 ms (0.0003 s)\n", - "[+] willr: 0.3106 ms (0.0003 s)\n", - "[+] wma: 0.1408 ms (0.0001 s)\n", - "[+] xsignals: 0.0015 ms (0.0000 s)\n", - "[+] zlma: 0.3836 ms (0.0004 s)\n", - "[+] zscore: 0.3463 ms (0.0003 s)\n", + "[+] aberration: 1.4520 ms (0.0015 s)\n", + "[+] accbands: 1.6774 ms (0.0017 s)\n", + "[+] ad: 0.5130 ms (0.0005 s)\n", + "[+] adosc: 0.3955 ms (0.0004 s)\n", + "[+] adx: 2.6092 ms (0.0026 s)\n", + "[+] alligator: 47.4284 ms (0.0474 s)\n", + "[+] alma: 0.6385 ms (0.0006 s)\n", + "[+] alphatrend: 1.1714 ms (0.0012 s)\n", + "[+] amat: 1.5313 ms (0.0015 s)\n", + "[+] ao: 0.4211 ms (0.0004 s)\n", + "[+] aobv: 2.6209 ms (0.0026 s)\n", + "[+] apo: 0.2004 ms (0.0002 s)\n", + "[+] aroon: 0.4581 ms (0.0005 s)\n", + "[+] atr: 0.3622 ms (0.0004 s)\n", + "[+] atrts: 0.4910 ms (0.0005 s)\n", + "[+] bbands: 0.5894 ms (0.0006 s)\n", + "[+] bias: 0.2355 ms (0.0002 s)\n", + "[+] bop: 0.3610 ms (0.0004 s)\n", + "[+] brar: 1.8524 ms (0.0019 s)\n", + "[+] cci: 0.3212 ms (0.0003 s)\n", + "[+] cdl_pattern: 6.7838 ms (0.0068 s)\n", + "[+] cdl_z: 1.2919 ms (0.0013 s)\n", + "[+] cfo: 0.2796 ms (0.0003 s)\n", + "[+] cg: 6.4199 ms (0.0064 s)\n", + "[+] chandelier_exit: 1.3723 ms (0.0014 s)\n", + "[+] chop: 0.8248 ms (0.0008 s)\n", + "[+] cksp: 0.9878 ms (0.0010 s)\n", + "[+] cmf: 0.7575 ms (0.0008 s)\n", + "[+] cmo: 0.1677 ms (0.0002 s)\n", + "[+] coppock: 0.2570 ms (0.0003 s)\n", + "[+] crsi: 0.7928 ms (0.0008 s)\n", + "[+] cti: 15.3639 ms (0.0154 s)\n", + "[+] cube: 0.4712 ms (0.0005 s)\n", + "[+] decay: 0.1336 ms (0.0001 s)\n", + "[+] decreasing: 0.2199 ms (0.0002 s)\n", + "[+] dema: 0.1461 ms (0.0001 s)\n", + "[+] dm: 0.3480 ms (0.0003 s)\n", + "[+] donchian: 0.5668 ms (0.0006 s)\n", + "[+] dpo: 0.2609 ms (0.0003 s)\n", + "[+] ebsw: 32.8209 ms (0.0328 s)\n", + "[+] efi: 0.3015 ms (0.0003 s)\n", + "[+] ema: 0.1321 ms (0.0001 s)\n", + "[+] entropy: 0.4190 ms (0.0004 s)\n", + "[+] eom: 0.7204 ms (0.0007 s)\n", + "[+] er: 0.3111 ms (0.0003 s)\n", + "[+] eri: 0.4754 ms (0.0005 s)\n", + "[+] exhc: 0.2393 ms (0.0002 s)\n", + "[+] fisher: 4.2469 ms (0.0042 s)\n", + "[+] fwma: 1.2835 ms (0.0013 s)\n", + "[+] ha: 0.4299 ms (0.0004 s)\n", + "[+] hilo: 32.5812 ms (0.0326 s)\n", + "[+] hl2: 0.1958 ms (0.0002 s)\n", + "[+] hlc3: 0.2522 ms (0.0003 s)\n", + "[+] hma: 0.2930 ms (0.0003 s)\n", + "[+] ht_trendline: 0.2998 ms (0.0003 s)\n", + "[+] hwc: 11.4790 ms (0.0115 s)\n", + "[+] hwma: 5.3904 ms (0.0054 s)\n", + "[+] ifisher: 0.4065 ms (0.0004 s)\n", + "[+] increasing: 0.2175 ms (0.0002 s)\n", + "[+] inertia: 1.5922 ms (0.0016 s)\n", + "[+] jma: 25.0673 ms (0.0251 s)\n", + "[+] kama: 4.9924 ms (0.0050 s)\n", + "[+] kc: 0.7583 ms (0.0008 s)\n", + "[+] kdj: 1.0338 ms (0.0010 s)\n", + "[+] kst: 0.9709 ms (0.0010 s)\n", + "[+] kurtosis: 0.2154 ms (0.0002 s)\n", + "[+] kvo: 1.8628 ms (0.0019 s)\n", + "[+] linreg: 0.1584 ms (0.0002 s)\n", + "[+] log_return: 0.1518 ms (0.0002 s)\n", + "[+] long_run: 0.0010 ms (0.0000 s)\n", + "[+] macd: 0.3461 ms (0.0003 s)\n", + "[+] mad: 12.6799 ms (0.0127 s)\n", + "[+] mama: 0.3712 ms (0.0004 s)\n", + "[+] massi: 0.5951 ms (0.0006 s)\n", + "[+] mcgd: 1.7917 ms (0.0018 s)\n", + "[+] median: 0.6277 ms (0.0006 s)\n", + "[+] mfi: 0.3785 ms (0.0004 s)\n", + "[+] midpoint: 0.1389 ms (0.0001 s)\n", + "[+] midprice: 0.1962 ms (0.0002 s)\n", + "[+] mom: 0.1234 ms (0.0001 s)\n", + "[+] natr: 0.2719 ms (0.0003 s)\n", + "[+] nvi: 1.3096 ms (0.0013 s)\n", + "[+] obv: 0.2220 ms (0.0002 s)\n", + "[+] ohlc4: 0.3267 ms (0.0003 s)\n", + "[+] pdist: 0.9833 ms (0.0010 s)\n", + "[+] percent_return: 0.1630 ms (0.0002 s)\n", + "[+] pgo: 0.5245 ms (0.0005 s)\n", + "[+] pivots: 9.1797 ms (0.0092 s)\n", + "[+] ppo: 0.6126 ms (0.0006 s)\n", + "[+] psar: 45.4192 ms (0.0454 s)\n", + "[+] psl: 0.8661 ms (0.0009 s)\n", + "[+] pvi: 1.3073 ms (0.0013 s)\n", + "[+] pvo: 0.5056 ms (0.0005 s)\n", + "[+] pvol: 0.2196 ms (0.0002 s)\n", + "[+] pvr: 0.9811 ms (0.0010 s)\n", + "[+] pvt: 0.2975 ms (0.0003 s)\n", + "[+] pwma: 1.3154 ms (0.0013 s)\n", + "[+] qqe: 77.5280 ms (0.0775 s)\n", + "[+] qstick: 0.3504 ms (0.0004 s)\n", + "[+] quantile: 0.6113 ms (0.0006 s)\n", + "[+] reflex: 0.1622 ms (0.0002 s)\n", + "[+] remap: 0.1189 ms (0.0001 s)\n", + "[+] rma: 0.1654 ms (0.0002 s)\n", + "[+] roc: 0.1144 ms (0.0001 s)\n", + "[+] rsi: 0.1217 ms (0.0001 s)\n", + "[+] rsx: 6.2928 ms (0.0063 s)\n", + "[+] rvgi: 4.0759 ms (0.0041 s)\n", + "[+] rvi: 1.4748 ms (0.0015 s)\n", + "[+] rwi: 0.7034 ms (0.0007 s)\n", + "[+] short_run: 0.0012 ms (0.0000 s)\n", + "[+] sinwma: 16.7935 ms (0.0168 s)\n", + "[+] skew: 0.3936 ms (0.0004 s)\n", + "[+] slope: 0.1543 ms (0.0002 s)\n", + "[+] sma: 0.1322 ms (0.0001 s)\n", + "[+] smi: 0.9507 ms (0.0010 s)\n", + "[+] smma: 14.6568 ms (0.0147 s)\n", + "[+] squeeze: 1.9718 ms (0.0020 s)\n", + "[+] squeeze_pro: 3.3595 ms (0.0034 s)\n", + "[+] ssf: 0.1400 ms (0.0001 s)\n", + "[+] ssf3: 0.1282 ms (0.0001 s)\n", + "[+] stc: 38.1158 ms (0.0381 s)\n", + "[+] stdev: 0.2112 ms (0.0002 s)\n", + "[+] stoch: 0.5241 ms (0.0005 s)\n", + "[+] stochf: 0.4110 ms (0.0004 s)\n", + "[+] stochrsi: 0.9426 ms (0.0009 s)\n", + "[+] supertrend: 17.5296 ms (0.0175 s)\n", + "[+] swma: 1.3342 ms (0.0013 s)\n", + "[+] t3: 0.1748 ms (0.0002 s)\n", + "[+] tema: 0.1432 ms (0.0001 s)\n", + "[+] thermo: 1.0190 ms (0.0010 s)\n", + "[+] tmo: 0.8775 ms (0.0009 s)\n", + "[+] tos_stdevall: 1.5770 ms (0.0016 s)\n", + "[+] trendflex: 0.1647 ms (0.0002 s)\n", + "[+] trima: 0.1258 ms (0.0001 s)\n", + "[+] trix: 0.7493 ms (0.0007 s)\n", + "[+] true_range: 0.2955 ms (0.0003 s)\n", + "[+] tsi: 0.6046 ms (0.0006 s)\n", + "[+] tsignals: 0.0012 ms (0.0000 s)\n", + "[+] ttm_trend: 1.1446 ms (0.0011 s)\n", + "[+] ui: 0.4804 ms (0.0005 s)\n", + "[+] uo: 0.2868 ms (0.0003 s)\n", + "[+] variance: 0.1323 ms (0.0001 s)\n", + "[+] vhf: 0.6500 ms (0.0007 s)\n", + "[+] vhm: 0.6075 ms (0.0006 s)\n", + "[+] vidya: 33.7498 ms (0.0337 s)\n", + "[+] vortex: 0.8541 ms (0.0009 s)\n", + "[+] vwap: 9.1787 ms (0.0092 s)\n", + "[+] vwma: 0.3478 ms (0.0003 s)\n", + "[+] wb_tsv: 1.6137 ms (0.0016 s)\n", + "[+] wcp: 0.2640 ms (0.0003 s)\n", + "[+] willr: 0.2671 ms (0.0003 s)\n", + "[+] wma: 0.1156 ms (0.0001 s)\n", + "[+] xsignals: 0.0013 ms (0.0000 s)\n", + "[+] zlma: 0.2800 ms (0.0003 s)\n", + "[+] zscore: 0.2717 ms (0.0003 s)\n", "\n", "============================================================\n", - " Slowest 10 Indicators [154]\n", - " Observations[talib]: 1259\n", + " Slowest 10 Indicators [155]\n", + " Observations[talib]: 1260\n", "============================================================\n", - " ms secs\n", - "Indicator \n", - "td_seq 809.2238 0.80922\n", - "qqe 98.3270 0.09833\n", - "alligator 63.6065 0.06361\n", - "psar 55.9114 0.05591\n", - "hilo 42.5026 0.04250\n", - "ebsw 34.1789 0.03418\n", - "stc 25.1997 0.02520\n", - "supertrend 24.5619 0.02456\n", - "jma 24.4935 0.02449\n", - "vidya 23.9921 0.02399\n", + " ms secs\n", + "Indicator \n", + "qqe 77.5280 0.07753\n", + "alligator 47.4284 0.04743\n", + "psar 45.4192 0.04542\n", + "stc 38.1158 0.03812\n", + "vidya 33.7498 0.03375\n", + "ebsw 32.8209 0.03282\n", + "hilo 32.5812 0.03258\n", + "jma 25.0673 0.02507\n", + "supertrend 17.5296 0.01753\n", + "sinwma 16.7935 0.01679\n", "\n", "============================================================\n", "Time Stats:\n", - " ms secs\n", - "min 0.001300 0.000000\n", - "50% 0.656200 0.000660\n", - "mean 9.306636 0.009306\n", - "max 809.223800 0.809220\n", - "total 1433.222000 1.433160\n", + " ms secs\n", + "min 0.001000 0.000000\n", + "50% 0.505600 0.000510\n", + "mean 3.608235 0.003608\n", + "max 77.528000 0.077530\n", + "total 559.276400 0.559250\n", "\n", "============================================================\n", "\n" @@ -759,41 +773,53 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -803,60 +829,60 @@ " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 mssecsmssecs
Indicator
td_seq809.2238000.809220qqe77.5280000.077530
qqe98.3270000.098330alligator47.4284000.047430
alligator63.6065000.063610psar45.4192000.045420
psar55.9114000.055910stc38.1158000.038120
hilo42.5026000.042500vidya33.7498000.033750
ebsw34.1789000.034180ebsw32.8209000.032820
stc25.1997000.025200hilo32.5812000.032580
supertrend24.5619000.024560jma25.0673000.025070
jma24.4935000.024490supertrend17.5296000.017530
vidya23.9921000.023990sinwma16.7935000.016790
\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -902,40 +928,40 @@ " \n", " \n", " min\n", - " 0.001300\n", + " 0.001000\n", " 0.000000\n", " \n", " \n", " 50%\n", - " 0.656200\n", - " 0.000660\n", + " 0.505600\n", + " 0.000510\n", " \n", " \n", " mean\n", - " 9.306636\n", - " 0.009306\n", + " 3.608235\n", + " 0.003608\n", " \n", " \n", " max\n", - " 809.223800\n", - " 0.809220\n", + " 77.528000\n", + " 0.077530\n", " \n", " \n", " total\n", - " 1433.222000\n", - " 1.433160\n", + " 559.276400\n", + " 0.559250\n", " \n", " \n", "\n", "" ], "text/plain": [ - " ms secs\n", - "min 0.001300 0.000000\n", - "50% 0.656200 0.000660\n", - "mean 9.306636 0.009306\n", - "max 809.223800 0.809220\n", - "total 1433.222000 1.433160" + " ms secs\n", + "min 0.001000 0.000000\n", + "50% 0.505600 0.000510\n", + "mean 3.608235 0.003608\n", + "max 77.528000 0.077530\n", + "total 559.276400 0.559250" ] }, "execution_count": 10, @@ -965,7 +991,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "(1259, 7)\n" + "(1260, 8)\n" ] }, { @@ -1001,47 +1027,47 @@ " \n", " TA Lib\n", " ms\n", - " 0.0013\n", - " 0.656200\n", - " 9.306636\n", - " 809.22380\n", - " 1433.22200\n", + " 0.0010\n", + " 0.50560\n", + " 3.608235\n", + " 77.52800\n", + " 559.27640\n", " \n", " \n", " secs\n", " 0.0000\n", - " 0.000660\n", - " 0.009306\n", - " 0.80922\n", - " 1.43316\n", + " 0.00051\n", + " 0.003608\n", + " 0.07753\n", + " 0.55925\n", " \n", " \n", " Pandas TA\n", " ms\n", - " 0.0012\n", - " 1.278150\n", - " 9.757957\n", - " 809.45830\n", - " 1502.72540\n", + " 0.0011\n", + " 0.85210\n", + " 3.948935\n", + " 76.14230\n", + " 612.08500\n", " \n", " \n", " secs\n", " 0.0000\n", - " 0.001275\n", - " 0.009758\n", - " 0.80946\n", - " 1.50277\n", + " 0.00085\n", + " 0.003949\n", + " 0.07614\n", + " 0.61210\n", " \n", " \n", "\n", "" ], "text/plain": [ - " min 50% mean max total\n", - "TA Lib ms 0.0013 0.656200 9.306636 809.22380 1433.22200\n", - " secs 0.0000 0.000660 0.009306 0.80922 1.43316\n", - "Pandas TA ms 0.0012 1.278150 9.757957 809.45830 1502.72540\n", - " secs 0.0000 0.001275 0.009758 0.80946 1.50277" + " min 50% mean max total\n", + "TA Lib ms 0.0010 0.50560 3.608235 77.52800 559.27640\n", + " secs 0.0000 0.00051 0.003608 0.07753 0.55925\n", + "Pandas TA ms 0.0011 0.85210 3.948935 76.14230 612.08500\n", + " secs 0.0000 0.00085 0.003949 0.07614 0.61210" ] }, "execution_count": 11, @@ -1093,27 +1119,27 @@ " \n", " ms\n", " 0.0001\n", - " 0.621950\n", - " 0.451321\n", - " 0.23450\n", - " 69.50340\n", + " 0.34650\n", + " 0.340701\n", + " 1.38570\n", + " 52.80860\n", " \n", " \n", " secs\n", " 0.0000\n", - " 0.000615\n", - " 0.000452\n", - " 0.00024\n", - " 0.06961\n", + " 0.00034\n", + " 0.000341\n", + " 0.00139\n", + " 0.05285\n", " \n", " \n", "\n", "" ], "text/plain": [ - "Differences min 50% mean max total\n", - "ms 0.0001 0.621950 0.451321 0.23450 69.50340\n", - "secs 0.0000 0.000615 0.000452 0.00024 0.06961" + "Differences min 50% mean max total\n", + "ms 0.0001 0.34650 0.340701 1.38570 52.80860\n", + "secs 0.0000 0.00034 0.000341 0.00139 0.05285" ] }, "execution_count": 12, @@ -1135,14 +1161,6 @@ "outputs": [], "source": [] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea82127e-1969-4215-bfab-6c83209675a6", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "13b2b1a0-260d-4466-bc19-98f952ebbec1", @@ -1174,14 +1192,6 @@ "scdf.index.name = \"Indicator (ms)\"" ] }, - { - "cell_type": "markdown", - "id": "aa154cc6-005d-4b93-8349-c331eca5abbc", - "metadata": {}, - "source": [ - "#### Pandas TA is quicker than TA Lib when the dfference is positive" - ] - }, { "cell_type": "code", "execution_count": 15, @@ -1192,170 +1202,326 @@ "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", @@ -1366,934 +1532,940 @@ " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 TALPTAdiffTALPTAdiff
Indicator (ms)
td_seq822.621300769.86520052.756100qqe76.04400075.8194000.224600
alligator46.47950045.2544001.225100
stc28.13650025.4936002.642900psar45.20960043.0606002.149000
alligator62.54330060.7219001.821400stc37.36720036.7515000.615700
supertrend26.65730025.1139001.543400vidya34.06870034.942000-0.873300
qqe100.86000099.3591001.500900hilo32.81800032.6084000.209600
smma20.56390019.1257001.438200ebsw32.65440032.3484000.306000
vidya25.45210024.2242001.227900jma24.38310024.2552000.127900
squeeze_pro5.2094004.2356000.973800supertrend17.08080016.9512000.129600
rvgi7.1345006.2267000.907800sinwma16.47170016.608500-0.136800
wb_tsv2.6755002.0303000.645200cti16.11320015.3931000.720100
cdl_pattern8.3836007.7947000.588900smma14.72950014.847300-0.117800
vortex1.7289001.1700000.558900mad12.52610012.612000-0.085900
tos_stdevall2.8238002.2864000.537400hwc11.73270011.6443000.088400
vwap2.0594001.6091000.450300vwap8.8330008.5929000.240100
stochrsi1.4875001.1128000.374700pivots8.5574008.4948000.062600
squeeze3.3986003.0328000.365800cg6.3729006.519200-0.146300
rsx7.8669007.5031000.363800cdl_pattern6.2863006.2026000.083700
sinwma8.1089007.7480000.360900rsx6.2559006.2425000.013400
ebsw34.83410034.5076000.326500hwma5.4505005.3201000.130400
aberration1.4032001.1110000.292200kama4.6528004.5850000.067800
ttm_trend1.7328001.4606000.272200fisher4.2748004.2502000.024600
vwma0.6303000.3759000.254400rvgi3.9618004.001400-0.039600
thermo1.4540001.2362000.217800squeeze_pro2.9375002.961800-0.024300
tmo1.2399001.0227000.217200adx2.3052002.0171000.288100
swma2.1040001.9146000.189400aobv2.0016002.675200-0.673600
rvi2.2014002.0323000.169100brar1.8182001.887200-0.069000
ui0.7874000.6193000.168100kvo1.8168001.7929000.023900
vhf1.0215000.8873000.134200squeeze1.8023001.847300-0.045000
wcp0.4211000.2965000.124600mcgd1.7880001.796500-0.008500
smi1.2977001.1780000.119700wb_tsv1.6761001.6014000.074700
skew0.4265000.3299000.096600aberration1.6319000.6430000.988900
ssf0.2646000.1730000.091600amat1.6225001.864000-0.241500
mcgd1.9701001.8824000.087700inertia1.6067001.5648000.041900
trendflex0.2735000.2018000.071700tos_stdevall1.6042001.5755000.028700
pdist1.1588001.1049000.053900rvi1.4448001.4367000.008100
quantile0.7775000.7414000.036100chandelier_exit1.3155002.512400-1.196900
median0.7295000.6969000.032600pwma1.3058001.2307000.075100
pwma1.8320001.8010000.031000swma1.3030001.1945000.108500
accbands1.2167001.1861000.030600nvi1.2768001.2158000.061000
slope0.2656000.2372000.028400fwma1.2633001.265100-0.001800
vhm1.3715001.3431000.028400pvi1.2427001.1375000.105200
nvi1.4621001.4382000.023900cdl_z1.2289001.248600-0.019700
entropy0.6636000.6404000.023200alphatrend1.2052003.721200-2.516000
reflex0.2086000.1875000.021100accbands1.1290000.7540000.375000
rma0.2246000.2068000.017800ttm_trend1.1263001.130000-0.003700
ssf30.1593000.1430000.016300vortex1.0818000.8529000.228900
adx3.8850003.8693000.015700thermo1.0621000.9198000.142300
remap0.1530000.1423000.010700kdj0.9895000.9509000.038600
hlc30.3204000.3104000.010000cksp0.9755001.030900-0.055400
eom0.9814000.9738000.007600pvr0.9715000.8925000.079000
pvt0.3365000.3298000.006700kst0.9557000.9344000.021300
pvol0.2483000.2474000.000900tmo0.8968000.8577000.039100
xsignals0.0019000.0013000.000600smi0.8517000.856500-0.004800
tsignals0.0015000.0013000.000200stochrsi0.8309000.8007000.030200
short_run0.0015000.0014000.000100pdist0.8209000.8170000.003900
ohlc40.3733000.373900-0.000600chop0.8135000.880200-0.066700
long_run0.0012000.002000-0.000800trix0.7552001.235500-0.480300
percent_return0.1615000.170800-0.009300crsi0.7538002.257300-1.503500
efi0.5540000.566000-0.012000cmf0.7386000.754200-0.015600
pvr1.1726001.185300-0.012700eom0.7324000.738200-0.005800
pvo0.6345000.647300-0.012800kc0.6970000.6761000.020900
eri0.6664000.680400-0.014000rwi0.6960001.645900-0.949900
cfo0.3361000.353500-0.017400cube0.6687000.5956000.073100
dpo0.3237000.342800-0.019100psl0.6676000.6150000.052600
pgo0.5737000.593000-0.019300vhf0.6439000.648100-0.004200
alma0.5837000.604000-0.020300median0.6308000.6185000.012300
donchian0.8057000.827600-0.021900vhm0.6288000.5923000.036500
decreasing0.3246000.349500-0.024900tsi0.6225001.270000-0.647500
er0.4368000.461800-0.025000donchian0.6083000.5884000.019900
decay0.1652000.197200-0.032000quantile0.6005000.5978000.002700
mom0.1394000.178200-0.038800massi0.5882000.902500-0.314300
pvi1.4675001.506900-0.039400ifisher0.5831000.4061000.177000
cmf1.0346001.074500-0.039900bbands0.5824001.040800-0.458400
kurtosis0.2612000.302900-0.041700pvo0.5024000.4700000.032400
cdl_z1.6629001.709100-0.046200alma0.4981000.503600-0.005500
ha0.5803000.628800-0.048500pgo0.4923000.493500-0.001200
increasing0.3045000.356700-0.052200eri0.4848000.4730000.011800
ao0.5004000.554900-0.054500atrts0.4790001.755300-1.276300
coppock0.2963000.353200-0.056900stoch0.4754001.636000-1.160600
cksp1.3389001.398400-0.059500ad0.4612000.550000-0.088800
brar2.6318002.693400-0.061600ui0.4504000.4478000.002600
hma0.3680000.431300-0.063300entropy0.4412000.4394000.001800
hl20.2725000.351500-0.079000ppo0.4349001.427000-0.992100
variance0.1512000.230800-0.079600ha0.4346000.436300-0.001700
cg6.5069006.595800-0.088900aroon0.4268005.209700-4.782900
inertia1.9871002.076200-0.089100ao0.4093000.3956000.013700
stdev0.3307000.422800-0.092100stochf0.3986001.222600-0.824000
cube0.8152000.909200-0.094000adosc0.3809001.001800-0.620900
zlma0.4499000.562700-0.112800mfi0.3672000.430500-0.063300
psl0.9994001.113900-0.114500vwma0.3670000.3361000.030900
chop1.0981001.219500-0.121400dm0.3595001.556700-1.197200
fwma1.9277002.085000-0.157300mama0.3558000.3205000.035300
kvo2.2558002.435900-0.180100bop0.3520000.646500-0.294500
kc0.9550001.147600-0.192600atr0.3338001.358700-1.024900
mama0.4304000.623300-0.192900qstick0.3316000.570700-0.239100
qstick0.6190000.820300-0.201300ohlc40.3132000.339200-0.026000
sma0.1626000.371300-0.208700er0.3131000.315500-0.002400
kama7.5569007.772800-0.215900efi0.3098000.3065000.003300
ifisher0.5333000.751100-0.217800cci0.30730013.888200-13.580900
roc0.1537000.380700-0.227000macd0.3021001.404600-1.102500
hwc8.2330008.481500-0.248500true_range0.3003000.963900-0.663600
hwma7.3478007.624500-0.276700hma0.2956000.2901000.005500
midprice0.2252000.537700-0.312500pvt0.2948000.2792000.015600
ema0.1605000.478200-0.317700ht_trendline0.2855000.300200-0.014700
hilo41.22340041.556900-0.333500zlma0.2810000.450500-0.169500
midpoint0.1460000.482200-0.336200cfo0.2755000.291000-0.015500
mad14.09800014.451400-0.353400dpo0.2693000.270200-0.000900
willr0.3346000.705200-0.370600uo0.2663002.014600-1.748300
jma24.09140024.480200-0.388800natr0.2648001.540300-1.275500
kdj1.3451001.754100-0.409000wcp0.2639000.2630000.000900
cti15.12200015.533300-0.411300zscore0.2625000.778800-0.516300
ad0.4299000.852000-0.422100decreasing0.2584000.2428000.015600
trix1.1716001.606200-0.434600willr0.2568000.558900-0.302100
trima0.1677000.610900-0.443200hlc30.2560000.2477000.008300
zscore0.3884000.834100-0.445700increasing0.2556000.2167000.038900
kst1.3481001.824800-0.476700coppock0.2477000.255300-0.007600
bop0.3969000.877100-0.480200exhc0.2412000.2408000.000400
fisher5.7476006.228300-0.480700obv0.2302000.759300-0.529100
amat2.1829002.669800-0.486900bias0.2297000.748800-0.519100
log_return0.1780000.679300-0.501300pvol0.2191000.2070000.012100
pivots5.8912006.421200-0.530000tema0.2126000.751800-0.539200
bias0.2792000.832700-0.553500kurtosis0.2097000.2005000.009200
true_range0.3997000.984200-0.584500hl20.1975000.200500-0.003000
massi0.7650001.350000-0.585000midprice0.1922000.413800-0.221600
bbands0.8547001.502600-0.647900skew0.1870000.199200-0.012200
obv0.2424000.900300-0.657900stdev0.1682000.262000-0.093800
apo0.2154000.903500-0.688100trendflex0.1645000.1559000.008600
dema0.1710000.868800-0.697800rma0.1586000.1577000.000900
tsi0.9012001.662000-0.760800apo0.1573000.858600-0.701300
rwi1.2410002.074100-0.833100decay0.1557000.1531000.002600
tema0.2603001.112200-0.851900dema0.1556000.663000-0.507400
stochf0.6911001.568500-0.877400reflex0.1553000.156600-0.001300
adosc1.0555001.991900-0.936400linreg0.15320011.506700-11.353500
rsi0.1571001.106000-0.948900log_return0.1503000.151100-0.000800
atr0.4092001.545100-1.135900t30.1490001.424900-1.275900
aobv2.7723003.992500-1.220200cmo0.1475001.017000-0.869500
ppo0.5424001.763100-1.220700percent_return0.1430000.1413000.001700
chandelier_exit1.9430003.246500-1.303500midpoint0.1328000.349100-0.216300
psar56.37810057.757100-1.379000ssf0.1315000.135300-0.003800
natr0.3075001.752300-1.444800remap0.1272000.1187000.008500
atrts0.5791002.030600-1.451500rsi0.1246000.833100-0.708500
stoch0.8432002.346100-1.502900ema0.1240000.301500-0.177500
cmo0.1736001.769400-1.595800mom0.1229000.123900-0.001000
dm0.4548002.130500-1.675700trima0.1225000.609700-0.487200
t30.2725002.042300-1.769800ssf30.1204000.125700-0.005300
macd0.3904002.209000-1.818600variance0.1170000.185500-0.068500
uo0.3688002.320500-1.951700sma0.1168000.348100-0.231300
crsi0.9298002.921400-1.991600slope0.1157000.120800-0.005100
mfi0.4206003.160700-2.740100wma0.1138000.230300-0.116500
alphatrend1.4419004.320900-2.879000roc0.1124000.1117000.000700
aroon0.5442007.331100-6.786900xsignals0.0013000.001400-0.000100
wma0.1533008.255600-8.102300tsignals0.0011000.0011000.000000
linreg0.17580011.353300-11.177500short_run0.0010000.001100-0.000100
cci0.37860015.398900-15.020300long_run0.0009000.001100-0.000200
\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 15, @@ -2302,35 +2474,9 @@ } ], "source": [ - "scdf.sort_values(by=\"diff\", ascending=False, na_position=\"first\", inplace=True)\n", + "scdf.sort_values(by=[\"TAL\", \"diff\"], ascending=False, na_position=\"first\", inplace=True)\n", "scdf.style.background_gradient(\"autumn_r\")" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "180605d4-7c8c-4974-ae09-25b740503c6c", - "metadata": {}, - "outputs": [], - "source": [ - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "419dd000-35f0-41bb-b944-dca77df3f1cb", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4b1e8f4d-6189-4085-be71-85c09692475a", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -2349,7 +2495,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.1" + "version": "3.11.7" } }, "nbformat": 4, diff --git a/examples/ni.py b/examples/ni.py index 8c8a9523..04e5abed 100644 --- a/examples/ni.py +++ b/examples/ni.py @@ -36,7 +36,6 @@ def ni( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -65,8 +64,6 @@ def ni( # Handle fills if "fillna" in kwargs: ni.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ni.fillna(method=kwargs["fill_method"], inplace=True) # Name and Categorize it ni.name = f"ni_{length}" @@ -80,4 +77,4 @@ def ni( def ni_method(self, length=None, offset=None, **kwargs): close = self._get_column(kwargs.pop("close", "close")) result = ni(close=close, length=length, offset=offset, **kwargs) - return self._post_process(result, **kwargs) \ No newline at end of file + return self._post_process(result, **kwargs) diff --git a/pandas_ta/__init__.py b/pandas_ta/__init__.py index f06122aa..bd2f3db0 100644 --- a/pandas_ta/__init__.py +++ b/pandas_ta/__init__.py @@ -30,7 +30,8 @@ from pandas_ta.volatility import __all__ as volatility_all from pandas_ta.volume import __all__ as volume_all -# Common Averages useful for Indicators with a mamode argument, like ta.adx() +# Common Averages useful for Indicators +# with a mamode argument, like ta.adx() from pandas_ta.ma import ma # Custom External Directory Commands. See help(import_dir) diff --git a/pandas_ta/_typing.py b/pandas_ta/_typing.py index 12bb924f..777dbde2 100644 --- a/pandas_ta/_typing.py +++ b/pandas_ta/_typing.py @@ -14,6 +14,7 @@ from sys import float_info as sflt + # Generic types T = TypeVar("T") diff --git a/pandas_ta/candles/cdl_doji.py b/pandas_ta/candles/cdl_doji.py index fa898e0a..12b67a7a 100644 --- a/pandas_ta/candles/cdl_doji.py +++ b/pandas_ta/candles/cdl_doji.py @@ -7,6 +7,7 @@ from pandas_ta.utils import v_scalar, v_series + def cdl_doji( open_: Series, high: Series, low: Series, close: Series, length: Int = None, factor: IntFloat = None, scalar: IntFloat = None, @@ -37,7 +38,6 @@ def cdl_doji( the length if less than a percentage of it's high-low range. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: CDL_DOJI column. @@ -75,8 +75,6 @@ def cdl_doji( # Fill if "fillna" in kwargs: doji.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - doji.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category doji.name = f"CDL_DOJI_{length}_{0.01 * factor}" diff --git a/pandas_ta/candles/cdl_inside.py b/pandas_ta/candles/cdl_inside.py index 9b2bbe6d..1fdd7043 100644 --- a/pandas_ta/candles/cdl_inside.py +++ b/pandas_ta/candles/cdl_inside.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_bool, v_offset, v_offset, v_scalar, v_series + @njit def np_cdl_inside(high, low): hdiff = where(high - roll(high, 1) < 0, 1, 0) @@ -43,7 +44,6 @@ def cdl_inside( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature @@ -76,9 +76,6 @@ def cdl_inside( # Fill if "fillna" in kwargs: inside.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - inside.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category inside.name = f"CDL_INSIDE" inside.category = "candles" diff --git a/pandas_ta/candles/cdl_pattern.py b/pandas_ta/candles/cdl_pattern.py index 274ff11b..4b29ac5f 100644 --- a/pandas_ta/candles/cdl_pattern.py +++ b/pandas_ta/candles/cdl_pattern.py @@ -6,6 +6,7 @@ from pandas_ta.candles import cdl_doji, cdl_inside + ALL_PATTERNS = [ "2crows", "3blackcrows", "3inside", "3linestrike", "3outside", "3starsinsouth", "3whitesoldiers", "abandonedbaby", "advanceblock", @@ -58,8 +59,6 @@ def cdl_pattern( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method - Returns: pd.DataFrame: one column for each pattern. """ @@ -117,10 +116,6 @@ def cdl_pattern( # Fill if "fillna" in kwargs: pattern_result.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pattern_result.fillna( - method=kwargs["fill_method"], inplace=True) - result[f"CDL_{n.upper()}"] = pattern_result if len(result) == 0: diff --git a/pandas_ta/candles/cdl_z.py b/pandas_ta/candles/cdl_z.py index 96dc10ca..a136f7a0 100644 --- a/pandas_ta/candles/cdl_z.py +++ b/pandas_ta/candles/cdl_z.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series + def cdl_z( open_: Series, high: Series, low: Series, close: Series, length: Int = None, full: bool = None, ddof: Int = None, @@ -30,7 +31,6 @@ def cdl_z( the length if less than a percentage of it's high-low range. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: CDL_DOJI column. @@ -78,8 +78,6 @@ def cdl_z( # Fill if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category df.name = f"CDL_Z{_props}" diff --git a/pandas_ta/candles/ha.py b/pandas_ta/candles/ha.py index 993c7e3b..c492b04a 100644 --- a/pandas_ta/candles/ha.py +++ b/pandas_ta/candles/ha.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_offset, v_series + @njit def np_ha(np_open, np_high, np_low, np_close): ha_close = 0.25 * (np_open + np_high + np_low + np_close) @@ -49,7 +50,6 @@ def ha( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: ha_open, ha_high,ha_low, ha_close columns. @@ -82,8 +82,6 @@ def ha( # Fill if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category df.name = "Heikin-Ashi" diff --git a/pandas_ta/core.py b/pandas_ta/core.py index c3f90f24..77a7f198 100644 --- a/pandas_ta/core.py +++ b/pandas_ta/core.py @@ -568,7 +568,8 @@ def study(self, *args: Args, **kwargs: DictLike) -> dataclass: Default: Number of cores of the OS exclude (list): List of indicator names to exclude. Some are excluded by default for various reasons; they require additional - sources, performance (td_seq), not a time series chart (vp) etc. + sources (tsignals, xsignals), performance, , not a time series + chart (vp) etc. name (str): Select all indicators or indicators by Category such as: "candles", "cycles", "momentum", "overlap", "performance", "statistics", "trend", "volatility", "volume", or @@ -962,6 +963,11 @@ def eri(self, length=None, offset=None, **kwargs: DictLike): result = eri(high=high, low=low, close=close, length=length, offset=offset, **kwargs) return self._post_process(result, **kwargs) + def exhc(self, length=None, cap=None, asint=None, show_all=None, nozeros=None, offset=None, **kwargs: DictLike): + close = self._get_column(kwargs.pop("close", "close")) + result = exhc(close=close, length=length, cap=cap, asint=asint, show_all=show_all, nozeros=nozeros, offset=offset, **kwargs) + return self._post_process(result, **kwargs) + def fisher(self, length=None, signal=None, offset=None, **kwargs: DictLike): high = self._get_column(kwargs.pop("high", "high")) low = self._get_column(kwargs.pop("low", "low")) @@ -1110,11 +1116,6 @@ def stochrsi(self, length=None, rsi_length=None, k=None, d=None, mamode=None, of mamode=mamode, offset=offset, **kwargs) return self._post_process(result, **kwargs) - def td_seq(self, asint=None, offset=None, show_all=None, **kwargs: DictLike): - close = self._get_column(kwargs.pop("close", "close")) - result = td_seq(close=close, asint=asint, offset=offset, show_all=show_all, **kwargs) - return self._post_process(result, **kwargs) - def tmo(self, tmo_length=None, calc_length=None, smooth_length=None, mamode=None, compute_momentum=False, normalize_signal=False, offset=None, **kwargs: DictLike): open_ = self._get_column(kwargs.pop("open", "open")) close = self._get_column(kwargs.pop("close", "close")) @@ -1501,9 +1502,9 @@ def dpo(self, length=None, centered=True, offset=None, **kwargs: DictLike): result = dpo(close=close, length=length, centered=centered, offset=offset, **kwargs) return self._post_process(result, **kwargs) - def ht_trendline(self, offset=None, **kwargs: DictLike): + def ht_trendline(self, talib=None, prenan=None, offset=None, **kwargs: DictLike): close = self._get_column(kwargs.pop("close", "close")) - result = ht_trendline(close=close, offset=offset) + result = ht_trendline(close=close, talib=talib, prenan=prenan, offset=offset, **kwargs) return self._post_process(result, **kwargs) def increasing(self, length=None, strict=None, asint=None, offset=None, **kwargs: DictLike): diff --git a/pandas_ta/custom.py b/pandas_ta/custom.py index 658ccac3..20ab0171 100644 --- a/pandas_ta/custom.py +++ b/pandas_ta/custom.py @@ -10,6 +10,7 @@ from pandas_ta._typing import DictLike + def bind(name: str, f: types.FunctionType, method: types.MethodType = None): """ Helper function to bind the function and class method defined in a custom diff --git a/pandas_ta/cycles/ebsw.py b/pandas_ta/cycles/ebsw.py index 04ce6f1b..ee2f967b 100644 --- a/pandas_ta/cycles/ebsw.py +++ b/pandas_ta/cycles/ebsw.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def ebsw( close: Series, length: Int = None, bars: Int = None, initial_version: bool = False, @@ -45,8 +46,6 @@ def ebsw( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method - Returns: pd.Series: New feature generated. """ @@ -146,9 +145,6 @@ def ebsw( # Fill if "fillna" in kwargs: ebsw.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ebsw.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category ebsw.name = f"EBSW_{length}_{bars}" ebsw.category = "cycles" diff --git a/pandas_ta/cycles/reflex.py b/pandas_ta/cycles/reflex.py index ccdaa2d7..ae707fbd 100644 --- a/pandas_ta/cycles/reflex.py +++ b/pandas_ta/cycles/reflex.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + @njit def np_reflex(x, n, k, alpha, pi, sqrt2): m, ratio = x.size, 2 * sqrt2 / k @@ -73,8 +74,6 @@ def reflex( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method - Returns: pd.Series: New feature generated. """ @@ -105,9 +104,6 @@ def reflex( # Fill if "fillna" in kwargs: result.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - result.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category result.name = f"REFLEX_{length}_{smooth}_{alpha}" result.category = "cycles" diff --git a/pandas_ta/ma.py b/pandas_ta/ma.py index 0781e6f8..573a9517 100644 --- a/pandas_ta/ma.py +++ b/pandas_ta/ma.py @@ -20,6 +20,7 @@ from pandas_ta.overlap.wma import wma + def ma(name: str = None, source: Series = None, **kwargs: DictLike) -> Series: """Simple MA Utility for easier MA selection @@ -69,4 +70,4 @@ def ma(name: str = None, source: Series = None, **kwargs: DictLike) -> Series: elif name == "trima": return trima(source, **kwargs) elif name == "vidya": return vidya(source, **kwargs) elif name == "wma": return wma(source, **kwargs) - else: return ema(source, **kwargs) \ No newline at end of file + else: return ema(source, **kwargs) diff --git a/pandas_ta/maps.py b/pandas_ta/maps.py index fcf8d3f1..e0692bc1 100644 --- a/pandas_ta/maps.py +++ b/pandas_ta/maps.py @@ -5,7 +5,6 @@ from pandas_ta._typing import Dict, IntFloat, ListStr - _dist = get_distribution("pandas_ta") try: # Normalize case for Windows systems @@ -49,10 +48,11 @@ # Momentum "momentum": [ "ao", "apo", "bias", "bop", "brar", "cci", "cfo", "cg", "cmo", - "coppock", "crsi", "cti", "er", "eri", "fisher", "inertia", "kdj", "kst", - "macd", "mom", "pgo", "ppo", "psl", "qqe", "roc", "rsi", "rsx", - "rvgi", "slope", "smi", "squeeze", "squeeze_pro", "stc", "stoch", - "stochf", "stochrsi", "td_seq", "tmo", "trix", "tsi", "uo", "willr" + "coppock", "crsi", "cti", "er", "eri", "exhc", "fisher", "inertia", + "kdj", "kst", "macd", "mom", "pgo", "ppo", "psl", "qqe", "roc", + "rsi", "rsx", "rvgi", "slope", "smi", "squeeze", "squeeze_pro", + "stc", "stoch", "stochf", "stochrsi", "tmo", "trix", "tsi", "uo", + "willr" ], # Overlap "overlap": [ diff --git a/pandas_ta/momentum/__init__.py b/pandas_ta/momentum/__init__.py index d632a453..09add219 100644 --- a/pandas_ta/momentum/__init__.py +++ b/pandas_ta/momentum/__init__.py @@ -14,6 +14,7 @@ from .dm import dm from .er import er from .eri import eri +from .exhc import exhc from .fisher import fisher from .inertia import inertia from .kdj import kdj @@ -36,7 +37,6 @@ from .stoch import stoch from .stochf import stochf from .stochrsi import stochrsi -from .td_seq import td_seq from .tmo import tmo from .trix import trix from .tsi import tsi @@ -59,6 +59,7 @@ "dm", "er", "eri", + "exhc", "fisher", "inertia", "kdj", @@ -81,7 +82,6 @@ "stoch", "stochf", "stochrsi", - "td_seq", "tmo", "trix", "tsi", diff --git a/pandas_ta/momentum/ao.py b/pandas_ta/momentum/ao.py index abf57784..4c80891f 100644 --- a/pandas_ta/momentum/ao.py +++ b/pandas_ta/momentum/ao.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def ao( high: Series, low: Series, fast: Int = None, slow: Int = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def ao( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -60,9 +60,6 @@ def ao( # Fill if "fillna" in kwargs: ao.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ao.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category ao.name = f"AO_{fast}_{slow}" ao.category = "momentum" diff --git a/pandas_ta/momentum/apo.py b/pandas_ta/momentum/apo.py index 07c1c824..5b26a40e 100644 --- a/pandas_ta/momentum/apo.py +++ b/pandas_ta/momentum/apo.py @@ -7,6 +7,7 @@ from pandas_ta.utils import v_pos_default, v_series, v_talib + def apo( close: Series, fast: Int = None, slow: Int = None, mamode: str = None, talib: bool = None, @@ -33,7 +34,6 @@ def apo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -68,9 +68,6 @@ def apo( # Fill if "fillna" in kwargs: apo.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - apo.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category apo.name = f"APO_{fast}_{slow}" apo.category = "momentum" diff --git a/pandas_ta/momentum/bias.py b/pandas_ta/momentum/bias.py index d09c7586..12b4c8e2 100644 --- a/pandas_ta/momentum/bias.py +++ b/pandas_ta/momentum/bias.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_mamode, v_offset, v_pos_default, v_series + def bias( close: Series, length: Int = None, mamode: str = None, offset: Int = None, **kwargs: DictLike @@ -25,7 +26,6 @@ def bias( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -51,8 +51,6 @@ def bias( # Fill if "fillna" in kwargs: bias.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - bias.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category bias.name = f"BIAS_{bma.name}" diff --git a/pandas_ta/momentum/bop.py b/pandas_ta/momentum/bop.py index 1510da1c..81f01766 100644 --- a/pandas_ta/momentum/bop.py +++ b/pandas_ta/momentum/bop.py @@ -11,6 +11,7 @@ ) + def bop( open_: Series, high: Series, low: Series, close: Series, scalar: IntFloat = None, talib: bool = None, @@ -35,7 +36,6 @@ def bop( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -65,8 +65,6 @@ def bop( # Fill if "fillna" in kwargs: bop.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - bop.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category bop.name = f"BOP" diff --git a/pandas_ta/momentum/brar.py b/pandas_ta/momentum/brar.py index 72b7c35a..9579a8bb 100644 --- a/pandas_ta/momentum/brar.py +++ b/pandas_ta/momentum/brar.py @@ -11,6 +11,7 @@ ) + def brar( open_: Series, high: Series, low: Series, close: Series, length: Int = None, scalar: IntFloat = None, drift: Int = None, @@ -36,7 +37,6 @@ def brar( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: ar, br columns. @@ -79,9 +79,6 @@ def brar( if "fillna" in kwargs: ar.fillna(kwargs["fillna"], inplace=True) br.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ar.fillna(method=kwargs["fill_method"], inplace=True) - br.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}" diff --git a/pandas_ta/momentum/cci.py b/pandas_ta/momentum/cci.py index d4cbcc42..49b8ddd2 100644 --- a/pandas_ta/momentum/cci.py +++ b/pandas_ta/momentum/cci.py @@ -7,6 +7,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, v_talib + def cci( high: Series, low: Series, close: Series, length: Int = None, c: IntFloat = None, talib: bool = None, @@ -32,7 +33,6 @@ def cci( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -68,8 +68,6 @@ def cci( # Fill if "fillna" in kwargs: cci.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - cci.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category cci.name = f"CCI_{length}_{c}" diff --git a/pandas_ta/momentum/cfo.py b/pandas_ta/momentum/cfo.py index c837810a..fb271b53 100644 --- a/pandas_ta/momentum/cfo.py +++ b/pandas_ta/momentum/cfo.py @@ -11,6 +11,7 @@ ) + def cfo( close: Series, length: Int = None, scalar: IntFloat = None, drift: Int = None, @@ -34,7 +35,6 @@ def cfo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -61,8 +61,6 @@ def cfo( # Fill if "fillna" in kwargs: cfo.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - cfo.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category cfo.name = f"CFO_{length}" diff --git a/pandas_ta/momentum/cg.py b/pandas_ta/momentum/cg.py index 1379aa06..5ea4c08e 100644 --- a/pandas_ta/momentum/cg.py +++ b/pandas_ta/momentum/cg.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, weights + def cg( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -23,7 +24,6 @@ def cg( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -49,8 +49,6 @@ def cg( # Fill if "fillna" in kwargs: cg.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - cg.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category cg.name = f"CG_{length}" diff --git a/pandas_ta/momentum/cmo.py b/pandas_ta/momentum/cmo.py index 23968274..aeeb5d11 100644 --- a/pandas_ta/momentum/cmo.py +++ b/pandas_ta/momentum/cmo.py @@ -38,7 +38,6 @@ def cmo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -80,8 +79,6 @@ def cmo( # Fill if "fillna" in kwargs: cmo.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - cmo.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category cmo.name = f"CMO_{length}" diff --git a/pandas_ta/momentum/coppock.py b/pandas_ta/momentum/coppock.py index 01001c97..27c354c0 100644 --- a/pandas_ta/momentum/coppock.py +++ b/pandas_ta/momentum/coppock.py @@ -7,6 +7,7 @@ from .roc import roc + def coppock( close: Series, length: Int = None, fast: Int = None, slow: Int = None, offset: Int = None, **kwargs: DictLike @@ -31,7 +32,6 @@ def coppock( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -59,8 +59,6 @@ def coppock( # Fill if "fillna" in kwargs: coppock.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - coppock.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category coppock.name = f"COPC_{fast}_{slow}_{length}" diff --git a/pandas_ta/momentum/crsi.py b/pandas_ta/momentum/crsi.py index 46bfcaf9..f0f697fa 100644 --- a/pandas_ta/momentum/crsi.py +++ b/pandas_ta/momentum/crsi.py @@ -1,7 +1,16 @@ # -*- coding: utf-8 -*- -import numpy as np +from numpy import ( + concatenate, + diff, + full, + nan, + nanmean, + newaxis, + sign, +) +from numpy.lib.stride_tricks import sliding_window_view from pandas import Series -from pandas_ta._typing import Array1d, DictLike, Int, IntFloat +from pandas_ta._typing import Array, DictLike, Int, IntFloat from pandas_ta.maps import Imports from pandas_ta.momentum.rsi import rsi from pandas_ta.utils import ( @@ -14,7 +23,8 @@ ) -def consecutive_streak(x: Array1d) -> Array1d: + +def consecutive_streak(x: Array) -> Array: """Calculate the streak of consecutive price increases or decreases. This function computes the streak of consecutive daily price increases @@ -41,9 +51,7 @@ def consecutive_streak(x: Array1d) -> Array1d: >>> np.array_equal(result, expected_result) True """ - diff = np.diff(x) - streaks = np.sign(diff) - return np.concatenate(([0], streaks)) + return concatenate(([0], sign(diff(x)))) def percent_rank(x: Series, lookback: Int) -> Series: @@ -78,13 +86,11 @@ def percent_rank(x: Series, lookback: Int) -> Series: """ daily_returns_np = x.pct_change().to_numpy() - rolling_windows = np.lib.stride_tricks.sliding_window_view( - daily_returns_np, window_shape=(lookback + 1,) - ) - comparison_matrix = rolling_windows[:, :-1] < rolling_windows[:, -1, np.newaxis] + rolling_windows = sliding_window_view(daily_returns_np, window_shape=(lookback + 1,)) + comparison_matrix = rolling_windows[:, :-1] < rolling_windows[:, -1, newaxis] - percent_ranks = np.nanmean(comparison_matrix, axis=1) * 100 - padded_percent_ranks = np.full(len(x), np.nan) + percent_ranks = nanmean(comparison_matrix, axis=1) * 100 + padded_percent_ranks = full(len(x), nan) padded_percent_ranks[lookback:] = percent_ranks return Series(padded_percent_ranks, index=x.index) @@ -121,7 +127,6 @@ def crsi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated @@ -175,8 +180,6 @@ def crsi( # Fill if "fillna" in kwargs: crsi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - crsi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category crsi.name = f"CRSI_{length_rsi}_{length_streak}_{length_rank}" diff --git a/pandas_ta/momentum/cti.py b/pandas_ta/momentum/cti.py index 159fb239..6121c4f3 100644 --- a/pandas_ta/momentum/cti.py +++ b/pandas_ta/momentum/cti.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def cti( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -24,7 +25,6 @@ def cti( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: Series of the CTI values for the given period. @@ -48,8 +48,6 @@ def cti( # Fill if "fillna" in kwargs: cti.fillna(method=kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - cti.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category cti.name = f"CTI_{length}" diff --git a/pandas_ta/momentum/dm.py b/pandas_ta/momentum/dm.py index 3acad40a..0e13aee7 100644 --- a/pandas_ta/momentum/dm.py +++ b/pandas_ta/momentum/dm.py @@ -14,6 +14,7 @@ ) + def dm( high: Series, low: Series, length: Int = None, mamode: str = None, talib: bool = None, drift: Int = None, @@ -40,7 +41,6 @@ def dm( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: DMP (+DM) and DMN (-DM) columns. @@ -85,9 +85,6 @@ def dm( if "fillna" in kwargs: pos.fillna(kwargs["fillna"], inplace=True) neg.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pos.fillna(method=kwargs["fill_method"], inplace=True) - neg.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}" diff --git a/pandas_ta/momentum/er.py b/pandas_ta/momentum/er.py index b7dfdf66..03ff0410 100644 --- a/pandas_ta/momentum/er.py +++ b/pandas_ta/momentum/er.py @@ -10,6 +10,7 @@ ) + def er( close: Series, length: Int = None, drift: Int = None, offset: Int = None, **kwargs: DictLike @@ -33,7 +34,6 @@ def er( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -62,8 +62,6 @@ def er( # Fill if "fillna" in kwargs: er.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - er.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category er.name = f"ER_{length}" diff --git a/pandas_ta/momentum/eri.py b/pandas_ta/momentum/eri.py index 6ad413c3..104b89b3 100644 --- a/pandas_ta/momentum/eri.py +++ b/pandas_ta/momentum/eri.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def eri( high: Series, low: Series, close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -32,7 +33,6 @@ def eri( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: bull power and bear power columns. @@ -62,9 +62,6 @@ def eri( if "fillna" in kwargs: bull.fillna(kwargs["fillna"], inplace=True) bear.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - bull.fillna(method=kwargs["fill_method"], inplace=True) - bear.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category bull.name = f"BULLP_{length}" diff --git a/pandas_ta/momentum/exhc.py b/pandas_ta/momentum/exhc.py new file mode 100644 index 00000000..acad1aa2 --- /dev/null +++ b/pandas_ta/momentum/exhc.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +from math import isnan +from numpy import ( + clip, + cumsum, + diff, + float64, + int64, + isnan, + nan, + nan_to_num, + where, + zeros_like +) +from numba import njit +from pandas import DataFrame, Series +from pandas_ta._typing import DictLike, Int +from pandas_ta.utils import ( + nb_ffill, + nb_idiff, + nb_shift, + v_bool, + v_int, + v_offset, + v_pos_default, + v_series +) + + + +@njit +def nb_exhc(x, n, cap, lb, ub, show_all): + x_diff = nb_idiff(x, n) + neg_diff, pos_diff = x_diff < 0, x_diff > 0 + + dn_csum = cumsum(neg_diff) + up_csum = cumsum(pos_diff) + + dn = dn_csum - nb_ffill(where(~neg_diff, dn_csum, nan)) + up = up_csum - nb_ffill(where(~pos_diff, up_csum, nan)) + + if cap > 0: + dn = clip(dn, 0, cap) + up = clip(up, 0, cap) + + if show_all: + dn = where(dn == 0, 0, dn) + up = where(up == 0, 0, up) + else: + between_lu = (dn >= lb) & (dn <= ub) + dn = where(between_lu, dn, 0) + up = where(between_lu, up, 0) + + return dn, up + + +def exhc( + close: Series, length: Int = None, + cap: Int = None, asint: bool = None, + show_all: bool = None, nozeros: bool = None, + offset: Int = None, **kwargs: DictLike +) -> DataFrame: + """Exhaustion Count (EXHC) + + Inspired by Tom DeMark's Sequential indicator which attempts + to identify where an uptrend or a downtrend exhausts and reverses. + + Sources: + https://demark.com + http://practicaltechnicalanalysis.blogspot.com/2013/01/tom-demark-sequential.html + + Args: + close (pd.Series): Series of close's + length (int): Difference for the sequences. Default: 4 + cap (int): Maximum sequence number to cap at. Set to zero for + no max. Default: 13 + show_all (bool): Show 1 - 13. If set to False, show 6 - 9. + Default: True + asint (bool): If True, fillna's with 0 and change type to int. + Default: False + nozeros (bool): If True, replaces zeros with nan. Default: False + offset (int): How many periods to offset the result. Default: 0 + + Returns: + pd.DataFrame: Down count, Up count + """ + # Validate + length = v_pos_default(length, 4) + close = v_series(close, length + 1) + + if close is None: + return + + cap = v_int(cap, 13, -1) + show_all = v_bool(show_all, True) + asint = v_bool(asint, False) + nozeros = v_bool(nozeros, False) + offset = v_offset(offset) + + # Calculate + np_close = close.values + dn, up = nb_exhc(np_close, length, cap, 6, 9, show_all) + + if asint: + dn = dn.astype(int64) + up = up.astype(int64) + + # Name and Category + data = { + "EXHC_DNa" if show_all else "EXHC_DN": dn, + "EXHC_UPa" if show_all else "EXHC_UP": up + } + df = DataFrame(data, index=close.index) + df.name = "EXHCa" if show_all else "EXHC" + df.category = "momentum" + + if nozeros: + df.replace({0: nan}, inplace=True) + + # Offset + if offset != 0: + df = df.shift(offset) + + return df diff --git a/pandas_ta/momentum/fisher.py b/pandas_ta/momentum/fisher.py index ae961067..4413c298 100644 --- a/pandas_ta/momentum/fisher.py +++ b/pandas_ta/momentum/fisher.py @@ -6,6 +6,7 @@ from pandas_ta.utils import high_low_range, v_offset, v_pos_default, v_series + def fisher( high: Series, low: Series, length: Int = None, signal: Int = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def fisher( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: fisher and signal columns @@ -81,9 +81,6 @@ def fisher( if "fillna" in kwargs: fisher.fillna(kwargs["fillna"], inplace=True) signalma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - fisher.fillna(method=kwargs["fill_method"], inplace=True) - signalma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{signal}" diff --git a/pandas_ta/momentum/inertia.py b/pandas_ta/momentum/inertia.py index 18ed2066..9fc3b8a5 100644 --- a/pandas_ta/momentum/inertia.py +++ b/pandas_ta/momentum/inertia.py @@ -15,6 +15,7 @@ from pandas_ta.volatility import rvi + def inertia( close: Series, high: Series = None, low: Series = None, length: Int = None, rvi_length: Int = None, scalar: IntFloat = None, @@ -48,7 +49,6 @@ def inertia( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -107,8 +107,6 @@ def inertia( # Fill if "fillna" in kwargs: inertia.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - inertia.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{rvi_length}" diff --git a/pandas_ta/momentum/kdj.py b/pandas_ta/momentum/kdj.py index 0fbf6883..647801ab 100644 --- a/pandas_ta/momentum/kdj.py +++ b/pandas_ta/momentum/kdj.py @@ -10,6 +10,7 @@ ) + def kdj( high: Series, low: Series, close: Series, length: Int = None, signal: Int = None, @@ -37,7 +38,6 @@ def kdj( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: k, d, and j columns @@ -77,10 +77,6 @@ def kdj( k.fillna(kwargs["fillna"], inplace=True) d.fillna(kwargs["fillna"], inplace=True) j.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - k.fillna(method=kwargs["fill_method"], inplace=True) - d.fillna(method=kwargs["fill_method"], inplace=True) - j.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _params = f"_{length}_{signal}" diff --git a/pandas_ta/momentum/kst.py b/pandas_ta/momentum/kst.py index ef2e7927..6d75fae2 100644 --- a/pandas_ta/momentum/kst.py +++ b/pandas_ta/momentum/kst.py @@ -5,6 +5,7 @@ from .roc import roc + def kst( close: Series, signal: Int = None, roc1: Int = None, roc2: Int = None, roc3: Int = None, roc4: Int = None, @@ -36,7 +37,6 @@ def kst( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: kst and kst_signal columns @@ -82,9 +82,6 @@ def kst( if "fillna" in kwargs: kst.fillna(kwargs["fillna"], inplace=True) kst_signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - kst.fillna(method=kwargs["fill_method"], inplace=True) - kst_signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category kst.name = f"KST_{roc1}_{roc2}_{roc3}_{roc4}_{sma1}_{sma2}_{sma3}_{sma4}" diff --git a/pandas_ta/momentum/macd.py b/pandas_ta/momentum/macd.py index d04ddb49..118fe6d5 100644 --- a/pandas_ta/momentum/macd.py +++ b/pandas_ta/momentum/macd.py @@ -12,6 +12,7 @@ ) + def macd( close: Series, fast: Int = None, slow: Int = None, signal: Int = None, talib: bool = None, @@ -41,7 +42,6 @@ def macd( asmode (value, optional): When True, enables AS version of MACD. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: macd, histogram, signal columns @@ -92,10 +92,6 @@ def macd( macd.fillna(kwargs["fillna"], inplace=True) histogram.fillna(kwargs["fillna"], inplace=True) signalma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - macd.fillna(method=kwargs["fill_method"], inplace=True) - histogram.fillna(method=kwargs["fill_method"], inplace=True) - signalma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _asmode = "AS" if as_mode else "" diff --git a/pandas_ta/momentum/mom.py b/pandas_ta/momentum/mom.py index 8645e176..b813c4e0 100644 --- a/pandas_ta/momentum/mom.py +++ b/pandas_ta/momentum/mom.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- +from numba import njit from pandas import Series from pandas_ta._typing import Array, DictLike, Int from pandas_ta.maps import Imports from pandas_ta.utils import ( - # np_prepend, + nb_idiff, v_offset, v_pos_default, v_series, @@ -12,11 +13,9 @@ - -# Mockup -# @njit -# def np_mom(x: Array, n: Int): -# return np_prepend(np_ma_diff(x, n), n) +@njit +def nb_mom(x, n): + return nb_idiff(x, n) def mom( @@ -40,7 +39,6 @@ def mom( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -60,7 +58,9 @@ def mom( from talib import MOM mom = MOM(close, length) else: - mom = close.diff(length) + np_close = close.values + _mom = nb_mom(np_close, length) + mom = Series(_mom, index=close.index) # Offset if offset != 0: @@ -69,8 +69,6 @@ def mom( # Fill if "fillna" in kwargs: mom.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - mom.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category mom.name = f"MOM_{length}" diff --git a/pandas_ta/momentum/pgo.py b/pandas_ta/momentum/pgo.py index ce8313a5..fa5b047d 100644 --- a/pandas_ta/momentum/pgo.py +++ b/pandas_ta/momentum/pgo.py @@ -6,6 +6,7 @@ from pandas_ta.volatility import atr + def pgo( high: Series, low: Series, close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -30,7 +31,6 @@ def pgo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -58,8 +58,6 @@ def pgo( # Fill if "fillna" in kwargs: pgo.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pgo.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pgo.name = f"PGO_{length}" diff --git a/pandas_ta/momentum/ppo.py b/pandas_ta/momentum/ppo.py index 160eef75..02c3deb1 100644 --- a/pandas_ta/momentum/ppo.py +++ b/pandas_ta/momentum/ppo.py @@ -15,6 +15,7 @@ ) + def ppo( close: Series, fast: Int = None, slow: Int = None, signal: Int = None, scalar: IntFloat = None, mamode: str = None, talib: bool = None, @@ -40,7 +41,6 @@ def ppo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: ppo, histogram, signal columns @@ -88,10 +88,6 @@ def ppo( ppo.fillna(kwargs["fillna"], inplace=True) histogram.fillna(kwargs["fillna"], inplace=True) signalma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ppo.fillna(method=kwargs["fill_method"], inplace=True) - histogram.fillna(method=kwargs["fill_method"], inplace=True) - signalma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{fast}_{slow}_{signal}" diff --git a/pandas_ta/momentum/psl.py b/pandas_ta/momentum/psl.py index b88c1fdf..5a14998f 100644 --- a/pandas_ta/momentum/psl.py +++ b/pandas_ta/momentum/psl.py @@ -3,6 +3,7 @@ from pandas import Series from pandas_ta._typing import DictLike, Int, IntFloat from pandas_ta.utils import ( + nb_idiff, v_drift, v_offset, v_pos_default, @@ -11,6 +12,7 @@ ) + def psl( close: Series, open_: Series = None, length: Int = None, scalar: IntFloat = None, drift: Int = None, @@ -36,7 +38,6 @@ def psl( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -71,8 +72,6 @@ def psl( # Fill if "fillna" in kwargs: psl.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - psl.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}" diff --git a/pandas_ta/momentum/qqe.py b/pandas_ta/momentum/qqe.py index e17c9a4f..0367f5c9 100644 --- a/pandas_ta/momentum/qqe.py +++ b/pandas_ta/momentum/qqe.py @@ -14,6 +14,7 @@ from .rsi import rsi + def qqe( close: Series, length: Int = None, smooth: Int = None, factor: IntFloat = None, @@ -50,7 +51,6 @@ def qqe( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: QQE, RSI_MA (basis), QQEl (long), QQEs (short) columns. @@ -149,11 +149,6 @@ def qqe( qqe.fillna(kwargs["fillna"], inplace=True) qqe_long.fillna(kwargs["fillna"], inplace=True) qqe_short.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rsi_ma.fillna(method=kwargs["fill_method"], inplace=True) - qqe.fillna(method=kwargs["fill_method"], inplace=True) - qqe_long.fillna(method=kwargs["fill_method"], inplace=True) - qqe_short.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"{_mode}_{length}_{smooth}_{factor}" diff --git a/pandas_ta/momentum/roc.py b/pandas_ta/momentum/roc.py index df752056..1e993119 100644 --- a/pandas_ta/momentum/roc.py +++ b/pandas_ta/momentum/roc.py @@ -1,29 +1,24 @@ # -*- coding: utf-8 -*- +from numba import njit from pandas import Series from pandas_ta._typing import Array, DictLike, Int, IntFloat from pandas_ta.maps import Imports from pandas_ta.utils import ( - np_shift, + nb_idiff, + nb_shift, v_offset, v_pos_default, v_scalar, v_series, v_talib ) -from .mom import mom#, np_mom +from .mom import mom -# try: -# from numba import njit -# except ImportError: -# def njit(_): return _ - -# Mockup -# @njit -# def np_roc(x: Array, n: Int, k: IntFloat): -# result = k * np_mom(x, n) / np_shift(x, n) -# return result +@njit +def nb_roc(x, n, k): + return k * nb_idiff(x, n) / nb_shift(x, n) def roc( @@ -51,7 +46,6 @@ def roc( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -72,8 +66,11 @@ def roc( from talib import ROC roc = ROC(close, length) else: - roc = scalar * mom(close=close, length=length, talib=mode_tal) \ - / close.shift(length) + # roc = scalar * mom(close=close, length=length, talib=mode_tal) \ + # / close.shift(length) + np_close = close.values + _roc = nb_roc(np_close, length, scalar) + roc = Series(_roc, index=close.index) # Offset if offset != 0: @@ -82,8 +79,6 @@ def roc( # Fill if "fillna" in kwargs: roc.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - roc.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category roc.name = f"ROC_{length}" diff --git a/pandas_ta/momentum/rsi.py b/pandas_ta/momentum/rsi.py index 570456e4..c050e7ff 100644 --- a/pandas_ta/momentum/rsi.py +++ b/pandas_ta/momentum/rsi.py @@ -15,6 +15,7 @@ ) + def rsi( close: Series, length: Int = None, scalar: IntFloat = None, mamode: str = None, talib: bool = None, @@ -42,7 +43,6 @@ def rsi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -83,8 +83,6 @@ def rsi( # Fill if "fillna" in kwargs: rsi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rsi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category rsi.name = f"RSI_{length}" diff --git a/pandas_ta/momentum/rsx.py b/pandas_ta/momentum/rsx.py index 523d7274..b3030e4c 100644 --- a/pandas_ta/momentum/rsx.py +++ b/pandas_ta/momentum/rsx.py @@ -11,6 +11,7 @@ ) + def rsx( close: Series, length: Int = None, drift: Int = None, offset: Int = None, **kwargs: DictLike @@ -35,7 +36,6 @@ def rsx( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -121,8 +121,6 @@ def rsx( # Fill if "fillna" in kwargs: rsx.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rsx.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category rsx.name = f"RSX_{length}" diff --git a/pandas_ta/momentum/rvgi.py b/pandas_ta/momentum/rvgi.py index ded6ad52..d9127c33 100644 --- a/pandas_ta/momentum/rvgi.py +++ b/pandas_ta/momentum/rvgi.py @@ -6,6 +6,7 @@ from pandas_ta.utils import non_zero_range, v_offset, v_pos_default, v_series + def rvgi( open_: Series, high: Series, low: Series, close: Series, length: Int = None, swma_length: Int = None, @@ -32,7 +33,6 @@ def rvgi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -75,9 +75,6 @@ def rvgi( if "fillna" in kwargs: rvgi.fillna(kwargs["fillna"], inplace=True) signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rvgi.fillna(method=kwargs["fill_method"], inplace=True) - signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category rvgi.name = f"RVGI_{length}_{swma_length}" diff --git a/pandas_ta/momentum/slope.py b/pandas_ta/momentum/slope.py index 2e52a154..95fe2ed8 100644 --- a/pandas_ta/momentum/slope.py +++ b/pandas_ta/momentum/slope.py @@ -1,8 +1,15 @@ # -*- coding: utf-8 -*- -from numpy import arctan, pi +from numpy import arctan, pi, rad2deg from pandas import Series from pandas_ta._typing import DictLike, Int -from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series +from pandas_ta.utils import ( + nb_idiff, + v_bool, + v_offset, + v_pos_default, + v_series +) + def slope( @@ -17,16 +24,6 @@ def slope( Source: Algebra - Calculation: - Default Inputs: - length=1 - slope = close.diff(length) / length - - if as_angle: - slope = slope.apply(atan) - if to_degrees: - slope *= 180 / PI - Args: close (pd.Series): Series of 'close's length (int): It's period. Default: 1 @@ -38,7 +35,6 @@ def slope( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -55,11 +51,13 @@ def slope( offset = v_offset(offset) # Calculate - slope = close.diff(length) / length + np_close = close.values + _slope = nb_idiff(np_close, length) / length if as_angle: - slope = slope.apply(arctan) + _slope = arctan(_slope) if to_degrees: - slope *= 180 / pi + _slope = rad2deg(_slope) + slope = Series(_slope, index=close.index) # Offset if offset != 0: @@ -68,8 +66,6 @@ def slope( # Fill if "fillna" in kwargs: slope.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - slope.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category slope.name = f"SLOPE_{length}" if not as_angle else f"ANGLE{'d' if to_degrees else 'r'}_{length}" diff --git a/pandas_ta/momentum/smi.py b/pandas_ta/momentum/smi.py index 04d4f454..457a9fd6 100644 --- a/pandas_ta/momentum/smi.py +++ b/pandas_ta/momentum/smi.py @@ -6,6 +6,7 @@ from .tsi import tsi + def smi( close: Series, fast: Int = None, slow: Int = None, signal: Int = None, scalar: IntFloat = None, @@ -37,7 +38,6 @@ def smi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: smi, signal, oscillator columns. @@ -79,10 +79,6 @@ def smi( smi.fillna(kwargs["fillna"], inplace=True) signalma.fillna(kwargs["fillna"], inplace=True) osc.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - smi.fillna(method=kwargs["fill_method"], inplace=True) - signalma.fillna(method=kwargs["fill_method"], inplace=True) - osc.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category # _scalar = f"_{scalar}" if scalar != 1 else "" diff --git a/pandas_ta/momentum/squeeze.py b/pandas_ta/momentum/squeeze.py index 6e7e0e9d..4c5b64cc 100644 --- a/pandas_ta/momentum/squeeze.py +++ b/pandas_ta/momentum/squeeze.py @@ -17,6 +17,7 @@ from .mom import mom + def squeeze( high: Series, low: Series, close: Series, bb_length: Int = None, bb_std: IntFloat = None, @@ -66,7 +67,6 @@ def squeeze( detailed (value, optional): Return additional variations of SQZ for visualization. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: SQZ, SQZ_ON, SQZ_OFF, NO_SQZ columns by default. More @@ -139,11 +139,6 @@ def squeeze( squeeze_on.fillna(kwargs["fillna"], inplace=True) squeeze_off.fillna(kwargs["fillna"], inplace=True) no_squeeze.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - squeeze.fillna(method=kwargs["fill_method"], inplace=True) - squeeze_on.fillna(method=kwargs["fill_method"], inplace=True) - squeeze_off.fillna(method=kwargs["fill_method"], inplace=True) - no_squeeze.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = "" if use_tr else "hlr" @@ -203,13 +198,6 @@ def squeeze( pos_dec.fillna(kwargs["fillna"], inplace=True) neg_dec.fillna(kwargs["fillna"], inplace=True) neg_inc.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - sqz_inc.fillna(method=kwargs["fill_method"], inplace=True) - sqz_dec.fillna(method=kwargs["fill_method"], inplace=True) - pos_inc.fillna(method=kwargs["fill_method"], inplace=True) - pos_dec.fillna(method=kwargs["fill_method"], inplace=True) - neg_dec.fillna(method=kwargs["fill_method"], inplace=True) - neg_inc.fillna(method=kwargs["fill_method"], inplace=True) df[f"SQZ_INC"] = sqz_inc df[f"SQZ_DEC"] = sqz_dec diff --git a/pandas_ta/momentum/squeeze_pro.py b/pandas_ta/momentum/squeeze_pro.py index 157f5494..38817b85 100644 --- a/pandas_ta/momentum/squeeze_pro.py +++ b/pandas_ta/momentum/squeeze_pro.py @@ -18,6 +18,7 @@ from pandas_ta.volatility import bbands, kc + def squeeze_pro( high: Series, low: Series, close: Series, bb_length: Int = None, bb_std: IntFloat = None, @@ -71,7 +72,6 @@ def squeeze_pro( detailed (value, optional): Return additional variations of SQZ for visualization. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: SQZPRO, SQZPRO_ON_WIDE, SQZPRO_ON_NORMAL, @@ -156,13 +156,6 @@ def squeeze_pro( squeeze_on_narrow.fillna(kwargs["fillna"], inplace=True) squeeze_off_wide.fillna(kwargs["fillna"], inplace=True) no_squeeze.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - squeeze.fillna(method=kwargs["fill_method"], inplace=True) - squeeze_on_wide.fillna(method=kwargs["fill_method"], inplace=True) - squeeze_on_normal.fillna(method=kwargs["fill_method"], inplace=True) - squeeze_on_narrow.fillna(method=kwargs["fill_method"], inplace=True) - squeeze_off_wide.fillna(method=kwargs["fill_method"], inplace=True) - no_squeeze.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = "" if use_tr else "hlr" @@ -228,14 +221,6 @@ def squeeze_pro( neg_dec.fillna(kwargs["fillna"], inplace=True) neg_inc.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - sqz_inc.fillna(method=kwargs["fill_method"], inplace=True) - sqz_dec.fillna(method=kwargs["fill_method"], inplace=True) - pos_inc.fillna(method=kwargs["fill_method"], inplace=True) - pos_dec.fillna(method=kwargs["fill_method"], inplace=True) - neg_dec.fillna(method=kwargs["fill_method"], inplace=True) - neg_inc.fillna(method=kwargs["fill_method"], inplace=True) - df[f"SQZPRO_INC"] = sqz_inc df[f"SQZPRO_DEC"] = sqz_dec df[f"SQZPRO_PINC"] = pos_inc diff --git a/pandas_ta/momentum/stc.py b/pandas_ta/momentum/stc.py index c0319a8d..162d1839 100644 --- a/pandas_ta/momentum/stc.py +++ b/pandas_ta/momentum/stc.py @@ -11,6 +11,7 @@ ) + def stc( close: Series, tclength: Int = None, fast: Int = None, slow: Int = None, factor: IntFloat = None, @@ -59,7 +60,6 @@ def stc( ma2: External MA (mandatory in conjunction with ma1) osc: External oscillator fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: stc, macd, stoch @@ -130,10 +130,6 @@ def stc( stc.fillna(kwargs["fillna"], inplace=True) macd.fillna(kwargs["fillna"], inplace=True) stoch.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - stc.fillna(method=kwargs["fill_method"], inplace=True) - macd.fillna(method=kwargs["fill_method"], inplace=True) - stoch.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{tclength}_{fast}_{slow}_{factor}" diff --git a/pandas_ta/momentum/stoch.py b/pandas_ta/momentum/stoch.py index f6f0c5ce..b795e403 100644 --- a/pandas_ta/momentum/stoch.py +++ b/pandas_ta/momentum/stoch.py @@ -14,6 +14,7 @@ ) + def stoch( high: Series, low: Series, close: Series, k: Int = None, d: Int = None, smooth_k: Int = None, @@ -50,7 +51,6 @@ def stoch( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: %K, %D, Histogram columns. @@ -108,10 +108,6 @@ def stoch( stoch_k.fillna(kwargs["fillna"], inplace=True) stoch_d.fillna(kwargs["fillna"], inplace=True) stoch_h.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - stoch_k.fillna(method=kwargs["fill_method"], inplace=True) - stoch_d.fillna(method=kwargs["fill_method"], inplace=True) - stoch_h.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _name = "STOCH" diff --git a/pandas_ta/momentum/stochf.py b/pandas_ta/momentum/stochf.py index 0ee9e705..f5c2d9ef 100644 --- a/pandas_ta/momentum/stochf.py +++ b/pandas_ta/momentum/stochf.py @@ -14,6 +14,7 @@ ) + def stochf( high: Series, low: Series, close: Series, k: Int = None, d: Int = None, @@ -43,7 +44,6 @@ def stochf( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: Fast %K, %D columns. @@ -86,9 +86,6 @@ def stochf( if "fillna" in kwargs: stochf_k.fillna(kwargs["fillna"], inplace=True) stochf_d.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - stochf_k.fillna(method=kwargs["fill_method"], inplace=True) - stochf_d.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _name = "STOCHF" diff --git a/pandas_ta/momentum/stochrsi.py b/pandas_ta/momentum/stochrsi.py index 0cd0ae15..22b33f56 100644 --- a/pandas_ta/momentum/stochrsi.py +++ b/pandas_ta/momentum/stochrsi.py @@ -12,6 +12,7 @@ ) + def stochrsi( close: Series, length: Int = None, rsi_length: Int = None, k: Int = None, d: Int = None, mamode: str = None, @@ -44,7 +45,6 @@ def stochrsi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: RSI %K, RSI %D columns. @@ -82,9 +82,6 @@ def stochrsi( if "fillna" in kwargs: stochrsi_k.fillna(kwargs["fillna"], inplace=True) stochrsi_d.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - stochrsi_k.fillna(method=kwargs["fill_method"], inplace=True) - stochrsi_d.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _name = "STOCHRSI" diff --git a/pandas_ta/momentum/td_seq.py b/pandas_ta/momentum/td_seq.py deleted file mode 100644 index e6ed678d..00000000 --- a/pandas_ta/momentum/td_seq.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- -from pandas import DataFrame, Series -from pandas_ta._typing import DictLike, Int -from pandas_ta.utils import v_bool, v_offset, v_series - - -def td_seq( - close: Series, asint: bool = None, show_all: bool = None, - offset: Int = None, **kwargs: DictLike -) -> DataFrame: - """TD Sequential (TD_SEQ) - - Tom DeMark's Sequential indicator attempts to identify a price point - where an uptrend or a downtrend exhausts itself and reverses. - - Sources: - https://tradetrekker.wordpress.com/tdsequential/ - - Args: - close (pd.Series): Series of close's - asint (bool): If True, fillna's with 0 and change type to int. - Default: False - show_all (bool): Show 1 - 13. If set to False, show 6 - 9. - Default: True - offset (int): How many periods to offset the result. Default: 0 - - Kwargs: - fillna (value, optional): pd.DataFrame.fillna(value) - - Returns: - pd.DataFrame: New feature generated. - """ - # Validate - close = v_series(close, 5) - - if close is None: - return - - asint = v_bool(asint, False) - show_all = v_bool(show_all, True) - offset = v_offset(offset) - - # Calculate - up_seq = calc_td(close, "up", show_all) - down_seq = calc_td(close, "down", show_all) - - if asint: - if up_seq.hasnans and down_seq.hasnans: - up_seq.fillna(0, inplace=True) - down_seq.fillna(0, inplace=True) - up_seq = up_seq.astype(int) - down_seq = down_seq.astype(int) - - # Offset - if offset != 0: - up_seq = up_seq.shift(offset) - down_seq = down_seq.shift(offset) - - # Fill - if "fillna" in kwargs: - up_seq.fillna(kwargs["fillna"], inplace=True) - down_seq.fillna(kwargs["fillna"], inplace=True) - - if "fill_method" in kwargs: - up_seq.fillna(method=kwargs["fill_method"], inplace=True) - down_seq.fillna(method=kwargs["fill_method"], inplace=True) - - # Name and Category - up_seq.name = "TD_SEQ_UPa" if show_all else "TD_SEQ_UP" - down_seq.name = "TD_SEQ_DNa" if show_all else "TD_SEQ_DN" - up_seq.category = down_seq.category = "momentum" - - data = {up_seq.name: up_seq, down_seq.name: down_seq} - df = DataFrame(data, index=close.index) - df.index = close.index # Only works here for some reason? - df.name = "TD_SEQ" - df.category = up_seq.category - - return df - -def calc_td(series: Series, direction: str, show_all: bool): - td_bool = series.diff(4) > 0 if direction == "up" else series.diff(4) < 0 - cumsum = td_bool.cumsum() - td_num = cumsum - cumsum.where(~td_bool).ffill().fillna(0) - - if show_all: - td_num = td_num.mask(td_num == 0) - else: - td_num = td_num.mask(~td_num.between(6, 9)) - - return td_num diff --git a/pandas_ta/momentum/tmo.py b/pandas_ta/momentum/tmo.py index 7cee70dd..1d37d727 100644 --- a/pandas_ta/momentum/tmo.py +++ b/pandas_ta/momentum/tmo.py @@ -14,6 +14,7 @@ ) + def sum_signed_rolling_deltas( open_: Series, close: Series, length: Int, exclusive: bool = True ) -> Series: @@ -115,7 +116,6 @@ def tmo( Kwargs: fillna (value, optional): DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: DataFrame: main, smooth, main momentum, smooth momentum @@ -180,12 +180,6 @@ def tmo( mom_main.fillna(kwargs["fillna"], inplace=True) mom_smooth.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - main.fillna(method=kwargs["fill_method"], inplace=True) - smooth.fillna(method=kwargs["fill_method"], inplace=True) - mom_main.fillna(method=kwargs["fill_method"], inplace=True) - mom_smooth.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category _props = f"_{tmo_length}_{calc_length}_{smooth_length}" main.name = f"TMO{_props}" diff --git a/pandas_ta/momentum/trix.py b/pandas_ta/momentum/trix.py index 74746bc2..d015b5d6 100644 --- a/pandas_ta/momentum/trix.py +++ b/pandas_ta/momentum/trix.py @@ -12,6 +12,7 @@ ) + def trix( close: Series, length: Int = None, signal: Int = None, scalar: IntFloat = None, drift: Int = None, @@ -34,7 +35,6 @@ def trix( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -79,9 +79,6 @@ def trix( if "fillna" in kwargs: trix.fillna(kwargs["fillna"], inplace=True) trix_signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - trix.fillna(method=kwargs["fill_method"], inplace=True) - trix_signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category trix.name = f"TRIX_{length}_{signal}" diff --git a/pandas_ta/momentum/tsi.py b/pandas_ta/momentum/tsi.py index cc44a3e7..59ccd897 100644 --- a/pandas_ta/momentum/tsi.py +++ b/pandas_ta/momentum/tsi.py @@ -14,6 +14,7 @@ ) + def tsi( close: Series, fast: Int = None, slow: Int = None, signal: Int = None, scalar: IntFloat = None, @@ -42,7 +43,6 @@ def tsi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: tsi, signal. @@ -94,9 +94,6 @@ def tsi( if "fillna" in kwargs: tsi.fillna(kwargs["fillna"], inplace=True) tsi_signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - tsi.fillna(method=kwargs["fill_method"], inplace=True) - tsi_signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category tsi.name = f"TSI_{fast}_{slow}_{signal}" diff --git a/pandas_ta/momentum/uo.py b/pandas_ta/momentum/uo.py index 58e6b01b..98738120 100644 --- a/pandas_ta/momentum/uo.py +++ b/pandas_ta/momentum/uo.py @@ -11,6 +11,7 @@ ) + def uo( high: Series, low: Series, close: Series, fast: Int = None, medium: Int = None, slow: Int = None, @@ -43,7 +44,6 @@ def uo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -99,8 +99,6 @@ def uo( # Fill if "fillna" in kwargs: uo.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - uo.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category uo.name = f"UO_{fast}_{medium}_{slow}" diff --git a/pandas_ta/momentum/willr.py b/pandas_ta/momentum/willr.py index 773078a8..7388ab11 100644 --- a/pandas_ta/momentum/willr.py +++ b/pandas_ta/momentum/willr.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, v_talib + def willr( high: Series, low: Series, close: Series, length: Int = None, talib: bool = None, @@ -29,7 +30,6 @@ def willr( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -68,8 +68,6 @@ def willr( # Fill if "fillna" in kwargs: willr.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - willr.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category willr.name = f"WILLR_{length}" diff --git a/pandas_ta/overlap/alligator.py b/pandas_ta/overlap/alligator.py index 9c541cac..425738a3 100644 --- a/pandas_ta/overlap/alligator.py +++ b/pandas_ta/overlap/alligator.py @@ -5,6 +5,7 @@ from .smma import smma + def alligator( close: Series, jaw: Int = None, teeth: Int = None, lips: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -35,7 +36,6 @@ def alligator( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: JAW, TEETH, LIPS columns. @@ -68,10 +68,6 @@ def alligator( gator_jaw.fillna(kwargs["fillna"], inplace=True) gator_teeth.fillna(kwargs["fillna"], inplace=True) gator_lips.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - gator_jaw.fillna(method=kwargs["fill_method"], inplace=True) - gator_teeth.fillna(method=kwargs["fill_method"], inplace=True) - gator_lips.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{jaw}_{teeth}_{lips}" diff --git a/pandas_ta/overlap/alma.py b/pandas_ta/overlap/alma.py index b0667f34..6a310534 100644 --- a/pandas_ta/overlap/alma.py +++ b/pandas_ta/overlap/alma.py @@ -6,6 +6,7 @@ from pandas_ta.utils import strided_window, v_offset, v_pos_default, v_series + def alma( close: Series, length: Int = None, sigma: IntFloat = None, dist_offset: IntFloat = None, @@ -33,7 +34,6 @@ def alma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -77,8 +77,6 @@ def alma( # Fill if "fillna" in kwargs: alma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - alma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category alma.name = f"ALMA_{length}_{sigma}_{offset_}" diff --git a/pandas_ta/overlap/dema.py b/pandas_ta/overlap/dema.py index 4315d1c6..7199ea82 100644 --- a/pandas_ta/overlap/dema.py +++ b/pandas_ta/overlap/dema.py @@ -7,6 +7,7 @@ from .ema import ema + def dema( close: Series, length: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def dema( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -62,8 +62,6 @@ def dema( # Fill if "fillna" in kwargs: dema.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - dema.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category dema.name = f"DEMA_{length}" diff --git a/pandas_ta/overlap/ema.py b/pandas_ta/overlap/ema.py index f30762d6..67f14818 100644 --- a/pandas_ta/overlap/ema.py +++ b/pandas_ta/overlap/ema.py @@ -13,18 +13,6 @@ ) -# Almost there -# @njit -# def np_ema(x: np.ndarray, n: int): -# m = x.size -# result = np.zeros(m) -# a = 1 / (n + 1) -# for i in range(1, m): -# result[i] = a * x[i - 1] + (1 - a) * x[i] -# result[0] = np.nan -# return result -# # return np_prepend(result, n - 1) - def ema( close: Series, length: Int = None, @@ -56,7 +44,6 @@ def ema( Kwargs: adjust (bool, optional): Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -92,8 +79,6 @@ def ema( # Fill if "fillna" in kwargs: ema.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ema.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category ema.name = f"EMA_{length}" diff --git a/pandas_ta/overlap/fwma.py b/pandas_ta/overlap/fwma.py index 131150b9..dcb516b8 100644 --- a/pandas_ta/overlap/fwma.py +++ b/pandas_ta/overlap/fwma.py @@ -11,6 +11,7 @@ ) + def fwma( close: Series, length: Int = None, asc: bool = None, offset: Int = None, **kwargs: DictLike @@ -30,7 +31,6 @@ def fwma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -57,8 +57,6 @@ def fwma( # Fill if "fillna" in kwargs: fwma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - fwma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category fwma.name = f"FWMA_{length}" diff --git a/pandas_ta/overlap/hilo.py b/pandas_ta/overlap/hilo.py index b4374ad8..acb893cf 100644 --- a/pandas_ta/overlap/hilo.py +++ b/pandas_ta/overlap/hilo.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_mamode, v_offset, v_pos_default, v_series + def hilo( high: Series, low: Series, close: Series, high_length: Int = None, low_length: Int = None, mamode: str = None, @@ -41,7 +42,6 @@ def hilo( adjust (bool): Default: True presma (bool, optional): If True, uses SMA for initial value. fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: HILO (line), HILOl (long), HILOs (short) columns. @@ -89,10 +89,6 @@ def hilo( hilo.fillna(kwargs["fillna"], inplace=True) long.fillna(kwargs["fillna"], inplace=True) short.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - hilo.fillna(method=kwargs["fill_method"], inplace=True) - long.fillna(method=kwargs["fill_method"], inplace=True) - short.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{high_length}_{low_length}" diff --git a/pandas_ta/overlap/hl2.py b/pandas_ta/overlap/hl2.py index c0ef8336..658e30fa 100644 --- a/pandas_ta/overlap/hl2.py +++ b/pandas_ta/overlap/hl2.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_series + def hl2( high: Series, low: Series, offset: Int = None, **kwargs: DictLike @@ -20,8 +21,6 @@ def hl2( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value). Only works if result is offset. - fill_method (value, optional): Type of fill method. Only works if - result is offset. Returns: pd.Series: New feature generated. @@ -45,8 +44,6 @@ def hl2( # Fill if "fillna" in kwargs: hl2.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - hl2.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category hl2.name = "HL2" diff --git a/pandas_ta/overlap/hlc3.py b/pandas_ta/overlap/hlc3.py index 185cc735..bb6f753b 100644 --- a/pandas_ta/overlap/hlc3.py +++ b/pandas_ta/overlap/hlc3.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_series, v_talib + def hlc3( high: Series, low: Series, close: Series, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -22,8 +23,6 @@ def hlc3( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value). Only works if result is offset. - fill_method (value, optional): Type of fill method. Only works if - result is offset. Returns: pd.Series: New feature generated. @@ -53,8 +52,6 @@ def hlc3( # Fill if "fillna" in kwargs: hlc3.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - hlc3.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category hlc3.name = "HLC3" diff --git a/pandas_ta/overlap/hma.py b/pandas_ta/overlap/hma.py index 4b239c27..b7bea309 100644 --- a/pandas_ta/overlap/hma.py +++ b/pandas_ta/overlap/hma.py @@ -6,6 +6,7 @@ from .wma import wma + def hma( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -25,7 +26,6 @@ def hma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -54,8 +54,6 @@ def hma( # Fill if "fillna" in kwargs: hma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - hma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category hma.name = f"HMA_{length}" diff --git a/pandas_ta/overlap/hwma.py b/pandas_ta/overlap/hwma.py index 11006e58..0b20b4e4 100644 --- a/pandas_ta/overlap/hwma.py +++ b/pandas_ta/overlap/hwma.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_series + def hwma( close: Series, na: IntFloat = None, nb: IntFloat = None, nc: IntFloat = None, @@ -29,7 +30,6 @@ def hwma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: hwma @@ -66,8 +66,6 @@ def hwma( # Fill if "fillna" in kwargs: hwma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - hwma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category hwma.name = f"HWMA_{na}_{nb}_{nc}" diff --git a/pandas_ta/overlap/ichimoku.py b/pandas_ta/overlap/ichimoku.py index 1ced571c..1ae7924c 100644 --- a/pandas_ta/overlap/ichimoku.py +++ b/pandas_ta/overlap/ichimoku.py @@ -5,6 +5,7 @@ from .midprice import midprice + def ichimoku( high: Series, low: Series, close: Series, tenkan: Int = None, kijun: Int = None, senkou: Int = None, @@ -35,8 +36,8 @@ def ichimoku( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method - lookahead (value, optional): Set False to prevent data leakage by excluding the Chikou Span column from the output. + lookahead (value, optional): To prevent data leakage by + the Chikou Span column, set to False. Returns: pd.DataFrame: Two DataFrames. @@ -87,10 +88,6 @@ def ichimoku( span_a.fillna(kwargs["fillna"], inplace=True) span_b.fillna(kwargs["fillna"], inplace=True) chikou_span.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - span_a.fillna(method=kwargs["fill_method"], inplace=True) - span_b.fillna(method=kwargs["fill_method"], inplace=True) - chikou_span.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category span_a.name = f"ISA_{tenkan}" diff --git a/pandas_ta/overlap/jma.py b/pandas_ta/overlap/jma.py index 7d064787..477c8d12 100644 --- a/pandas_ta/overlap/jma.py +++ b/pandas_ta/overlap/jma.py @@ -7,6 +7,7 @@ from pandas_ta.utils import v_float, v_offset, v_pos_default, v_series + def jma( close: Series, length: IntFloat = None, phase: IntFloat = None, offset: Int = None, **kwargs: DictLike @@ -29,7 +30,6 @@ def jma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -111,8 +111,6 @@ def jma( # Fill if "fillna" in kwargs: jma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - jma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category jma.name = f"JMA_{_length}_{phase}" diff --git a/pandas_ta/overlap/kama.py b/pandas_ta/overlap/kama.py index 4252a5fd..5f70ba09 100644 --- a/pandas_ta/overlap/kama.py +++ b/pandas_ta/overlap/kama.py @@ -13,6 +13,7 @@ ) + def kama( close: Series, length: Int = None, fast: Int = None, slow: Int = None, mamode: str = None, drift: Int = None, @@ -43,7 +44,6 @@ def kama( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -91,8 +91,6 @@ def weight(length: int) -> float: # Fill if "fillna" in kwargs: kama.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - kama.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category kama.name = f"KAMA_{length}_{fast}_{slow}" diff --git a/pandas_ta/overlap/linreg.py b/pandas_ta/overlap/linreg.py index bb5db7e7..90b09781 100644 --- a/pandas_ta/overlap/linreg.py +++ b/pandas_ta/overlap/linreg.py @@ -15,6 +15,7 @@ ) + def linreg( close: Series, length: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -47,7 +48,6 @@ def linreg( tsf (bool, optional): If True, returns the Time Series Forecast value. Default: False. fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -142,8 +142,6 @@ def linear_regression(series): # Fill if "fillna" in kwargs: linreg.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - linreg.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category linreg.name = f"LINREG" diff --git a/pandas_ta/overlap/mama.py b/pandas_ta/overlap/mama.py index 97b5160e..df71f35e 100644 --- a/pandas_ta/overlap/mama.py +++ b/pandas_ta/overlap/mama.py @@ -7,10 +7,11 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, v_talib + # Ehler's Mother of Adaptive Moving Averages # http://traders.com/documentation/feedbk_docs/2014/01/traderstips.html @njit -def np_mama(x, fastlimit, slowlimit, prenan): +def nb_mama(x, fastlimit, slowlimit, prenan): a, b, m = 0.0962, 0.5769, x.size p_w, smp_w, smp_w_c = 0.2, 0.33, 0.67 @@ -125,7 +126,6 @@ def mama( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: MAMA and FAMA columns. @@ -148,7 +148,7 @@ def mama( from talib import MAMA mama, fama = MAMA(np_close, fastlimit, slowlimit) else: - mama, fama = np_mama(np_close, fastlimit, slowlimit, prenan) + mama, fama = nb_mama(np_close, fastlimit, slowlimit, prenan) if all(isnan(mama)) or all(isnan(fama)): return # Emergency Break @@ -169,7 +169,4 @@ def mama( if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) - return df diff --git a/pandas_ta/overlap/mcgd.py b/pandas_ta/overlap/mcgd.py index 0d4529fe..530a0cd5 100644 --- a/pandas_ta/overlap/mcgd.py +++ b/pandas_ta/overlap/mcgd.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def _mcgd(x, n, k): d = (k * n * (x[1] / x[0]) ** 4) x[1] = (x[0] + ((x[1] - x[0]) / d)) @@ -37,7 +38,6 @@ def mcgd( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -65,8 +65,6 @@ def mcgd( # Fill if "fillna" in kwargs: mcg_ds.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - mcg_ds.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category mcg_ds.name = f"MCGD_{length}" diff --git a/pandas_ta/overlap/midpoint.py b/pandas_ta/overlap/midpoint.py index 198bde5c..77a04c00 100644 --- a/pandas_ta/overlap/midpoint.py +++ b/pandas_ta/overlap/midpoint.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, v_talib + def midpoint( close: Series, length: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -22,7 +23,6 @@ def midpoint( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -57,8 +57,6 @@ def midpoint( # Fill if "fillna" in kwargs: midpoint.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - midpoint.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category midpoint.name = f"MIDPOINT_{length}" diff --git a/pandas_ta/overlap/midprice.py b/pandas_ta/overlap/midprice.py index 77591293..d996a67f 100644 --- a/pandas_ta/overlap/midprice.py +++ b/pandas_ta/overlap/midprice.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, v_talib + def midprice( high: Series, low: Series, length: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -23,7 +24,6 @@ def midprice( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -60,8 +60,6 @@ def midprice( # Fill if "fillna" in kwargs: midprice.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - midprice.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category midprice.name = f"MIDPRICE_{length}" diff --git a/pandas_ta/overlap/ohlc4.py b/pandas_ta/overlap/ohlc4.py index f89c4abb..87348785 100644 --- a/pandas_ta/overlap/ohlc4.py +++ b/pandas_ta/overlap/ohlc4.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_series + def ohlc4( open_: Series, high: Series, low: Series, close: Series, offset: Int = None, **kwargs: DictLike @@ -22,8 +23,6 @@ def ohlc4( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value). Only works if result is offset. - fill_method (value, optional): Type of fill method. Only works if - result is offset. Returns: pd.Series: New feature generated. @@ -46,8 +45,6 @@ def ohlc4( # Fill if "fillna" in kwargs: ohlc4.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ohlc4.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category ohlc4.name = "OHLC4" diff --git a/pandas_ta/overlap/pivots.py b/pandas_ta/overlap/pivots.py index 6e504770..8e95a864 100644 --- a/pandas_ta/overlap/pivots.py +++ b/pandas_ta/overlap/pivots.py @@ -4,7 +4,7 @@ from pandas import DataFrame, DateOffset, Series, infer_freq from pandas_ta._typing import DictLike from pandas_ta.utils import ( - np_non_zero_range, + nb_non_zero_range, v_datetime_ordered, v_series, v_str @@ -19,10 +19,12 @@ 'D': 'days', } + + @njit def pivot_camarilla(high, low, close): tp = (high + low + close) / 3 - hl_range = np_non_zero_range(high, low) + hl_range = nb_non_zero_range(high, low) s1 = close - 11 / 120 * hl_range s2 = close - 11 / 60 * hl_range @@ -40,7 +42,7 @@ def pivot_camarilla(high, low, close): @njit def pivot_classic(high, low, close): tp = (high + low + close) / 3 - hl_range = np_non_zero_range(high, low) + hl_range = nb_non_zero_range(high, low) s1 = 2 * tp - high s2 = tp - hl_range @@ -73,7 +75,7 @@ def pivot_demark(open_, high, low, close): @njit def pivot_fibonacci(high, low, close): tp = (high + low + close) / 3 - hl_range = np_non_zero_range(high, low) + hl_range = nb_non_zero_range(high, low) s1 = tp - 0.382 * hl_range s2 = tp - 0.618 * hl_range @@ -89,7 +91,7 @@ def pivot_fibonacci(high, low, close): @njit def pivot_traditional(high, low, close): tp = (high + low + close) / 3 - hl_range = np_non_zero_range(high, low) + hl_range = nb_non_zero_range(high, low) s1 = 2 * tp - high s2 = tp - hl_range @@ -107,7 +109,7 @@ def pivot_traditional(high, low, close): @njit def pivot_woodie(open_, high, low): tp = (2 * open_ + high + low) / 4 - hl_range = np_non_zero_range(high, low) + hl_range = nb_non_zero_range(high, low) s1 = 2 * tp - high s2 = tp - hl_range @@ -152,7 +154,6 @@ def pivots( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: New feature generated. diff --git a/pandas_ta/overlap/pwma.py b/pandas_ta/overlap/pwma.py index f78213b1..90360816 100644 --- a/pandas_ta/overlap/pwma.py +++ b/pandas_ta/overlap/pwma.py @@ -12,6 +12,7 @@ ) + def pwma( close: Series, length: Int = None, asc: bool = None, offset: Int = None, **kwargs: DictLike @@ -31,7 +32,6 @@ def pwma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -58,8 +58,6 @@ def pwma( # Fill if "fillna" in kwargs: pwma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pwma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pwma.name = f"PWMA_{length}" diff --git a/pandas_ta/overlap/rma.py b/pandas_ta/overlap/rma.py index 72584deb..ddfe0e62 100644 --- a/pandas_ta/overlap/rma.py +++ b/pandas_ta/overlap/rma.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def rma( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -24,7 +25,6 @@ def rma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -48,8 +48,6 @@ def rma( # Fill if "fillna" in kwargs: rma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category rma.name = f"RMA_{length}" diff --git a/pandas_ta/overlap/sinwma.py b/pandas_ta/overlap/sinwma.py index 2bd0c9a5..bdb6f630 100644 --- a/pandas_ta/overlap/sinwma.py +++ b/pandas_ta/overlap/sinwma.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, weights + def sinwma( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -25,7 +26,6 @@ def sinwma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -55,8 +55,6 @@ def sinwma( # Fill if "fillna" in kwargs: sinwma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - sinwma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category sinwma.name = f"SINWMA_{length}" diff --git a/pandas_ta/overlap/sma.py b/pandas_ta/overlap/sma.py index afe15209..3961f97c 100644 --- a/pandas_ta/overlap/sma.py +++ b/pandas_ta/overlap/sma.py @@ -5,7 +5,7 @@ from pandas_ta._typing import Array, DictLike, Int from pandas_ta.maps import Imports from pandas_ta.utils import ( - np_prepend, + nb_prepend, v_offset, v_pos_default, v_series, @@ -13,24 +13,12 @@ ) + # Fast SMA Options: https://github.com/numba/numba/issues/4119 @njit -def np_sma(x, n): +def nb_sma(x, n): result = convolve(ones(n) / n, x)[n - 1:1 - n] - return np_prepend(result, n - 1) - -# SMA: Alternative Implementations -# @njit -# def np_sma(x: np.ndarray, n: int): -# result = np.convolve(x, np.ones(n), mode="valid") / n -# return np_prepend(result, n - 1) - -# @njit -# def np_sma(x: np.ndarray, n: int): -# csum = np.cumsum(x, dtype=float) -# csum[n:] = csum[n:] - csum[:-n] -# result = csum[n - 1:] / n -# return np_prepend(result, n - 1) + return nb_prepend(result, n - 1) def sma( @@ -56,7 +44,6 @@ def sma( adjust (bool): Default: True presma (bool, optional): If True, uses SMA for initial value. fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -81,7 +68,7 @@ def sma( sma = SMA(close, length) else: np_close = close.values - sma = np_sma(np_close, length) + sma = nb_sma(np_close, length) sma = Series(sma, index=close.index) # Offset @@ -91,8 +78,6 @@ def sma( # Fill if "fillna" in kwargs: sma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - sma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category sma.name = f"SMA_{length}" diff --git a/pandas_ta/overlap/smma.py b/pandas_ta/overlap/smma.py index 67c58158..cd4159b6 100644 --- a/pandas_ta/overlap/smma.py +++ b/pandas_ta/overlap/smma.py @@ -12,6 +12,7 @@ ) + def smma( close: Series, length: Int = None, mamode: str = None, talib: bool = None, @@ -43,7 +44,6 @@ def smma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -79,8 +79,6 @@ def smma( # Fill if "fillna" in kwargs: smma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - smma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category smma.name = f"SMMA_{length}" diff --git a/pandas_ta/overlap/ssf.py b/pandas_ta/overlap/ssf.py index ea01c5cc..0b58b0e5 100644 --- a/pandas_ta/overlap/ssf.py +++ b/pandas_ta/overlap/ssf.py @@ -1,20 +1,22 @@ # -*- coding: utf-8 -*- -from numpy import copy, cos, exp +from numpy import copy, cos, exp, zeros_like from numba import njit from pandas import Series from pandas_ta._typing import Array, DictLike, Int, IntFloat from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series + # Ehler's Super Smoother Filter # http://traders.com/documentation/feedbk_docs/2014/01/traderstips.html @njit -def np_ssf(x, n, pi, sqrt2): +def nb_ssf(x, n, pi, sqrt2): m, ratio, result = x.size, sqrt2 / n, copy(x) a = exp(-pi * ratio) b = 2 * a * cos(180 * ratio) c = a * a - b + 1 + # result[:2] = x[:2] for i in range(2, m): result[i] = 0.5 * c * (x[i] + x[i - 1]) + b * result[i - 1] \ - a * a * result[i - 2] @@ -25,11 +27,12 @@ def np_ssf(x, n, pi, sqrt2): # John F. Ehler's Super Smoother Filter by Everget (2 poles), Tradingview # https://www.tradingview.com/script/VdJy0yBJ-Ehlers-Super-Smoother-Filter/ @njit -def np_ssf_everget(x, n, pi, sqrt2): +def nb_ssf_everget(x, n, pi, sqrt2): m, arg, result = x.size, pi * sqrt2 / n, copy(x) a = exp(-arg) b = 2 * a * cos(arg) + # result[:2] = x[:2] for i in range(2, m): result[i] = 0.5 * (a * a - b + 1) * (x[i] + x[i - 1]) \ + b * result[i - 1] - a * a * result[i - 2] @@ -77,7 +80,6 @@ def ssf( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -97,9 +99,9 @@ def ssf( # Calculate np_close = close.values if everget: - ssf = np_ssf_everget(np_close, length, pi, sqrt2) + ssf = nb_ssf_everget(np_close, length, pi, sqrt2) else: - ssf = np_ssf(np_close, length, pi, sqrt2) + ssf = nb_ssf(np_close, length, pi, sqrt2) ssf = Series(ssf, index=close.index) # Offset @@ -109,8 +111,6 @@ def ssf( # Fill if "fillna" in kwargs: ssf.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ssf.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category ssf.name = f"SSF{'e' if everget else ''}_{length}" diff --git a/pandas_ta/overlap/ssf3.py b/pandas_ta/overlap/ssf3.py index 1a596dc7..42597f6b 100644 --- a/pandas_ta/overlap/ssf3.py +++ b/pandas_ta/overlap/ssf3.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from numpy import copy, cos, exp +from numpy import copy, cos, exp, zeros_like from numba import njit from pandas import Series from pandas_ta._typing import Array, DictLike, Int, IntFloat from pandas_ta.utils import v_offset, v_pos_default, v_series + # John F. Ehler's Super Smoother Filter by Everget (3 poles), Tradingview # https://www.tradingview.com/script/VdJy0yBJ-Ehlers-Super-Smoother-Filter/ @njit -def np_ssf3(x, n, pi, sqrt3): +def nb_ssf3(x, n, pi, sqrt3): m, result = x.size, copy(x) a = exp(-pi / n) b = 2 * a * cos(-pi * sqrt3 / n) @@ -20,6 +21,7 @@ def np_ssf3(x, n, pi, sqrt3): d2 = b + c d1 = 1 - d2 - d3 - d4 + # result[:3] = x[:3] for i in range(3, m): result[i] = d1 * x[i] + d2 * result[i - 1] \ + d3 * result[i - 2] + d4 * result[i - 3] @@ -60,7 +62,6 @@ def ssf3( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -78,7 +79,7 @@ def ssf3( # Calculate np_close = close.values - ssf = np_ssf3(np_close, length, pi, sqrt3) + ssf = nb_ssf3(np_close, length, pi, sqrt3) ssf = Series(ssf, index=close.index) # Offset @@ -88,8 +89,6 @@ def ssf3( # Fill if "fillna" in kwargs: ssf.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ssf.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category ssf.name = f"SSF3_{length}" diff --git a/pandas_ta/overlap/supertrend.py b/pandas_ta/overlap/supertrend.py index f1efdaf3..bd5b9642 100644 --- a/pandas_ta/overlap/supertrend.py +++ b/pandas_ta/overlap/supertrend.py @@ -7,6 +7,7 @@ from pandas_ta.volatility import atr + def supertrend( high: Series, low: Series, close: Series, length: Int = None, atr_length: Int = None, @@ -38,7 +39,6 @@ def supertrend( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: SUPERT (trend), SUPERTd (direction), @@ -108,7 +108,4 @@ def supertrend( if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) - return df diff --git a/pandas_ta/overlap/swma.py b/pandas_ta/overlap/swma.py index 6bd42803..1e2b137a 100644 --- a/pandas_ta/overlap/swma.py +++ b/pandas_ta/overlap/swma.py @@ -10,6 +10,7 @@ ) + def swma( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -31,7 +32,6 @@ def swma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -57,8 +57,6 @@ def swma( # Fill if "fillna" in kwargs: swma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - swma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category swma.name = f"SWMA_{length}" diff --git a/pandas_ta/overlap/t3.py b/pandas_ta/overlap/t3.py index 2d8056f3..d074e138 100644 --- a/pandas_ta/overlap/t3.py +++ b/pandas_ta/overlap/t3.py @@ -7,6 +7,7 @@ from .ema import ema + def t3( close: Series, length: Int = None, a: IntFloat = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -31,7 +32,6 @@ def t3( adjust (bool): Default: True presma (bool, optional): If True, uses SMA for initial value. fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -72,8 +72,6 @@ def t3( # Fill if "fillna" in kwargs: t3.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - t3.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category t3.name = f"T3_{length}_{a}" diff --git a/pandas_ta/overlap/tema.py b/pandas_ta/overlap/tema.py index 0d4ce54d..23ffd825 100644 --- a/pandas_ta/overlap/tema.py +++ b/pandas_ta/overlap/tema.py @@ -6,6 +6,7 @@ from .ema import ema + def tema( close: Series, length: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def tema( adjust (bool): Default: True presma (bool, optional): If True, uses SMA for initial value. fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -60,8 +60,6 @@ def tema( # Fill if "fillna" in kwargs: tema.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - tema.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category tema.name = f"TEMA_{length}" diff --git a/pandas_ta/overlap/trima.py b/pandas_ta/overlap/trima.py index 7042ed47..ed599dec 100644 --- a/pandas_ta/overlap/trima.py +++ b/pandas_ta/overlap/trima.py @@ -6,6 +6,7 @@ from .sma import sma + def trima( close: Series, length: Int = None, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -30,7 +31,6 @@ def trima( Kwargs: adjust (bool): Default: True fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -61,8 +61,6 @@ def trima( # Fill if "fillna" in kwargs: trima.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - trima.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category trima.name = f"TRIMA_{length}" diff --git a/pandas_ta/overlap/vidya.py b/pandas_ta/overlap/vidya.py index 47d0f34d..65cf2044 100644 --- a/pandas_ta/overlap/vidya.py +++ b/pandas_ta/overlap/vidya.py @@ -12,6 +12,7 @@ ) + def vidya( close: Series, length: Int = None, drift: Int = None, offset: Int = None, @@ -36,7 +37,6 @@ def vidya( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -76,8 +76,6 @@ def vidya( # Fill if "fillna" in kwargs: vidya.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - vidya.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category vidya.name = f"VIDYA_{length}" diff --git a/pandas_ta/overlap/wcp.py b/pandas_ta/overlap/wcp.py index 30d8dd1c..7b5aea1c 100644 --- a/pandas_ta/overlap/wcp.py +++ b/pandas_ta/overlap/wcp.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_series, v_talib + def wcp( high: Series, low: Series, close: Series, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -27,7 +28,6 @@ def wcp( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -59,8 +59,6 @@ def wcp( # Fill if "fillna" in kwargs: wcp.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - wcp.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category wcp.name = "WCP" diff --git a/pandas_ta/overlap/wma.py b/pandas_ta/overlap/wma.py index c98d448c..c4ad265f 100644 --- a/pandas_ta/overlap/wma.py +++ b/pandas_ta/overlap/wma.py @@ -13,8 +13,9 @@ ) + @njit -def np_wma(x, n, asc, prenan): +def nb_wma(x, n, asc, prenan): m = x.size w = arange(1, n + 1, dtype=float64) result = zeros_like(x, dtype=float64) @@ -55,7 +56,6 @@ def wma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -77,7 +77,7 @@ def wma( wma = WMA(close, length) else: np_close = close.values - wma_ = np_wma(np_close, length, asc, True) + wma_ = nb_wma(np_close, length, asc, True) wma = Series(wma_, index=close.index) # Offset @@ -87,8 +87,6 @@ def wma( # Fill if "fillna" in kwargs: wma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - wma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category wma.name = f"WMA_{length}" diff --git a/pandas_ta/overlap/zlma.py b/pandas_ta/overlap/zlma.py index 82090587..dc04e1f6 100644 --- a/pandas_ta/overlap/zlma.py +++ b/pandas_ta/overlap/zlma.py @@ -25,6 +25,7 @@ from .wma import wma + def zlma( close: Series, length: Int = None, mamode: str = None, offset: Int = None, **kwargs: DictLike @@ -46,7 +47,6 @@ def zlma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -89,8 +89,6 @@ def zlma( # Fill if "fillna" in kwargs: zlma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - zlma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category zlma.name = f"ZL_{zlma.name}" diff --git a/pandas_ta/performance/drawdown.py b/pandas_ta/performance/drawdown.py index e33a80e9..d496d360 100644 --- a/pandas_ta/performance/drawdown.py +++ b/pandas_ta/performance/drawdown.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_series + def drawdown( close: Series, offset: Int = None, **kwargs: DictLike ) -> DataFrame: @@ -23,7 +24,6 @@ def drawdown( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: drawdown, drawdown percent, drawdown log columns @@ -53,10 +53,6 @@ def drawdown( dd.fillna(kwargs["fillna"], inplace=True) dd_pct.fillna(kwargs["fillna"], inplace=True) dd_log.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - dd.fillna(method=kwargs["fill_method"], inplace=True) - dd_pct.fillna(method=kwargs["fill_method"], inplace=True) - dd_log.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category dd.name = "DD" diff --git a/pandas_ta/performance/log_return.py b/pandas_ta/performance/log_return.py index 872fe393..5a1a7144 100644 --- a/pandas_ta/performance/log_return.py +++ b/pandas_ta/performance/log_return.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series + def log_return( close: Series, length: Int = None, cumulative: bool = None, offset: Int = None, **kwargs: DictLike @@ -26,7 +27,6 @@ def log_return( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -57,8 +57,6 @@ def log_return( # Fill if "fillna" in kwargs: log_return.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - log_return.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category log_return.name = f"{'CUM' if cumulative else ''}LOGRET_{length}" diff --git a/pandas_ta/performance/percent_return.py b/pandas_ta/performance/percent_return.py index f0e9a1ea..99964bb0 100644 --- a/pandas_ta/performance/percent_return.py +++ b/pandas_ta/performance/percent_return.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series + def percent_return( close: Series, length: Int = None, cumulative: bool = None, offset: Int = None, **kwargs: DictLike @@ -26,7 +27,6 @@ def percent_return( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -57,8 +57,6 @@ def percent_return( # Fill if "fillna" in kwargs: pct_return.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pct_return.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pct_return.name = f"{'CUM' if cumulative else ''}PCTRET_{length}" diff --git a/pandas_ta/statistics/entropy.py b/pandas_ta/statistics/entropy.py index 05489887..e2a440e2 100644 --- a/pandas_ta/statistics/entropy.py +++ b/pandas_ta/statistics/entropy.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def entropy( close: Series, length: Int = None, base: IntFloat = None, offset: Int = None, **kwargs: DictLike @@ -26,7 +27,6 @@ def entropy( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -52,8 +52,6 @@ def entropy( # Fill if "fillna" in kwargs: entropy.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - entropy.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category entropy.name = f"ENTP_{length}" diff --git a/pandas_ta/statistics/kurtosis.py b/pandas_ta/statistics/kurtosis.py index 7bfc90d6..1ff144be 100644 --- a/pandas_ta/statistics/kurtosis.py +++ b/pandas_ta/statistics/kurtosis.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def kurtosis( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -23,7 +24,6 @@ def kurtosis( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -51,8 +51,6 @@ def kurtosis( # Fill if "fillna" in kwargs: kurtosis.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - kurtosis.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category kurtosis.name = f"KURT_{length}" diff --git a/pandas_ta/statistics/mad.py b/pandas_ta/statistics/mad.py index 49f27fb5..f82b5578 100644 --- a/pandas_ta/statistics/mad.py +++ b/pandas_ta/statistics/mad.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def mad_(series: Series): """Mean Absolute Deviation""" return fabs(series - series.mean()).mean() @@ -25,7 +26,6 @@ def mad( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -53,8 +53,6 @@ def mad( # Fill if "fillna" in kwargs: mad.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - mad.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category mad.name = f"MAD_{length}" diff --git a/pandas_ta/statistics/median.py b/pandas_ta/statistics/median.py index 7f4d1024..88c9ccd7 100644 --- a/pandas_ta/statistics/median.py +++ b/pandas_ta/statistics/median.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def median( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -22,7 +23,6 @@ def median( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -50,8 +50,6 @@ def median( # Fill if "fillna" in kwargs: median.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - median.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category median.name = f"MEDIAN_{length}" diff --git a/pandas_ta/statistics/quantile.py b/pandas_ta/statistics/quantile.py index 516bc0ba..a5578d44 100644 --- a/pandas_ta/statistics/quantile.py +++ b/pandas_ta/statistics/quantile.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def quantile( close: Series, length: Int = None, q: IntFloat = None, offset: Int = None, **kwargs: DictLike @@ -20,7 +21,6 @@ def quantile( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -49,8 +49,6 @@ def quantile( # Fill if "fillna" in kwargs: quantile.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - quantile.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category quantile.name = f"QTL_{length}_{q}" diff --git a/pandas_ta/statistics/skew.py b/pandas_ta/statistics/skew.py index 15c09dda..222159a8 100644 --- a/pandas_ta/statistics/skew.py +++ b/pandas_ta/statistics/skew.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def skew( close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -23,7 +24,6 @@ def skew( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -51,8 +51,6 @@ def skew( # Fill if "fillna" in kwargs: skew.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - skew.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category skew.name = f"SKEW_{length}" diff --git a/pandas_ta/statistics/stdev.py b/pandas_ta/statistics/stdev.py index b39b161e..4807e3e5 100644 --- a/pandas_ta/statistics/stdev.py +++ b/pandas_ta/statistics/stdev.py @@ -7,6 +7,7 @@ from .variance import variance + def stdev( close: Series, length: Int = None, ddof: Int = None, talib: bool = None, @@ -30,7 +31,6 @@ def stdev( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -62,8 +62,6 @@ def stdev( # Fill if "fillna" in kwargs: stdev.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - stdev.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category stdev.name = f"STDEV_{length}" diff --git a/pandas_ta/statistics/tos_stdevall.py b/pandas_ta/statistics/tos_stdevall.py index 16746e7c..8256ee40 100644 --- a/pandas_ta/statistics/tos_stdevall.py +++ b/pandas_ta/statistics/tos_stdevall.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_list, v_lowerbound, v_offset, v_series + def tos_stdevall( close: Series, length: Int = None, stds: List = None, ddof: Int = None, @@ -35,7 +36,6 @@ def tos_stdevall( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: Central LR, Pairs of Lower and Upper LR Lines based on @@ -90,8 +90,6 @@ def tos_stdevall( # Fill if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) df.name = f"{_props}" df.category = "statistics" diff --git a/pandas_ta/statistics/variance.py b/pandas_ta/statistics/variance.py index 5ce64275..998742b9 100644 --- a/pandas_ta/statistics/variance.py +++ b/pandas_ta/statistics/variance.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_lowerbound, v_offset, v_series, v_talib + def variance( close: Series, length: Int = None, ddof: Int = None, talib: bool = None, @@ -29,7 +30,6 @@ def variance( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -63,8 +63,6 @@ def variance( # Fill if "fillna" in kwargs: variance.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - variance.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category variance.name = f"VAR_{length}" diff --git a/pandas_ta/statistics/zscore.py b/pandas_ta/statistics/zscore.py index 6feedf8d..07319d80 100644 --- a/pandas_ta/statistics/zscore.py +++ b/pandas_ta/statistics/zscore.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_lowerbound, v_offset, v_series + def zscore( close: Series, length: Int = None, std: IntFloat = None, offset: Int = None, **kwargs: DictLike @@ -22,7 +23,6 @@ def zscore( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -49,8 +49,6 @@ def zscore( # Fill if "fillna" in kwargs: zscore.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - zscore.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category zscore.name = f"ZS_{length}" diff --git a/pandas_ta/transform/cube.py b/pandas_ta/transform/cube.py index b7a7c7e7..7952a9fd 100644 --- a/pandas_ta/transform/cube.py +++ b/pandas_ta/transform/cube.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_int, v_lowerbound, v_offset, v_series + def cube( close: Series, pwr: IntFloat = None, signal_offset: Int = None, offset: Int = None, **kwargs: DictLike @@ -34,7 +35,6 @@ def cube( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: New feature generated. @@ -65,9 +65,6 @@ def cube( if "fillna" in kwargs: ct.fillna(kwargs["fillna"], inplace=True) ct_signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ct.fillna(method=kwargs["fill_method"], inplace=True) - ct_signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{pwr}_{signal_offset}" diff --git a/pandas_ta/transform/ifisher.py b/pandas_ta/transform/ifisher.py index 3e752ff4..988d86a0 100644 --- a/pandas_ta/transform/ifisher.py +++ b/pandas_ta/transform/ifisher.py @@ -6,6 +6,7 @@ from .remap import remap + def ifisher( close: Series, amp: IntFloat = None, signal_offset: Int = None, @@ -43,7 +44,6 @@ def ifisher( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: New feature generated. @@ -81,9 +81,6 @@ def ifisher( if "fillna" in kwargs: inv_fisher.fillna(kwargs["fillna"], inplace=True) signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - inv_fisher.fillna(method=kwargs["fill_method"], inplace=True) - signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{amp}" diff --git a/pandas_ta/transform/remap.py b/pandas_ta/transform/remap.py index ae4e7f50..91620012 100644 --- a/pandas_ta/transform/remap.py +++ b/pandas_ta/transform/remap.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_float, v_offset, v_series + def remap( close: Series, from_min: IntFloat = None, from_max: IntFloat = None, to_min: IntFloat = None, to_max: IntFloat = None, @@ -33,7 +34,6 @@ def remap( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -60,8 +60,6 @@ def remap( # Fill if "fillna" in kwargs: result.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - result.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category result.name = f"REMAP_{from_min}_{from_max}_{to_min}_{to_max}" diff --git a/pandas_ta/trend/adx.py b/pandas_ta/trend/adx.py index 74d6b612..f99b4d16 100644 --- a/pandas_ta/trend/adx.py +++ b/pandas_ta/trend/adx.py @@ -18,6 +18,7 @@ from pandas_ta.volatility import atr + def adx( high: Series, low: Series, close: Series, length: Int = None, lensig: Int = None, adxr_length: Int = None, scalar: IntFloat = None, @@ -51,7 +52,6 @@ def adx( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: adx, adxr, dmp, dmn columns. @@ -151,11 +151,6 @@ def adx( adxr.fillna(kwargs["fillna"], inplace=True) dmp.fillna(kwargs["fillna"], inplace=True) dmn.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - adx.fillna(method=kwargs["fill_method"], inplace=True) - adxr.fillna(method=kwargs["fill_method"], inplace=True) - dmp.fillna(method=kwargs["fill_method"], inplace=True) - dmn.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category adx.name = f"ADX_{lensig}" diff --git a/pandas_ta/trend/alphatrend.py b/pandas_ta/trend/alphatrend.py index f4a39252..b1ef8ecd 100644 --- a/pandas_ta/trend/alphatrend.py +++ b/pandas_ta/trend/alphatrend.py @@ -16,25 +16,26 @@ ) + @njit -def np_alpha(low_atr, high_atr, momo_threshold): +def nb_alpha(low_atr, high_atr, momo_threshold): m = momo_threshold.size - alpha = zeros_like(low_atr) + result = zeros_like(low_atr) for i in range(1, m): if momo_threshold[i]: - if low_atr[i] < alpha[i - 1]: - alpha[i] = alpha[i - 1] + if low_atr[i] < result[i - 1]: + result[i] = result[i - 1] else: - alpha[i] = low_atr[i] + result[i] = low_atr[i] else: - if high_atr[i] > alpha[i - 1]: - alpha[i] = alpha[i - 1] + if high_atr[i] > result[i - 1]: + result[i] = result[i - 1] else: - alpha[i] = high_atr[i] - alpha[0] = nan + result[i] = high_atr[i] + result[0] = nan - return alpha + return result def alphatrend( @@ -70,7 +71,6 @@ def alphatrend( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: trend, trendlag of all the input. @@ -128,7 +128,7 @@ def alphatrend( np_upper_atr, np_lower_atr = upper_atr.values, lower_atr.values - at = np_alpha(np_lower_atr, np_upper_atr, momo.values >= threshold) + at = nb_alpha(np_lower_atr, np_upper_atr, momo.values >= threshold) at = Series(at, index=close.index) atl = at.shift(lag) @@ -145,9 +145,6 @@ def alphatrend( if "fillna" in kwargs: at.fillna(kwargs["fillna"], inplace=True) atl.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - at.fillna(method=kwargs["fill_method"], inplace=True) - atl.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{multiplier}_{threshold}" diff --git a/pandas_ta/trend/amat.py b/pandas_ta/trend/amat.py index 6d1cd833..fa6546e8 100644 --- a/pandas_ta/trend/amat.py +++ b/pandas_ta/trend/amat.py @@ -7,6 +7,7 @@ from .short_run import short_run + def amat( close: Series, fast: Int = None, slow: Int = None, lookback: Int = None, mamode: str = None, @@ -34,7 +35,6 @@ def amat( Kwargs: run_length (int): Trend length for OBV long and short runs. Default: 2 fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: AMAT_LR, AMAT_SR columns. @@ -70,10 +70,6 @@ def amat( mas_long.fillna(kwargs["fillna"], inplace=True) mas_short.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - mas_long.fillna(method=kwargs["fill_method"], inplace=True) - mas_short.fillna(method=kwargs["fill_method"], inplace=True) - _props = f"_{fast}_{slow}_{lookback}" data = { f"AMAT{mamode[0]}_LR{_props}": mas_long, diff --git a/pandas_ta/trend/aroon.py b/pandas_ta/trend/aroon.py index 21888857..161e3972 100644 --- a/pandas_ta/trend/aroon.py +++ b/pandas_ta/trend/aroon.py @@ -13,6 +13,7 @@ ) + def aroon( high: Series, low: Series, length: Int = None, scalar: IntFloat = None, talib: bool = None, @@ -37,7 +38,6 @@ def aroon( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: aroon_up, aroon_down, aroon_osc columns. @@ -81,10 +81,6 @@ def aroon( aroon_up.fillna(kwargs["fillna"], inplace=True) aroon_down.fillna(kwargs["fillna"], inplace=True) aroon_osc.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - aroon_up.fillna(method=kwargs["fill_method"], inplace=True) - aroon_down.fillna(method=kwargs["fill_method"], inplace=True) - aroon_osc.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category aroon_up.name = f"AROONU_{length}" diff --git a/pandas_ta/trend/chop.py b/pandas_ta/trend/chop.py index a8b12cab..42a6ec59 100644 --- a/pandas_ta/trend/chop.py +++ b/pandas_ta/trend/chop.py @@ -13,6 +13,7 @@ from pandas_ta.volatility import atr + def chop( high: Series, low: Series, close: Series, length: Int = None, atr_length: Int = None, @@ -44,7 +45,6 @@ def chop( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -83,8 +83,6 @@ def chop( # Fill if "fillna" in kwargs: chop.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - chop.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category chop.name = f"CHOP{'ln' if ln else ''}_{length}_{atr_length}_{scalar}" diff --git a/pandas_ta/trend/cksp.py b/pandas_ta/trend/cksp.py index f6bf191c..ff7e901a 100644 --- a/pandas_ta/trend/cksp.py +++ b/pandas_ta/trend/cksp.py @@ -12,6 +12,7 @@ from pandas_ta.volatility import atr + def cksp( high: Series, low: Series, close: Series, p: Int = None, x: IntFloat = None, q: Int = None, @@ -48,7 +49,6 @@ def cksp( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: long and short columns. @@ -91,9 +91,6 @@ def cksp( if "fillna" in kwargs: long_stop.fillna(kwargs["fillna"], inplace=True) short_stop.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - long_stop.fillna(method=kwargs["fill_method"], inplace=True) - short_stop.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{p}_{x}_{q}" diff --git a/pandas_ta/trend/decay.py b/pandas_ta/trend/decay.py index 03590a8b..ade9e2b4 100644 --- a/pandas_ta/trend/decay.py +++ b/pandas_ta/trend/decay.py @@ -6,9 +6,10 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, v_str + # Exponential Decay - https://tulipindicators.org/edecay @njit -def np_exponential_decay(x, n): +def nb_exponential_decay(x, n): m, rate = x.size, 1.0 - (1.0 / n) result = zeros_like(x, dtype="float") @@ -22,7 +23,7 @@ def np_exponential_decay(x, n): # Linear Decay -https://tulipindicators.org/decay @njit -def np_linear_decay(x, n): +def nb_linear_decay(x, n): m, rate = x.size, 1.0 / n result = zeros_like(x, dtype="float") @@ -55,7 +56,6 @@ def decay( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -75,9 +75,9 @@ def decay( if mode in ["exp", "exponential"]: _mode = "EXP" - result = np_exponential_decay(np_close, length) + result = nb_exponential_decay(np_close, length) else: # "linear" - result = np_linear_decay(np_close, length) + result = nb_linear_decay(np_close, length) result = Series(result, index=close.index) @@ -88,8 +88,6 @@ def decay( # Fill if "fillna" in kwargs: result.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - result.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category result.name = f"{_mode}DECAY_{length}" diff --git a/pandas_ta/trend/decreasing.py b/pandas_ta/trend/decreasing.py index 9382057a..a3efb130 100644 --- a/pandas_ta/trend/decreasing.py +++ b/pandas_ta/trend/decreasing.py @@ -11,6 +11,7 @@ ) + def decreasing( close: Series, length: Int = None, strict: bool = None, asint: bool = None, percent: IntFloat = None, drift: Int = None, @@ -35,7 +36,6 @@ def decreasing( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -76,8 +76,6 @@ def decreasing( # Fill if "fillna" in kwargs: decreasing.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - decreasing.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _percent = f"_{0.01 * percent}" if percent else '' diff --git a/pandas_ta/trend/dpo.py b/pandas_ta/trend/dpo.py index 0e779437..3d7200e8 100644 --- a/pandas_ta/trend/dpo.py +++ b/pandas_ta/trend/dpo.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series + def dpo( close: Series, length: Int = None, centered: bool = True, offset: Int = None, **kwargs: DictLike @@ -31,9 +32,9 @@ def dpo( offset (int): How many periods to offset the result. Default: 0 Kwargs: + lookahead (value, optional): To prevent centering + and avoid potential data leakage, set to False. fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method - lookahead (value, optional): Set False to prevent centering and avoid potential data leakage. Returns: pd.Series: New feature generated. @@ -66,8 +67,6 @@ def dpo( # Fill if "fillna" in kwargs: dpo.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - dpo.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category dpo.name = f"DPO_{length}" diff --git a/pandas_ta/trend/ht_trendline.py b/pandas_ta/trend/ht_trendline.py index 4e626713..b1610193 100644 --- a/pandas_ta/trend/ht_trendline.py +++ b/pandas_ta/trend/ht_trendline.py @@ -13,8 +13,9 @@ ) + @njit -def np_ht_trendline(x): +def nb_ht_trendline(x): a, b, m = 0.0962, 0.5769, x.size wma4, dt = zeros_like(x), zeros_like(x) @@ -22,7 +23,7 @@ def np_ht_trendline(x): ji, jq = zeros_like(x), zeros_like(x) i1, i2 = zeros_like(x), zeros_like(x) re, im = zeros_like(x), zeros_like(x) - period, smooth_period = zeros_like(x), zeros_like(x) + period, smp = zeros_like(x), zeros_like(x) i_trend = zeros_like(x) result = zeros_like(x) @@ -64,9 +65,9 @@ def np_ht_trendline(x): if period[i] > 50.0: period[i] = 50.0 period[i] = 0.2 * period[i] + 0.8 * period[i - 1] - smooth_period[i] = 0.33 * period[i] + 0.67 * smooth_period[i - 1] + smp[i] = 0.33 * period[i] + 0.67 * smp[i - 1] - dc_period = int(smooth_period[i] + 0.5) + dc_period = int(smp[i] + 0.5) dcp_avg = 0 for k in range(dc_period): dcp_avg += x[i - k] @@ -87,8 +88,11 @@ def ht_trendline( prenan: Int = None, offset: Int = None, **kwargs: DictLike ) -> Series: - """Hilbert Transform TrendLine (Also known as Instantaneous TrendLine) - By removing Dominant Cycle (DC) of the time-series from itself, ht_trendline is calculated. + """Hilbert Transform TrendLine (HT_TL) + + The Hilbert Transform TrendLine or Instantaneous TrendLine as described + in Ehler's "Rocket Science for Traders" Book attempts to smooth the + source by using a bespoke application of the Hilbert Transform. Sources: https://c.mql5.com/forextsd/forum/59/023inst.pdf @@ -104,7 +108,6 @@ def ht_trendline( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: Hilbert Transformation Instantaneous Trend-line. @@ -124,7 +127,7 @@ def ht_trendline( tl = HT_TRENDLINE(close) else: np_close = close.values - np_tl = np_ht_trendline(np_close) + np_tl = nb_ht_trendline(np_close) if prenan > 0: np_tl[:prenan] = nan @@ -140,8 +143,6 @@ def ht_trendline( # Fill if "fillna" in kwargs: tl.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - tl.fillna(method=kwargs["fill_method"], inplace=True) tl.name = f"HT_TL" tl.category = "trend" diff --git a/pandas_ta/trend/increasing.py b/pandas_ta/trend/increasing.py index 43058bea..0eeecc15 100644 --- a/pandas_ta/trend/increasing.py +++ b/pandas_ta/trend/increasing.py @@ -11,6 +11,7 @@ ) + def increasing( close: Series, length: Int = None, strict: bool = None, asint: bool = None, percent: IntFloat = None, drift: Int = None, @@ -35,7 +36,6 @@ def increasing( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -76,8 +76,6 @@ def increasing( # Fill if "fillna" in kwargs: increasing.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - increasing.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _percent = f"_{0.01 * percent}" if percent else '' diff --git a/pandas_ta/trend/long_run.py b/pandas_ta/trend/long_run.py index 778d3599..e94e6e07 100644 --- a/pandas_ta/trend/long_run.py +++ b/pandas_ta/trend/long_run.py @@ -6,6 +6,7 @@ from .increasing import increasing + def long_run( fast: Series, slow: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -34,7 +35,6 @@ def long_run( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -63,8 +63,6 @@ def long_run( # Fill if "fillna" in kwargs: long_run.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - long_run.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category long_run.name = f"LR_{length}" diff --git a/pandas_ta/trend/psar.py b/pandas_ta/trend/psar.py index a2c9ac71..3ae70c39 100644 --- a/pandas_ta/trend/psar.py +++ b/pandas_ta/trend/psar.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series, zero + def psar( high: Series, low: Series, close: Series = None, af0: IntFloat = None, af: IntFloat = None, max_af: IntFloat = None, tv=False, @@ -38,7 +39,6 @@ def psar( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: long, short, af, and reversal columns. @@ -139,11 +139,6 @@ def psar( long.fillna(kwargs["fillna"], inplace=True) short.fillna(kwargs["fillna"], inplace=True) reversal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - _af.fillna(method=kwargs["fill_method"], inplace=True) - long.fillna(method=kwargs["fill_method"], inplace=True) - short.fillna(method=kwargs["fill_method"], inplace=True) - reversal.fillna(method=kwargs["fill_method"], inplace=True) _params = f"_{af0}_{max_af}" data = { diff --git a/pandas_ta/trend/qstick.py b/pandas_ta/trend/qstick.py index eab65e32..0362c637 100644 --- a/pandas_ta/trend/qstick.py +++ b/pandas_ta/trend/qstick.py @@ -11,6 +11,7 @@ ) + def qstick( open_: Series, close: Series, length: Int = None, mamode: str = None, offset: Int = None, **kwargs: DictLike @@ -32,7 +33,6 @@ def qstick( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -59,8 +59,6 @@ def qstick( # Fill if "fillna" in kwargs: qstick.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - qstick.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category qstick.name = f"QS_{length}" diff --git a/pandas_ta/trend/rwi.py b/pandas_ta/trend/rwi.py index 92cea06e..612288ae 100644 --- a/pandas_ta/trend/rwi.py +++ b/pandas_ta/trend/rwi.py @@ -13,6 +13,7 @@ ) + def rwi( high: Series, low: Series, close: Series, length: Int = None, mamode: str = None, talib: bool = None, @@ -39,7 +40,6 @@ def rwi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: high, low columns. @@ -81,10 +81,6 @@ def rwi( rwi_high.fillna(kwargs["fillna"], inplace=True) rwi_low.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rwi_high.fillna(method=kwargs["fill_method"], inplace=True) - rwi_low.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category rwi_high.name = f"RWIh_{length}" rwi_low.name = f"RWIl_{length}" diff --git a/pandas_ta/trend/short_run.py b/pandas_ta/trend/short_run.py index 19dc3460..c66cadcb 100644 --- a/pandas_ta/trend/short_run.py +++ b/pandas_ta/trend/short_run.py @@ -6,6 +6,7 @@ from .increasing import increasing + def short_run( fast: Series, slow: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -34,7 +35,6 @@ def short_run( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -63,8 +63,6 @@ def short_run( # Fill if "fillna" in kwargs: short_run.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - short_run.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category short_run.name = f"SR_{length}" diff --git a/pandas_ta/trend/trendflex.py b/pandas_ta/trend/trendflex.py index b5bab922..e9da82cb 100644 --- a/pandas_ta/trend/trendflex.py +++ b/pandas_ta/trend/trendflex.py @@ -6,10 +6,11 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + # Ehler's Trendflex # http://traders.com/Documentation/FEEDbk_docs/2020/02/TradersTips.html @njit -def np_trendflex(x, n, k, alpha, pi, sqrt2): +def nb_trendflex(x, n, k, alpha, pi, sqrt2): m, ratio = x.size, 2 * sqrt2 / k a = exp(-pi * ratio) b = 2 * a * cos(180 * ratio) @@ -73,7 +74,6 @@ def trendflex( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -93,7 +93,7 @@ def trendflex( # Calculate np_close = close.values - result = np_trendflex(np_close, length, smooth, alpha, pi, sqrt2) + result = nb_trendflex(np_close, length, smooth, alpha, pi, sqrt2) result[:length] = nan result = Series(result, index=close.index) @@ -104,8 +104,6 @@ def trendflex( # Fill if "fillna" in kwargs: result.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - result.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category result.name = f"TRENDFLEX_{length}_{smooth}_{alpha}" diff --git a/pandas_ta/trend/tsignals.py b/pandas_ta/trend/tsignals.py index a6e781b2..36f07ac2 100644 --- a/pandas_ta/trend/tsignals.py +++ b/pandas_ta/trend/tsignals.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_bool, v_drift, v_int, v_offset, v_series + def tsignals( trend: Series, asbool: bool = None, trend_reset: Int = None, trade_offset: Int = None, drift: Int = None, @@ -43,7 +44,6 @@ def tsignals( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame with columns: @@ -86,8 +86,6 @@ def tsignals( # Fill if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category df.name = f"TS" diff --git a/pandas_ta/trend/ttm_trend.py b/pandas_ta/trend/ttm_trend.py index 7e4f0468..ca960b8b 100644 --- a/pandas_ta/trend/ttm_trend.py +++ b/pandas_ta/trend/ttm_trend.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def ttm_trend( high: Series, low: Series, close: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -29,7 +30,6 @@ def ttm_trend( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: ttm_trend. @@ -62,8 +62,6 @@ def ttm_trend( # Fill if "fillna" in kwargs: tm_trend.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - tm_trend.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category tm_trend.name = f"TTM_TRND_{length}" diff --git a/pandas_ta/trend/vhf.py b/pandas_ta/trend/vhf.py index 40e47075..d8bbdc7c 100644 --- a/pandas_ta/trend/vhf.py +++ b/pandas_ta/trend/vhf.py @@ -11,6 +11,7 @@ ) + def vhf( close: Series, length: Int = None, drift: Int = None, offset: Int = None, **kwargs: DictLike @@ -29,7 +30,6 @@ def vhf( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -59,8 +59,6 @@ def vhf( # Fill if "fillna" in kwargs: vhf.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - vhf.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category vhf.name = f"VHF_{length}" diff --git a/pandas_ta/trend/vortex.py b/pandas_ta/trend/vortex.py index f63ccb80..940cb85b 100644 --- a/pandas_ta/trend/vortex.py +++ b/pandas_ta/trend/vortex.py @@ -5,6 +5,7 @@ from pandas_ta.volatility import true_range + def vortex( high: Series, low: Series, close: Series, length: Int = None, drift: Int = None, @@ -27,7 +28,6 @@ def vortex( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: vip and vim columns @@ -68,9 +68,6 @@ def vortex( if "fillna" in kwargs: vip.fillna(kwargs["fillna"], inplace=True) vim.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - vip.fillna(method=kwargs["fill_method"], inplace=True) - vim.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category vip.name = f"VTXP_{length}" diff --git a/pandas_ta/trend/xsignals.py b/pandas_ta/trend/xsignals.py index 19933c8f..ca42f014 100644 --- a/pandas_ta/trend/xsignals.py +++ b/pandas_ta/trend/xsignals.py @@ -6,6 +6,7 @@ from pandas_ta.utils import cross_value, v_offset, v_series + def xsignals( signal: Series, xa: Union[IntFloat, Series], @@ -71,7 +72,6 @@ def xsignals( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame with columns: @@ -117,8 +117,6 @@ def xsignals( # Fill if "fillna" in kwargs: df.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - df.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category df.name = f"XS" diff --git a/pandas_ta/trend/zigzag.py b/pandas_ta/trend/zigzag.py index eb6a4176..258675ff 100644 --- a/pandas_ta/trend/zigzag.py +++ b/pandas_ta/trend/zigzag.py @@ -11,6 +11,7 @@ ) + def zigzag( high: Series, low: Series, close: Series = None, pivot_leg: int = None, price_deviation: IntFloat = None, @@ -45,7 +46,6 @@ def zigzag( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: swing, and swing_type (high or low). @@ -81,6 +81,5 @@ def zigzag( # Fill # if "fillna" in kwargs: - # if "fill_method" in kwargs: # Name and Category diff --git a/pandas_ta/utils/_candles.py b/pandas_ta/utils/_candles.py index b61e3f58..a6c944c0 100644 --- a/pandas_ta/utils/_candles.py +++ b/pandas_ta/utils/_candles.py @@ -5,6 +5,7 @@ __all__ = ["candle_color", "high_low_range", "real_body"] + def candle_color(open_: Series, close: Series) -> Series: """Candle Change diff --git a/pandas_ta/utils/_core.py b/pandas_ta/utils/_core.py index e25c678f..95838dae 100644 --- a/pandas_ta/utils/_core.py +++ b/pandas_ta/utils/_core.py @@ -18,8 +18,8 @@ "category_files", "client_exists", "ms2secs", + "nb_non_zero_range", "non_zero_range", - "np_non_zero_range", "recent_maximum_index", "recent_minimum_index", "rma_pandas", @@ -31,6 +31,7 @@ ] + def camelCase2Title(x: str): """https://stackoverflow.com/questions/5020906/python-convert-camel-case-to-space-delimited-using-regex-and-taking-acronyms-in""" return re_.sub("([a-z])([A-Z])", "\\g<1> \\g<2>", x).title() @@ -66,7 +67,7 @@ def non_zero_range(high: Series, low: Series) -> Series: @njit -def np_non_zero_range(x, y): +def nb_non_zero_range(x, y): diff = x - y if diff.any() == 0: diff += finfo(float64).eps diff --git a/pandas_ta/utils/_math.py b/pandas_ta/utils/_math.py index c2f174cb..ff86869d 100644 --- a/pandas_ta/utils/_math.py +++ b/pandas_ta/utils/_math.py @@ -11,7 +11,6 @@ ) from pandas import DataFrame, Series from numba import njit - from pandas_ta._typing import ( Array, DictLike, @@ -41,6 +40,7 @@ ] + def combination( n: Int = 1, r: Int = 0, repetition: bool = False, multichoose: bool = False @@ -114,7 +114,7 @@ def geometric_mean(series: Series) -> Float: def hpoly(x: Array, v: IntFloat) -> Float: - """Horner Calculation for Polynomial Evaluation (hpoly) + """Horner's Calculation for Polynomial Evaluation (hpoly) array: np.array of polynomial coefficients * Convert list or Series to np.array prior to calling the method for diff --git a/pandas_ta/utils/_metrics.py b/pandas_ta/utils/_metrics.py index 8d3a11f5..b6f22b31 100644 --- a/pandas_ta/utils/_metrics.py +++ b/pandas_ta/utils/_metrics.py @@ -23,6 +23,7 @@ ] + def cagr(close: Series) -> IntFloat: """Compounded Annual Growth Rate diff --git a/pandas_ta/utils/_numba.py b/pandas_ta/utils/_numba.py index c36f5511..ea38f4e0 100644 --- a/pandas_ta/utils/_numba.py +++ b/pandas_ta/utils/_numba.py @@ -1,20 +1,65 @@ # -*- coding: utf-8 -*- -from numpy import append, array, empty_like, nan, roll, zeros_like +from numpy import ( + append, + arange, + array, + empty_like, + float64, + int64, + isnan, + maximum, + nan, + roll, + where, + zeros_like +) from numba import njit from pandas_ta._typing import Array, Int, IntFloat __all__ = [ - "np_prenan", - "np_prepend", - "np_rolling", - "np_shift", + "nb_ffill", + "nb_idiff", + "nb_prenan", + "nb_prepend", + "nb_rolling", + "nb_shift", ] + +# Numba version of ffill() +@njit +def nb_ffill(x): + mask = isnan(x) + idx = zeros_like(mask, dtype=int64) + last_valid_idx = -1 + + m = mask.size + for i in range(m): + if not mask[i]: + last_valid_idx = i + idx[i] = last_valid_idx + return x[idx] + + +# Indexwise element difference by k indices of array x. +# Similar to Pandas Series/DataFrame diff() +@njit +def nb_idiff(x, k): + n, k = x.size, int(k) + result = zeros_like(x, dtype=float64) + + for i in range(k, n): + result[i] = x[i] - x[i - k] + result[:k] = nan + + return result + + # Prepend n values, typically np.nan, to array x. @njit -def np_prenan(x, n, value = nan): +def nb_prenan(x, n, value = nan): if n > 0: x[:n - 1] = value return x @@ -23,13 +68,13 @@ def np_prenan(x, n, value = nan): # Prepend n values, typically np.nan, to array x. @njit -def np_prepend(x, n, value = nan): +def nb_prepend(x, n, value = nan): return append(array([value] * n), x) # Like Pandas Rolling Window. x.rolling(n).fn() @njit -def np_rolling(x, n, fn = None): +def nb_rolling(x, n, fn = None): if fn is None: return x m = x.size @@ -48,7 +93,7 @@ def np_rolling(x, n, fn = None): # shift5 - preallocate empty array and assign slice by chrisaycock # https://stackoverflow.com/questions/30399534/shift-elements-in-a-numpy-array @njit -def np_shift(x, n, value = nan): +def nb_shift(x, n, value = nan): result = empty_like(x) if n > 0: result[:n] = value @@ -63,7 +108,7 @@ def np_shift(x, n, value = nan): # Uncategorized # @njit -# def np_roofing_filter(x: Array, n: Int, k: Int, pi: Float, sqrt2: Float): +# def nb_roofing_filter(x: Array, n: Int, k: Int, pi: Float, sqrt2: Float): # """Ehler's Roofing Filter (INCOMPLETE) # http://traders.com/documentation/feedbk_docs/2014/01/traderstips.html""" # m, hp = x.size, np.copy(x) @@ -78,5 +123,5 @@ def np_shift(x, n, value = nan): # hp = c * c * (x[i] - 2 * x[i - 1] + x[i - 2]) \ # + 2 * b * hp[i - 1] - b * b * hp[i - 2] -# result = np_ssf(hp, k, pi, rsqrt2) +# result = nb_ssf(hp, k, pi, rsqrt2) # return result diff --git a/pandas_ta/utils/_signals.py b/pandas_ta/utils/_signals.py index c5191fda..e1049c7b 100644 --- a/pandas_ta/utils/_signals.py +++ b/pandas_ta/utils/_signals.py @@ -15,6 +15,7 @@ ] + def _above_below( series_a: Series, series_b: Series, above: bool = True, asint: bool = True, diff --git a/pandas_ta/utils/_stats.py b/pandas_ta/utils/_stats.py index 56eb7d71..cffa6ac4 100644 --- a/pandas_ta/utils/_stats.py +++ b/pandas_ta/utils/_stats.py @@ -7,6 +7,7 @@ __all__ = ["inv_norm"] + def _gaussian_poly_coefficients() -> Array: """Three pairs of Polynomial Approximation Coefficients for the Gaussian Normal CDF""" diff --git a/pandas_ta/utils/_study.py b/pandas_ta/utils/_study.py index 45227ac1..0af2805e 100644 --- a/pandas_ta/utils/_study.py +++ b/pandas_ta/utils/_study.py @@ -15,6 +15,7 @@ ] + # Study DataClass @dataclass class Study: diff --git a/pandas_ta/utils/_time.py b/pandas_ta/utils/_time.py index 5bcb0d6a..9126b3e5 100644 --- a/pandas_ta/utils/_time.py +++ b/pandas_ta/utils/_time.py @@ -22,6 +22,7 @@ ] + def df_dates( df: DataFrame, dates: Tuple[str, list] = None ) -> MaybeSeriesFrame: diff --git a/pandas_ta/utils/_validate.py b/pandas_ta/utils/_validate.py index 26fcab1e..6c55418d 100644 --- a/pandas_ta/utils/_validate.py +++ b/pandas_ta/utils/_validate.py @@ -37,21 +37,25 @@ ] + def is_percent(x: IntFloat) -> bool: if isinstance(x, (float, int, np_floating, np_integer)): return x is not None and 0 <= x <= 100 return False + def v_bool(var: bool, default: bool = True) -> bool: """Returns default=True if var is not a bool.""" if isinstance(var, bool): return bool(var) return default + def v_dataframe(obj: MaybeSeriesFrame) -> None: if not isinstance(obj, (DataFrame, Series)): print("[X] Requires a Pandas Series or DataFrame.") + def v_float( var: IntFloat, default: IntFloat, ne: Optional[IntFloat] = 0.0 ) -> Float: @@ -62,6 +66,7 @@ def v_float( return float(var) return float(default) + def v_int(var: Int, default: Int, ne: Optional[Int] = 0) -> Int: """Returns the default if var is not equal to the ne value.""" if isinstance(var, int) and int(var) != int(ne): @@ -70,16 +75,19 @@ def v_int(var: Int, default: Int, ne: Optional[Int] = 0) -> Int: return var.item() return int(default) + def v_str(var: str, default: str) -> str: """"Returns the default value if var is not a empty str""" if isinstance(var, str) and len(var) > 0: return f"{var}" return f"{default}" + def v_ascending(var: bool) -> bool: """Returns True by default""" return partial(v_bool, default=True)(var=var) + def v_datetime_ordered(df: SeriesFrame) -> bool: if df.shape[0] < 2: return False @@ -89,16 +97,19 @@ def v_datetime_ordered(df: SeriesFrame) -> bool: return True return False + def v_drift(var: Int) -> Int: """Defaults to 1""" return partial(v_int, default=1, ne=0)(var=var) + def v_list(var: List, default: List = []) -> List: """Returns [] if not a valid list""" if isinstance(var, list) and len(var) > 0: return var return default + def v_lowerbound( var: IntFloat, bound: IntFloat = 0, default: IntFloat = 0, strict: bool = True, complement: bool = False @@ -123,25 +134,30 @@ def v_lowerbound( return var_type(var) return default + def v_mamode(var: str, default: str) -> str: # Could be an alias. return v_str(var, default) + def v_offset(var: Int) -> Int: """Defaults to 0""" return partial(v_int, default=0, ne=0)(var=var) + def v_pos_default( var: IntFloat, default: IntFloat = 0, strict: bool = True, complement: bool = False ) -> IntFloat: return partial(v_lowerbound, bound=0) \ (var=var, default=default, strict=strict, complement=complement) + def v_scalar(var: IntFloat, default: Optional[IntFloat] = 1) -> Float: """Returns the default if var is not a float.""" if isinstance(var, (float, int, np_floating, np_integer)): return float(var) return float(default) + def v_series(series: Series, length: Optional[IntFloat] = 0) -> Optional[Series]: """Returns None if the Pandas Series does not meet the minimum length required for the indicator.""" @@ -150,14 +166,17 @@ def v_series(series: Series, length: Optional[IntFloat] = 0) -> Optional[Series] return series return None + def v_talib(var: bool) -> bool: """Returns True by default""" return partial(v_bool, default=True)(var=var) + def v_tradingview(var: bool) -> bool: """Returns True by default""" return partial(v_bool, default=True)(var=var) + def v_upperbound( var: IntFloat, bound: IntFloat = 0, default: IntFloat = 0, strict: bool = True diff --git a/pandas_ta/volatility/aberration.py b/pandas_ta/volatility/aberration.py index 21082580..35f23715 100644 --- a/pandas_ta/volatility/aberration.py +++ b/pandas_ta/volatility/aberration.py @@ -6,6 +6,7 @@ from .atr import atr + def aberration( high: Series, low: Series, close: Series, length: Int = None, atr_length: Int = None, @@ -19,18 +20,6 @@ def aberration( Few internet resources on definitive definition. Request by Github user homily, issue #46 - Calculation: - Default Inputs: - length=5, atr_length=15 - ATR = Average True Range - SMA = Simple Moving Average - - ATR = ATR(length=atr_length) - JG = TP = HLC3(high, low, close) - ZG = SMA(JG, length) - SG = ZG + ATR - XG = ZG - ATR - Args: high (pd.Series): Series of 'high's low (pd.Series): Series of 'low's @@ -41,7 +30,6 @@ def aberration( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: zg, sg, xg, atr columns. @@ -80,11 +68,6 @@ def aberration( sg.fillna(kwargs["fillna"], inplace=True) xg.fillna(kwargs["fillna"], inplace=True) atr_.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - zg.fillna(method=kwargs["fill_method"], inplace=True) - sg.fillna(method=kwargs["fill_method"], inplace=True) - xg.fillna(method=kwargs["fill_method"], inplace=True) - atr_.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{atr_length}" diff --git a/pandas_ta/volatility/accbands.py b/pandas_ta/volatility/accbands.py index b0e325cb..2c1ae64a 100644 --- a/pandas_ta/volatility/accbands.py +++ b/pandas_ta/volatility/accbands.py @@ -12,6 +12,7 @@ ) + def accbands( high: Series, low: Series, close: Series, length: Int = None, c: IntFloat = None, drift: Int = None, mamode: str = None, @@ -37,7 +38,6 @@ def accbands( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: lower, mid, upper columns. @@ -78,10 +78,6 @@ def accbands( lower.fillna(kwargs["fillna"], inplace=True) mid.fillna(kwargs["fillna"], inplace=True) upper.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - lower.fillna(method=kwargs["fill_method"], inplace=True) - mid.fillna(method=kwargs["fill_method"], inplace=True) - upper.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category lower.name = f"ACCBL_{length}" diff --git a/pandas_ta/volatility/atr.py b/pandas_ta/volatility/atr.py index 8d9e18c9..5a4aa0cd 100644 --- a/pandas_ta/volatility/atr.py +++ b/pandas_ta/volatility/atr.py @@ -16,6 +16,7 @@ from .true_range import true_range + def atr( high: Series, low: Series, close: Series, length: Int = None, mamode: str = None, talib: bool = None, @@ -46,7 +47,6 @@ def atr( Kwargs: percent (bool, optional): Return as percentage. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -100,8 +100,6 @@ def atr( # Fill if "fillna" in kwargs: atr.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - atr.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category atr.name = f"ATR{mamode[0]}{'p' if percent else ''}_{length}" diff --git a/pandas_ta/volatility/atrts.py b/pandas_ta/volatility/atrts.py index 18965805..39d53286 100644 --- a/pandas_ta/volatility/atrts.py +++ b/pandas_ta/volatility/atrts.py @@ -16,8 +16,9 @@ from pandas_ta.volatility import atr + @njit -def np_atrts(x, ma, atr_, length, ma_length): +def nb_atrts(x, ma, atr_, length, ma_length): m = x.size k = max(length, ma_length) @@ -83,7 +84,6 @@ def atrts( Kwargs: percent (bool, optional): Return as percentage. Default: False fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -123,7 +123,7 @@ def atrts( ma_ = _ma(mamode, close, length=ma_length, talib=mode_tal) np_close, np_ma, np_atr = close.values, ma_.values, atr_.values - np_atrts_, _, _ = np_atrts(np_close, np_ma, np_atr, length, ma_length) + np_atrts_, _, _ = nb_atrts(np_close, np_ma, np_atr, length, ma_length) percent = kwargs.pop("percent", False) if percent: @@ -138,8 +138,6 @@ def atrts( # Fill if "fillna" in kwargs: atrts.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - atrts.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"ATRTS{mamode[0]}{'p' if percent else ''}" diff --git a/pandas_ta/volatility/bbands.py b/pandas_ta/volatility/bbands.py index 2892f3cf..2cc19c71 100644 --- a/pandas_ta/volatility/bbands.py +++ b/pandas_ta/volatility/bbands.py @@ -15,6 +15,7 @@ ) + def bbands( close: Series, length: Int = None, std: IntFloat = None, ddof: Int = 0, mamode: str = None, talib: bool = None, @@ -43,7 +44,6 @@ def bbands( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: lower, mid, upper, bandwidth, and percent columns. @@ -93,12 +93,6 @@ def bbands( upper.fillna(kwargs["fillna"], inplace=True) bandwidth.fillna(kwargs["fillna"], inplace=True) percent.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - lower.fillna(method=kwargs["fill_method"], inplace=True) - mid.fillna(method=kwargs["fill_method"], inplace=True) - upper.fillna(method=kwargs["fill_method"], inplace=True) - bandwidth.fillna(method=kwargs["fill_method"], inplace=True) - percent.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{std}" diff --git a/pandas_ta/volatility/chandelier_exit.py b/pandas_ta/volatility/chandelier_exit.py index 2ceeaec0..b861fa5b 100644 --- a/pandas_ta/volatility/chandelier_exit.py +++ b/pandas_ta/volatility/chandelier_exit.py @@ -14,6 +14,7 @@ ) + def chandelier_exit( high: Series, low: Series, close: Series, high_length: Int = None, low_length: Int = None, @@ -50,7 +51,6 @@ def chandelier_exit( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: CHDLREXTl (long), CHDLREXTs (short), CHDLREXTd (direction) @@ -112,10 +112,6 @@ def chandelier_exit( long.fillna(kwargs["fillna"], inplace=True) short.fillna(kwargs["fillna"], inplace=True) direction.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - long.fillna(method=kwargs["fill_method"], inplace=True) - short.fillna(method=kwargs["fill_method"], inplace=True) - direction.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _name = "CHDLREXT" diff --git a/pandas_ta/volatility/donchian.py b/pandas_ta/volatility/donchian.py index 55b05015..aa253a5f 100644 --- a/pandas_ta/volatility/donchian.py +++ b/pandas_ta/volatility/donchian.py @@ -4,6 +4,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def donchian( high: Series, low: Series, lower_length: Int = None, upper_length: Int = None, @@ -26,7 +27,6 @@ def donchian( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: lower, mid, upper columns. @@ -56,10 +56,6 @@ def donchian( lower.fillna(kwargs["fillna"], inplace=True) mid.fillna(kwargs["fillna"], inplace=True) upper.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - lower.fillna(method=kwargs["fill_method"], inplace=True) - mid.fillna(method=kwargs["fill_method"], inplace=True) - upper.fillna(method=kwargs["fill_method"], inplace=True) # Offset if offset != 0: diff --git a/pandas_ta/volatility/hwc.py b/pandas_ta/volatility/hwc.py index 545fb17c..81529b86 100644 --- a/pandas_ta/volatility/hwc.py +++ b/pandas_ta/volatility/hwc.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_bool, v_offset, v_pos_default, v_series + def hwc( close: Series, scalar: IntFloat = None, channels: bool = None, na: IntFloat = None, nb: IntFloat = None, @@ -36,7 +37,6 @@ def hwc( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: HWM (Mid), HWU (Upper), HWL (Lower) columns. @@ -115,14 +115,6 @@ def hwc( hwc_width.fillna(kwargs["fillna"], inplace=True) hwc_pctwidth.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - hwc.fillna(method=kwargs["fill_method"], inplace=True) - hwc_upper.fillna(method=kwargs["fill_method"], inplace=True) - hwc_lower.fillna(method=kwargs["fill_method"], inplace=True) - if channels: - hwc_width.fillna(method=kwargs["fill_method"], inplace=True) - hwc_pctwidth.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category _props = f"_{scalar}" hwc.name = f"HWM{_props}" diff --git a/pandas_ta/volatility/kc.py b/pandas_ta/volatility/kc.py index cb7256f4..0050ebd1 100644 --- a/pandas_ta/volatility/kc.py +++ b/pandas_ta/volatility/kc.py @@ -13,6 +13,7 @@ from .true_range import true_range + def kc( high: Series, low: Series, close: Series, length: Int = None, scalar: IntFloat = None, @@ -41,7 +42,6 @@ def kc( When False, use a high - low as it's range calculation. Default: True fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: lower, basis, upper columns. @@ -80,10 +80,6 @@ def kc( lower.fillna(kwargs["fillna"], inplace=True) basis.fillna(kwargs["fillna"], inplace=True) upper.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - lower.fillna(method=kwargs["fill_method"], inplace=True) - basis.fillna(method=kwargs["fill_method"], inplace=True) - upper.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"{mamode.lower()[0] if len(mamode) else ''}_{length}_{scalar}" diff --git a/pandas_ta/volatility/massi.py b/pandas_ta/volatility/massi.py index 9c95f39a..797b6186 100644 --- a/pandas_ta/volatility/massi.py +++ b/pandas_ta/volatility/massi.py @@ -6,6 +6,7 @@ from pandas_ta.utils import non_zero_range, v_offset, v_pos_default, v_series + def massi( high: Series, low: Series, fast: Int = None, slow: Int = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def massi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -70,8 +70,6 @@ def massi( # Fill if "fillna" in kwargs: massi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - massi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category massi.name = f"MASSI_{fast}_{slow}" diff --git a/pandas_ta/volatility/natr.py b/pandas_ta/volatility/natr.py index e4d16098..90dba698 100644 --- a/pandas_ta/volatility/natr.py +++ b/pandas_ta/volatility/natr.py @@ -3,6 +3,7 @@ from pandas_ta._typing import DictLike, Int, IntFloat from pandas_ta.maps import Imports from pandas_ta.utils import ( + v_bool, v_drift, v_mamode, v_offset, @@ -14,10 +15,11 @@ from pandas_ta.volatility import atr + def natr( high: Series, low: Series, close: Series, length: Int = None, scalar: IntFloat = None, mamode: str = None, - talib: bool = None, drift: Int = None, + talib: bool = None, prenan: bool = None, drift: Int = None, offset: Int = None, **kwargs: DictLike ) -> Series: """Normalized Average True Range (NATR) @@ -36,11 +38,12 @@ def natr( mamode (str): See ``help(ta.ma)``. Default: 'ema' talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib version. Default: True + prenan (bool): If True, behave like TA Lib ATR with some initial nan + based on drift (typically 1). Default: False offset (int): How many periods to offset the result. Default: 0 Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature @@ -58,6 +61,7 @@ def natr( scalar = v_scalar(scalar, 100) mamode = v_mamode(mamode, "ema") mode_tal = v_talib(talib) + prenan = v_bool(prenan, False) drift = v_drift(drift) offset = v_offset(offset) @@ -70,7 +74,7 @@ def natr( atr( high=high, low=low, close=close, length=length, mamode=mamode, drift=drift, talib=mode_tal, - offset=offset, **kwargs + prenan=prenan, offset=offset, **kwargs ) # Offset @@ -80,8 +84,6 @@ def natr( # Fill if "fillna" in kwargs: natr.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - natr.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category natr.name = f"NATR_{length}" diff --git a/pandas_ta/volatility/pdist.py b/pandas_ta/volatility/pdist.py index 04c39cfe..49902d63 100644 --- a/pandas_ta/volatility/pdist.py +++ b/pandas_ta/volatility/pdist.py @@ -5,6 +5,7 @@ from pandas_ta.utils import non_zero_range, v_drift, v_offset, v_series + def pdist( open_: Series, high: Series, low: Series, close: Series, drift: Int = None, @@ -27,7 +28,6 @@ def pdist( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -58,8 +58,6 @@ def pdist( # Fill if "fillna" in kwargs: pdist.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pdist.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pdist.name = "PDIST" diff --git a/pandas_ta/volatility/rvi.py b/pandas_ta/volatility/rvi.py index 74230127..703edf85 100644 --- a/pandas_ta/volatility/rvi.py +++ b/pandas_ta/volatility/rvi.py @@ -15,6 +15,7 @@ ) + def _rvi(source, length, scalar, mode, drift): """RVI""" std = stdev(source, length) @@ -62,7 +63,6 @@ def rvi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: lower, basis, upper columns. @@ -111,8 +111,6 @@ def rvi( # Fill if "fillna" in kwargs: rvi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - rvi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category rvi.name = f"RVI{_mode}_{length}" diff --git a/pandas_ta/volatility/thermo.py b/pandas_ta/volatility/thermo.py index e89c443f..d3b4a5fa 100644 --- a/pandas_ta/volatility/thermo.py +++ b/pandas_ta/volatility/thermo.py @@ -12,6 +12,7 @@ ) + def thermo( high: Series, low: Series, length: Int = None, long: Int = None, short: Int = None, @@ -39,7 +40,6 @@ def thermo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: thermo, thermo_ma, thermo_long, thermo_short columns. @@ -89,11 +89,6 @@ def thermo( thermo_ma.fillna(kwargs["fillna"], inplace=True) thermo_long.fillna(kwargs["fillna"], inplace=True) thermo_short.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - thermo.fillna(method=kwargs["fill_method"], inplace=True) - thermo_ma.fillna(method=kwargs["fill_method"], inplace=True) - thermo_long.fillna(method=kwargs["fill_method"], inplace=True) - thermo_short.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{long}_{short}" diff --git a/pandas_ta/volatility/true_range.py b/pandas_ta/volatility/true_range.py index d9e0b5f4..a5c8e81b 100644 --- a/pandas_ta/volatility/true_range.py +++ b/pandas_ta/volatility/true_range.py @@ -13,6 +13,7 @@ ) + def true_range( high: Series, low: Series, close: Series, talib: bool = None, prenan: bool = None, drift: Int = None, @@ -39,7 +40,6 @@ def true_range( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature @@ -81,8 +81,6 @@ def true_range( # Fill if "fillna" in kwargs: true_range.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - true_range.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category true_range.name = f"TRUERANGE_{drift}" diff --git a/pandas_ta/volatility/ui.py b/pandas_ta/volatility/ui.py index d05bf05d..85920087 100644 --- a/pandas_ta/volatility/ui.py +++ b/pandas_ta/volatility/ui.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def ui( close: Series, length: Int = None, scalar: Int = None, offset: Int = None, **kwargs: DictLike @@ -29,10 +30,9 @@ def ui( offset (int): How many periods to offset the result. Default: 0 Kwargs: - fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method everget (value, optional): TradingView's Evergets SMA instead of SUM calculation. Default: False + fillna (value, optional): pd.DataFrame.fillna(value) Returns: pd.Series: New feature @@ -67,8 +67,6 @@ def ui( # Fill if "fillna" in kwargs: ui.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ui.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category ui.name = f"UI{'' if not everget else 'e'}_{length}" diff --git a/pandas_ta/volume/ad.py b/pandas_ta/volume/ad.py index 2e9e30c5..e7c89fc4 100644 --- a/pandas_ta/volume/ad.py +++ b/pandas_ta/volume/ad.py @@ -5,6 +5,7 @@ from pandas_ta.utils import non_zero_range, v_offset, v_series, v_talib + def ad( high: Series, low: Series, close: Series, volume: Series, open_: Series = None, talib: bool = None, @@ -30,7 +31,6 @@ def ad( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -65,8 +65,6 @@ def ad( # Fill if "fillna" in kwargs: ad.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - ad.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category ad.name = "AD" if open_ is None else "ADo" diff --git a/pandas_ta/volume/adosc.py b/pandas_ta/volume/adosc.py index 07bb5a42..45eb1835 100644 --- a/pandas_ta/volume/adosc.py +++ b/pandas_ta/volume/adosc.py @@ -7,6 +7,7 @@ from pandas_ta.volume import ad + def adosc( high: Series, low: Series, close: Series, volume: Series, open_: Series = None, fast: Int = None, slow: Int = None, @@ -36,7 +37,6 @@ def adosc( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -80,8 +80,6 @@ def adosc( # Fill if "fillna" in kwargs: adosc.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - adosc.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category adosc.name = f"ADOSC_{fast}_{slow}" diff --git a/pandas_ta/volume/aobv.py b/pandas_ta/volume/aobv.py index 4bfc4f16..0a97a7a9 100644 --- a/pandas_ta/volume/aobv.py +++ b/pandas_ta/volume/aobv.py @@ -8,6 +8,7 @@ from .obv import obv + def aobv( close: Series, volume: Series, fast: Int = None, slow: Int = None, max_lookback: Int = None, min_lookback: Int = None, @@ -38,7 +39,6 @@ def aobv( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: OBV_MIN, OBV_MAX, OBV_FMA, OBV_SMA, OBV_LR, OBV_SR columns. @@ -89,12 +89,6 @@ def aobv( mas.fillna(kwargs["fillna"], inplace=True) obv_long.fillna(kwargs["fillna"], inplace=True) obv_short.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - obv_.fillna(method=kwargs["fill_method"], inplace=True) - maf.fillna(method=kwargs["fill_method"], inplace=True) - mas.fillna(method=kwargs["fill_method"], inplace=True) - obv_long.fillna(method=kwargs["fill_method"], inplace=True) - obv_short.fillna(method=kwargs["fill_method"], inplace=True) _mode = mamode.lower()[0] if len(mamode) else "" data = { diff --git a/pandas_ta/volume/cmf.py b/pandas_ta/volume/cmf.py index 27357811..f15ffc43 100644 --- a/pandas_ta/volume/cmf.py +++ b/pandas_ta/volume/cmf.py @@ -4,6 +4,7 @@ from pandas_ta.utils import non_zero_range, v_offset, v_pos_default, v_series + def cmf( high: Series, low: Series, close: Series, volume: Series, open_: Series = None, length: Int = None, @@ -29,7 +30,6 @@ def cmf( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -69,8 +69,6 @@ def cmf( # Fill if "fillna" in kwargs: cmf.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - cmf.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category cmf.name = f"CMF_{length}" diff --git a/pandas_ta/volume/efi.py b/pandas_ta/volume/efi.py index 99d0b49c..25e82258 100644 --- a/pandas_ta/volume/efi.py +++ b/pandas_ta/volume/efi.py @@ -11,6 +11,7 @@ ) + def efi( close: Series, volume: Series, length: Int = None, mamode: str = None, drift: Int = None, @@ -35,7 +36,6 @@ def efi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -63,8 +63,6 @@ def efi( # Fill if "fillna" in kwargs: efi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - efi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category efi.name = f"EFI_{length}" diff --git a/pandas_ta/volume/eom.py b/pandas_ta/volume/eom.py index 7044752f..e3127ee2 100644 --- a/pandas_ta/volume/eom.py +++ b/pandas_ta/volume/eom.py @@ -11,6 +11,7 @@ ) + def eom( high: Series, low: Series, close: Series, volume: Series, length: Int = None, divisor: IntFloat= None, drift: Int = None, @@ -39,7 +40,6 @@ def eom( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -75,8 +75,6 @@ def eom( # Fill if "fillna" in kwargs: eom.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - eom.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category eom.name = f"EOM_{length}_{divisor}" diff --git a/pandas_ta/volume/kvo.py b/pandas_ta/volume/kvo.py index f6089595..62e8adad 100644 --- a/pandas_ta/volume/kvo.py +++ b/pandas_ta/volume/kvo.py @@ -14,6 +14,7 @@ ) + def kvo( high: Series, low: Series, close: Series, volume: Series, fast: Int = None, slow: Int = None, signal: Int = None, @@ -42,7 +43,6 @@ def kvo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: KVO and Signal columns. @@ -85,9 +85,6 @@ def kvo( if "fillna" in kwargs: kvo.fillna(kwargs["fillna"], inplace=True) kvo_signal.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - kvo.fillna(method=kwargs["fill_method"], inplace=True) - kvo_signal.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{fast}_{slow}_{signal}" diff --git a/pandas_ta/volume/mfi.py b/pandas_ta/volume/mfi.py index f5a4c546..e6d4d4ea 100644 --- a/pandas_ta/volume/mfi.py +++ b/pandas_ta/volume/mfi.py @@ -6,7 +6,7 @@ from pandas_ta.maps import Imports from pandas_ta.overlap import hlc3 from pandas_ta.utils import ( - np_non_zero_range, + nb_non_zero_range, v_drift, v_offset, v_pos_default, @@ -15,6 +15,7 @@ ) + def mfi( high: Series, low: Series, close: Series, volume: Series, length: Int = None, talib: bool = None, drift: Int = None, @@ -41,7 +42,6 @@ def mfi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -86,8 +86,6 @@ def mfi( # Fill if "fillna" in kwargs: mfi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - mfi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category mfi.name = f"MFI_{length}" diff --git a/pandas_ta/volume/nvi.py b/pandas_ta/volume/nvi.py index c682f1e5..e15026cc 100644 --- a/pandas_ta/volume/nvi.py +++ b/pandas_ta/volume/nvi.py @@ -5,6 +5,7 @@ from pandas_ta.utils import signed_series, v_offset, v_pos_default, v_series + def nvi( close: Series, volume: Series, length: Int = None, initial: Int = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def nvi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -59,8 +59,6 @@ def nvi( # Fill if "fillna" in kwargs: nvi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - nvi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category nvi.name = f"NVI_{length}" diff --git a/pandas_ta/volume/obv.py b/pandas_ta/volume/obv.py index b4660e4f..a841ee3f 100644 --- a/pandas_ta/volume/obv.py +++ b/pandas_ta/volume/obv.py @@ -5,6 +5,7 @@ from pandas_ta.utils import signed_series, v_offset, v_series, v_talib + def obv( close: Series, volume: Series, talib: bool = None, offset: Int = None, **kwargs: DictLike @@ -28,7 +29,6 @@ def obv( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -59,8 +59,6 @@ def obv( # Fill if "fillna" in kwargs: obv.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - obv.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category obv.name = f"OBV" diff --git a/pandas_ta/volume/pvi.py b/pandas_ta/volume/pvi.py index bf0ec3b2..38999422 100644 --- a/pandas_ta/volume/pvi.py +++ b/pandas_ta/volume/pvi.py @@ -5,6 +5,7 @@ from pandas_ta.utils import signed_series, v_offset, v_pos_default, v_series + def pvi( close: Series, volume: Series, length: Int = None, initial: Int = None, offset: Int = None, **kwargs: DictLike @@ -27,7 +28,6 @@ def pvi( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -58,8 +58,6 @@ def pvi( # Fill if "fillna" in kwargs: pvi.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pvi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pvi.name = f"PVI_{length}" diff --git a/pandas_ta/volume/pvo.py b/pandas_ta/volume/pvo.py index f9390f52..8c676d88 100644 --- a/pandas_ta/volume/pvo.py +++ b/pandas_ta/volume/pvo.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_scalar, v_series + def pvo( volume: Series, fast: Int = None, slow: Int = None, signal: Int = None, scalar: IntFloat = None, @@ -27,7 +28,6 @@ def pvo( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: pvo, histogram, signal columns. @@ -65,10 +65,6 @@ def pvo( pvo.fillna(kwargs["fillna"], inplace=True) histogram.fillna(kwargs["fillna"], inplace=True) signalma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pvo.fillna(method=kwargs["fill_method"], inplace=True) - histogram.fillna(method=kwargs["fill_method"], inplace=True) - signalma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{fast}_{slow}_{signal}" diff --git a/pandas_ta/volume/pvol.py b/pandas_ta/volume/pvol.py index 3c8e4e7b..eb21f476 100644 --- a/pandas_ta/volume/pvol.py +++ b/pandas_ta/volume/pvol.py @@ -4,6 +4,7 @@ from pandas_ta.utils import signed_series, v_bool, v_offset, v_series + def pvol( close: Series, volume: Series, signed: bool = None, offset: Int = None, **kwargs: DictLike @@ -21,7 +22,6 @@ def pvol( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -44,8 +44,6 @@ def pvol( # Fill if "fillna" in kwargs: pvol.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pvol.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pvol.name = f"PVOL" diff --git a/pandas_ta/volume/pvr.py b/pandas_ta/volume/pvr.py index 7ce8b0bb..94481fcc 100644 --- a/pandas_ta/volume/pvr.py +++ b/pandas_ta/volume/pvr.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_drift, v_series + def pvr( close: Series, volume: Series, drift: Int = None, ) -> Series: diff --git a/pandas_ta/volume/pvt.py b/pandas_ta/volume/pvt.py index 9021b246..2b23cd82 100644 --- a/pandas_ta/volume/pvt.py +++ b/pandas_ta/volume/pvt.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_drift, v_offset, v_series + def pvt( close: Series, volume: Series, drift: Int = None, offset: Int = None, **kwargs: DictLike @@ -25,7 +26,6 @@ def pvt( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -52,8 +52,6 @@ def pvt( # Fill if "fillna" in kwargs: pvt.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - pvt.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category pvt.name = f"PVT" diff --git a/pandas_ta/volume/vhm.py b/pandas_ta/volume/vhm.py index 158142ee..51356c2c 100644 --- a/pandas_ta/volume/vhm.py +++ b/pandas_ta/volume/vhm.py @@ -11,6 +11,7 @@ ) + def vhm( volume: Series, length: Int = None, slength = None, mamode: str = None, offset: Int = None, **kwargs: DictLike @@ -41,7 +42,6 @@ def vhm( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -70,9 +70,6 @@ def vhm( if "fillna" in kwargs: vhm.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - vhm.fillna(method=kwargs["fill_method"], inplace=True) - # Name and Category _props = f"VHM_{length}" vhm.name = _props if length == slength else f"{_props}_{slength}" diff --git a/pandas_ta/volume/vp.py b/pandas_ta/volume/vp.py index 1ca3d157..11f26b81 100644 --- a/pandas_ta/volume/vp.py +++ b/pandas_ta/volume/vp.py @@ -7,6 +7,7 @@ from pandas_ta.utils import signed_series, v_bool, v_pos_default, v_series + def vp( close: Series, volume: Series, width: Int = None, sort: bool = None, @@ -32,7 +33,6 @@ def vp( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: New feature generated. @@ -111,8 +111,6 @@ def vp( # Fill if "fillna" in kwargs: vpdf.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - vpdf.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category vpdf.name = f"VP_{width}" diff --git a/pandas_ta/volume/vwap.py b/pandas_ta/volume/vwap.py index f9ccaaf5..ef7b5e03 100644 --- a/pandas_ta/volume/vwap.py +++ b/pandas_ta/volume/vwap.py @@ -6,6 +6,7 @@ from pandas_ta.utils import v_datetime_ordered, v_list, v_offset, v_series + def vwap( high: Series, low: Series, close: Series, volume: Series, anchor: str = None, bands: List = None, @@ -40,7 +41,6 @@ def vwap( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -114,11 +114,6 @@ def vwap( df.fillna(kwargs["fillna"], inplace=True) else: vwap.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - if bands and not df.empty: - df.fillna(method=kwargs["fill_method"], inplace=True) - else: - vwap.fillna(method=kwargs["fill_method"], inplace=True) if bands and not df.empty: return df diff --git a/pandas_ta/volume/vwma.py b/pandas_ta/volume/vwma.py index fc3574e7..78740b61 100644 --- a/pandas_ta/volume/vwma.py +++ b/pandas_ta/volume/vwma.py @@ -5,6 +5,7 @@ from pandas_ta.utils import v_offset, v_pos_default, v_series + def vwma( close: Series, volume: Series, length: Int = None, offset: Int = None, **kwargs: DictLike @@ -24,7 +25,6 @@ def vwma( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.Series: New feature generated. @@ -50,8 +50,6 @@ def vwma( # Fill if "fillna" in kwargs: vwma.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - vwma.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category vwma.name = f"VWMA_{length}" diff --git a/pandas_ta/volume/wb_tsv.py b/pandas_ta/volume/wb_tsv.py index 25044535..4e1d0881 100644 --- a/pandas_ta/volume/wb_tsv.py +++ b/pandas_ta/volume/wb_tsv.py @@ -14,6 +14,7 @@ ) + def wb_tsv( close: Series, volume: Series, length: Int = None, signal: Int = None, @@ -45,7 +46,6 @@ def wb_tsv( Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) - fill_method (value, optional): Type of fill method Returns: pd.DataFrame: tsv, signal, ratio @@ -86,10 +86,6 @@ def wb_tsv( tsv.fillna(kwargs["fillna"], inplace=True) signal_.fillna(kwargs["fillna"], inplace=True) ratio.fillna(kwargs["fillna"], inplace=True) - if "fill_method" in kwargs: - tsv.fillna(method=kwargs["fill_method"], inplace=True) - signal_.fillna(method=kwargs["fill_method"], inplace=True) - ratio.fillna(method=kwargs["fill_method"], inplace=True) # Name and Category _props = f"_{length}_{signal}" diff --git a/setup.py b/setup.py index 70770438..008deb1a 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ "pandas_ta.volatility", "pandas_ta.volume" ], - version=".".join(("0", "4", "11b")), + version=".".join(("0", "4", "12b")), description=long_description, long_description=long_description, author="Kevin Johnson", @@ -53,22 +53,29 @@ "pandas_ta": ["py.typed"], "data": ["data/*.csv"], }, - install_requires=["pandas", "numba"], + install_requires=[ + "numba>=0.59.0", + "numpy>=1.26.4", + "pandas>=2.2.0", + "pandas-datareader", + "scipy>=1.12" + ], # List additional groups of dependencies here (e.g. development dependencies). # You can install these using the following syntax, for example: # $ pip install -e .[full,test] # locally # $ pip install -U pandas_ta[full] # pip extras_require={ "full": [ - "alphaVantage-api", "matplotlib", "mplfinance", "numba", "polygon", - "python-dotenv", "scipy", "sklearn", "statsmodels", "stochastic", - "ta-lib", "tqdm", "vectorbt", "yfinance", + "alphaVantage-api", "matplotlib", "mplfinance", + "python-dotenv", "sklearn", "statsmodels", "stochastic", + "TA-Lib>=0.4.28", "tqdm", "vectorbt", "yfinance>=0.2.36" ], "test": [ + "numba>=0.59.0", + "numpy>=1.26.4", + "pandas_datareader>=0.10.0", "pytest==7.1.2", - "pandas_datareader==0.10.0", - "ta-lib", - "numba" + "TA-Lib>=0.4.28" ], }, ) diff --git a/tests/config.py b/tests/config.py index e3de5ba5..fc9ca3d8 100644 --- a/tests/config.py +++ b/tests/config.py @@ -88,9 +88,9 @@ def load(**kwargs: DictLike): fpath="data/SPY_D.csv", n = [ -2 * _tdpy, -_tdpy, - -89, 0, 89, + -200, -89, 0, 89, 200, _tdpy, 2 * _tdpy - ][0], + ][2], verbose=VERBOSE ) diff --git a/tests/test_indicator_momentum.py b/tests/test_indicator_momentum.py index 709456bc..7d6a5a56 100644 --- a/tests/test_indicator_momentum.py +++ b/tests/test_indicator_momentum.py @@ -3,7 +3,7 @@ import talib as tal import pandas_ta as ta -from pandas import DataFrame, Series +from pandas import DataFrame, Series, concat from pytest import mark from .config import CORRELATION, CORRELATION_THRESHOLD, error_analysis @@ -184,6 +184,16 @@ def test_eri(df): assert result.name == "ERI_13" +def test_exhc(df): + result = ta.exhc(df.close) + assert isinstance(result, DataFrame) + assert result.name == "EXHCa" + + result = ta.exhc(df.close, show_all=False) + assert isinstance(result, DataFrame) + assert result.name == "EXHC" + + def test_fisher(df): result = ta.fisher(df.high, df.low) assert isinstance(result, DataFrame) @@ -537,12 +547,6 @@ def test_trix(df): assert result.name == "TRIX_30_9" -def test_td_seq(df): - result = ta.td_seq(df.close) - assert isinstance(result, DataFrame) - assert result.name == "TD_SEQ" - - def test_tsi(df): result = ta.tsi(df.close) assert isinstance(result, DataFrame) @@ -667,6 +671,11 @@ def test_ext_eri(df): assert list(df.columns[-2:]) == ["BULLP_13", "BEARP_13"] +def test_ext_exhc(df): + df.ta.exhc(append=True) + assert list(df.columns[-2:]) == ["EXHC_DNa", "EXHC_UPa"] + + def test_ext_fisher(df): df.ta.fisher(append=True) assert list(df.columns[-2:]) == ["FISHERT_9_1", "FISHERTs_9_1"] @@ -792,11 +801,6 @@ def test_ext_stochrsi(df): assert list(df.columns[-2:]) == ["STOCHRSIk_14_14_3_3", "STOCHRSId_14_14_3_3"] -def test_ext_td_seq(df): - df.ta.td_seq(append=True) - assert list(df.columns[-2:]) == ["TD_SEQ_UPa", "TD_SEQ_DNa"] - - def test_ext_tmo(df): df.ta.tmo(append=True) columns = ["TMO_14_5_3", "TMOs_14_5_3", "TMOM_14_5_3", "TMOMs_14_5_3"] diff --git a/tests/test_indicator_statistics.py b/tests/test_indicator_statistics.py index 5bf75bb7..dc2d02ca 100644 --- a/tests/test_indicator_statistics.py +++ b/tests/test_indicator_statistics.py @@ -47,7 +47,7 @@ def test_skew(df): def test_stdev(df): - result = ta.stdev(df.close, talib=False) + result = ta.stdev(df.close, talib=False, ddof=0) assert isinstance(result, Series) assert result.name == "STDEV_30" @@ -76,7 +76,7 @@ def test_tos_stdevall(df, length, stds, name, columns): def test_variance(df): - result = ta.variance(df.close, talib=False) + result = ta.variance(df.close, talib=False, ddof=0) assert isinstance(result, Series) assert result.name == "VAR_30" diff --git a/tests/test_indicator_trend.py b/tests/test_indicator_trend.py index a9f528ea..30da9f8e 100644 --- a/tests/test_indicator_trend.py +++ b/tests/test_indicator_trend.py @@ -187,6 +187,7 @@ def test_ht_trendline(df): try: expected = tal.HT_TRENDLINE(df.close) + corr = ta.utils.df_error_analysis(result, expected) pdt.assert_series_equal(result, expected, check_names=False) except AssertionError: try: @@ -340,6 +341,11 @@ def test_ext_dpo(df): assert df.columns[-1] == "DPO_20" +def test_ext_ht_trendline(df): + df.ta.ht_trendline(append=True) + assert df.columns[-1] == "HT_TL" + + def test_ext_increasing(df): df.ta.increasing(append=True) assert df.columns[-1] == "INC_1" diff --git a/tests/test_indicator_volatility.py b/tests/test_indicator_volatility.py index 6c2a7a75..f1b9b558 100644 --- a/tests/test_indicator_volatility.py +++ b/tests/test_indicator_volatility.py @@ -22,7 +22,7 @@ def test_accbands(df): def test_atr(df): - result = ta.atr(df.high, df.low, df.close, talib=False) + result = ta.atr(df.high, df.low, df.close, talib=False, prenan=True) assert isinstance(result, Series) assert result.name == "ATRr_14" @@ -135,12 +135,12 @@ def test_massi(df): def test_natr(df): - result = ta.natr(df.high, df.low, df.close, talib=False) + result = ta.natr(df.high, df.low, df.close, talib=False, prenan=True) assert isinstance(result, Series) assert result.name == "NATR_14" try: - expected = tal.ATR(df.high, df.low, df.close) + expected = tal.NATR(df.high, df.low, df.close) pdt.assert_series_equal(result, expected, check_names=False) except AssertionError: try: diff --git a/tests/test_numba.py b/tests/test_numba.py index 63513237..d051ac45 100644 --- a/tests/test_numba.py +++ b/tests/test_numba.py @@ -9,26 +9,26 @@ (np.ones(5), 2, np.array([np.nan, 1.0, 1.0, 1.0, 1.0])), (np.ones(5), -2, np.ones(5)) ]) -def test_np_prenan(array, n, result): - np.testing.assert_array_equal(ta.np_prenan(array, n), result) +def test_nb_prenan(array, n, result): + np.testing.assert_array_equal(ta.nb_prenan(array, n), result) @mark.parametrize("array,n,result", [ (np.ones(5), 2, np.array([np.nan, np.nan, 1.0, 1.0, 1.0, 1.0, 1.0])), (np.ones(5), -2, np.ones(5)) ]) -def test_np_prepend(array, n, result): - np.testing.assert_array_equal(ta.np_prepend(array, n), result) +def test_nb_prepend(array, n, result): + np.testing.assert_array_equal(ta.nb_prepend(array, n), result) @mark.parametrize("array,n,fn,result", [(np.ones(5), 2, None, np.ones(5))]) -def test_np_rolling(array, n, fn, result): - np.testing.assert_array_equal(ta.np_rolling(array, n, fn), result) +def test_nb_rolling(array, n, fn, result): + np.testing.assert_array_equal(ta.nb_rolling(array, n, fn), result) @mark.parametrize("array,n,result", [ (np.ones(5), 2, np.array([np.nan, np.nan, 1.0, 1.0, 1.0])), (np.ones(5), -2, np.array([1.0, 1.0, 1.0, np.nan, np.nan])) ]) -def test_np_shift(array, n, result): - np.testing.assert_array_equal(ta.np_shift(array, n), result) +def test_nb_shift(array, n, result): + np.testing.assert_array_equal(ta.nb_shift(array, n), result)