From 511c0e7ed63a388fa3bd8dc9f520114638cb3a9c Mon Sep 17 00:00:00 2001 From: Radek Szambelan Date: Sat, 3 Aug 2024 18:15:23 -0700 Subject: [PATCH 1/2] fix: resolving problem of outdated polars.utils. Replacing outdated polars.utils with currently supported method from 1.0 stable version - expression plugins. Ignoring IDE files. --- .gitignore | 4 +- python/polars_talib/__init__.py | 2462 +++++++++++++++---------------- 2 files changed, 1152 insertions(+), 1314 deletions(-) diff --git a/.gitignore b/.gitignore index 7e5d3ef..1672c6a 100644 --- a/.gitignore +++ b/.gitignore @@ -90,7 +90,6 @@ docs/_build/ # PyBuilder .pybuilder/ -target/ # Jupyter Notebook .ipynb_checkpoints @@ -170,4 +169,5 @@ dmypy.json cython_debug/ # pytest benchmark -.benchmarks \ No newline at end of file +.benchmarks +/.idea/ diff --git a/python/polars_talib/__init__.py b/python/polars_talib/__init__.py index ee3c812..7dfad7d 100644 --- a/python/polars_talib/__init__.py +++ b/python/polars_talib/__init__.py @@ -1,17 +1,21 @@ import atexit +from pathlib import Path import polars as pl -from polars.type_aliases import IntoExpr -from polars.utils.udfs import _get_shared_lib_location +from polars._typing import IntoExpr +from polars.plugins import register_plugin_function from ._polars_talib import initialize, shutdown, version __talib_version__ = version() -# Boilerplate needed to inform Polars of the location of binary wheel. -lib = _get_shared_lib_location(__file__) +# Initialize and register shutdown initialize() atexit.register(shutdown) +# Get the path to the plugin +plugin_path = Path(__file__).parent + + __function_groups__ = { "Cycle Indicators": ["ht_dcperiod", "ht_dcphase", "ht_phasor", "ht_sine", "ht_trendmode"], "Math Operators": [ @@ -225,9 +229,10 @@ def ht_dcperiod(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="ht_dcperiod", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ht_dcperiod", + args=self._expr, is_elementwise=False, ) @@ -240,9 +245,10 @@ def ht_dcphase(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="ht_dcphase", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ht_dcphase", + args=self._expr, is_elementwise=False, ) @@ -256,9 +262,10 @@ def ht_phasor(self) -> pl.Expr: inphase quadrature """ - return self._expr.register_plugin( - lib=lib, - symbol="ht_phasor", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ht_phasor", + args=self._expr, is_elementwise=False, ) @@ -272,9 +279,10 @@ def ht_sine(self) -> pl.Expr: sine leadsine """ - return self._expr.register_plugin( - lib=lib, - symbol="ht_sine", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ht_sine", + args=self._expr, is_elementwise=False, ) @@ -287,9 +295,10 @@ def ht_trendmode(self) -> pl.Expr: Outputs: integer """ - return self._expr.register_plugin( - lib=lib, - symbol="ht_trendmode", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ht_trendmode", + args=self._expr, is_elementwise=False, ) @@ -303,10 +312,10 @@ def add(self, b: IntoExpr) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[b], - symbol="add", + return register_plugin_function( + plugin_path=plugin_path, + function_name="add", + args=[self._expr, b], is_elementwise=False, ) @@ -320,10 +329,10 @@ def div(self, b: IntoExpr) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[b], - symbol="div", + return register_plugin_function( + plugin_path=plugin_path, + function_name="div", + args=[self._expr, b], is_elementwise=False, ) @@ -338,11 +347,11 @@ def max(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="max", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="max", is_elementwise=False, ) @@ -357,11 +366,11 @@ def maxindex(self, timeperiod: int = 30) -> pl.Expr: Outputs: integer """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="maxindex", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="maxindex", is_elementwise=False, ) @@ -376,11 +385,11 @@ def min(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="min", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="min", is_elementwise=False, ) @@ -395,11 +404,11 @@ def minindex(self, timeperiod: int = 30) -> pl.Expr: Outputs: integer """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="minindex", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="minindex", is_elementwise=False, ) @@ -415,11 +424,11 @@ def minmax(self, timeperiod: int = 30) -> pl.Expr: min max """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="minmax", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="minmax", is_elementwise=False, ) @@ -435,11 +444,11 @@ def minmaxindex(self, timeperiod: int = 30) -> pl.Expr: minidx maxidx """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="minmaxindex", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="minmaxindex", is_elementwise=False, ) @@ -453,10 +462,10 @@ def mult(self, b: IntoExpr) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[b], - symbol="mult", + return register_plugin_function( + plugin_path=plugin_path, + function_name="mult", + args=[self._expr, b], is_elementwise=False, ) @@ -470,10 +479,10 @@ def sub(self, b: IntoExpr) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[b], - symbol="sub", + return register_plugin_function( + plugin_path=plugin_path, + function_name="sub", + args=[self._expr, b], is_elementwise=False, ) @@ -488,11 +497,11 @@ def sum(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="sum", + args=self._expr, kwargs={"timeperiod": timeperiod}, - symbol="sum", is_elementwise=False, ) @@ -505,9 +514,10 @@ def acos(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="acos", + return register_plugin_function( + plugin_path=plugin_path, + function_name="acos", + args=self._expr, is_elementwise=False, ) @@ -520,9 +530,10 @@ def asin(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="asin", + return register_plugin_function( + plugin_path=plugin_path, + function_name="asin", + args=self._expr, is_elementwise=False, ) @@ -535,9 +546,10 @@ def atan(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="atan", + return register_plugin_function( + plugin_path=plugin_path, + function_name="atan", + args=self._expr, is_elementwise=False, ) @@ -550,9 +562,10 @@ def ceil(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="ceil", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ceil", + args=self._expr, is_elementwise=False, ) @@ -565,9 +578,10 @@ def cos(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="cos", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cos", + args=self._expr, is_elementwise=False, ) @@ -580,9 +594,10 @@ def cosh(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="cosh", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cosh", + args=self._expr, is_elementwise=False, ) @@ -595,9 +610,10 @@ def exp(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="exp", + return register_plugin_function( + plugin_path=plugin_path, + function_name="exp", + args=self._expr, is_elementwise=False, ) @@ -610,9 +626,10 @@ def floor(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="floor", + return register_plugin_function( + plugin_path=plugin_path, + function_name="floor", + args=self._expr, is_elementwise=False, ) @@ -625,9 +642,10 @@ def ln(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="ln", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ln", + args=self._expr, is_elementwise=False, ) @@ -640,9 +658,10 @@ def log10(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="log10", + return register_plugin_function( + plugin_path=plugin_path, + function_name="log10", + args=self._expr, is_elementwise=False, ) @@ -655,9 +674,10 @@ def sin(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="sin", + return register_plugin_function( + plugin_path=plugin_path, + function_name="sin", + args=self._expr, is_elementwise=False, ) @@ -670,9 +690,10 @@ def sinh(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="sinh", + return register_plugin_function( + plugin_path=plugin_path, + function_name="sinh", + args=self._expr, is_elementwise=False, ) @@ -685,9 +706,10 @@ def sqrt(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="sqrt", + return register_plugin_function( + plugin_path=plugin_path, + function_name="sqrt", + args=self._expr, is_elementwise=False, ) @@ -700,9 +722,10 @@ def tan(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="tan", + return register_plugin_function( + plugin_path=plugin_path, + function_name="tan", + args=self._expr, is_elementwise=False, ) @@ -715,14 +738,15 @@ def tanh(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="tanh", + return register_plugin_function( + plugin_path=plugin_path, + function_name="tanh", + args=self._expr, is_elementwise=False, ) def adx( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Average Directional Movement Index (Momentum Indicators) pl.col("close").ta.adx("high", "low", timeperiod=14) @@ -734,18 +758,16 @@ def adx( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="adx", + return register_plugin_function( + plugin_path=plugin_path, + function_name="adx", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def adxr( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Average Directional Movement Index Rating (Momentum Indicators) pl.col("close").ta.adxr("high", "low", timeperiod=14) @@ -757,13 +779,11 @@ def adxr( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="adxr", + return register_plugin_function( + plugin_path=plugin_path, + function_name="adxr", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -780,15 +800,15 @@ def apo(self, fastperiod: int = 12, slowperiod: int = 26, matype: int = 0) -> pl Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="apo", + args=self._expr, kwargs={ "fastperiod": fastperiod, "slowperiod": slowperiod, "matype": matype, }, - symbol="apo", is_elementwise=False, ) @@ -803,13 +823,11 @@ def aroon(self, low: IntoExpr = pl.col("low"), timeperiod: int = 14) -> pl.Expr: aroondown aroonup """ - return self._expr.register_plugin( - lib=lib, - args=[low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="aroon", + return register_plugin_function( + plugin_path=plugin_path, + function_name="aroon", + args=[self._expr, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -824,21 +842,19 @@ def aroonosc(self, low: IntoExpr = pl.col("low"), timeperiod: int = 14) -> pl.Ex Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="aroonosc", + return register_plugin_function( + plugin_path=plugin_path, + function_name="aroonosc", + args=[self._expr, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def bop( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), ) -> pl.Expr: """Balance Of Power (Momentum Indicators) pl.col("open").ta.bop("high", "low", "close") @@ -848,15 +864,15 @@ def bop( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="bop", + return register_plugin_function( + plugin_path=plugin_path, + function_name="bop", + args=[self._expr, high, low, close], is_elementwise=False, ) def cci( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Commodity Channel Index (Momentum Indicators) pl.col("close").ta.cci("high", "low", timeperiod=14) @@ -868,13 +884,11 @@ def cci( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="cci", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cci", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -889,18 +903,16 @@ def cmo(self, timeperiod: int = 14) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="cmo", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cmo", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def dx( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Directional Movement Index (Momentum Indicators) pl.col("close").ta.dx("high", "low", timeperiod=14) @@ -912,13 +924,11 @@ def dx( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="dx", + return register_plugin_function( + plugin_path=plugin_path, + function_name="dx", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -937,26 +947,26 @@ def macd(self, fastperiod: int = 12, slowperiod: int = 26, signalperiod: int = 9 macdsignal macdhist """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="macd", + args=self._expr, kwargs={ "fastperiod": fastperiod, "slowperiod": slowperiod, "signalperiod": signalperiod, }, - symbol="macd", is_elementwise=False, ) def macdext( - self, - fastperiod: int = 12, - slowperiod: int = 26, - signalperiod: int = 9, - fastmatype: int = 0, - slowmatype: int = 0, - signalmatype: int = 0, + self, + fastperiod: int = 12, + fastmatype: int = 0, + slowperiod: int = 26, + slowmatype: int = 0, + signalperiod: int = 9, + signalmatype: int = 0, ) -> pl.Expr: """MACD with controllable MA type (Momentum Indicators) pl.col("close").ta.macdext(fastperiod=12, slowperiod=26, signalperiod=9, fastmatype=0, slowmatype=0, signalmatype=0) @@ -965,28 +975,28 @@ def macdext( prices: ['close'] Parameters: fastperiod: 12 - slowperiod: 26 - signalperiod: 9 fastmatype: 0 + slowperiod: 26 slowmatype: 0 + signalperiod: 9 signalmatype: 0 Outputs: macd macdsignal macdhist """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="macdext", + args=self._expr, kwargs={ "fastperiod": fastperiod, - "slowperiod": slowperiod, - "signalperiod": signalperiod, "fastmatype": fastmatype, + "slowperiod": slowperiod, "slowmatype": slowmatype, + "signalperiod": signalperiod, "signalmatype": signalmatype, }, - symbol="macdext", is_elementwise=False, ) @@ -1003,22 +1013,20 @@ def macdfix(self, signalperiod: int = 9) -> pl.Expr: macdsignal macdhist """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "signalperiod": signalperiod, - }, - symbol="macdfix", + return register_plugin_function( + plugin_path=plugin_path, + function_name="macdfix", + args=self._expr, + kwargs={"signalperiod": signalperiod}, is_elementwise=False, ) def mfi( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - volume: IntoExpr = pl.col("volume"), - timeperiod: int = 14, + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + volume: IntoExpr = pl.col("volume"), + timeperiod: int = 14, ) -> pl.Expr: """Money Flow Index (Momentum Indicators) pl.col("close").ta.mfi("high", "low", "volume", timeperiod=14) @@ -1030,18 +1038,16 @@ def mfi( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, volume], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="mfi", + return register_plugin_function( + plugin_path=plugin_path, + function_name="mfi", + args=[self._expr, high, low, volume], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def minus_di( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Minus Directional Indicator (Momentum Indicators) pl.col("close").ta.minus_di("high", "low", timeperiod=14) @@ -1053,13 +1059,11 @@ def minus_di( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="minus_di", + return register_plugin_function( + plugin_path=plugin_path, + function_name="minus_di", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1074,13 +1078,11 @@ def minus_dm(self, low: IntoExpr = pl.col("low"), timeperiod: int = 14) -> pl.Ex Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="minus_dm", + return register_plugin_function( + plugin_path=plugin_path, + function_name="minus_dm", + args=[self._expr, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1095,18 +1097,16 @@ def mom(self, timeperiod: int = 10) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="mom", + return register_plugin_function( + plugin_path=plugin_path, + function_name="mom", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def plus_di( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Plus Directional Indicator (Momentum Indicators) pl.col("close").ta.plus_di("high", "low", timeperiod=14) @@ -1118,13 +1118,11 @@ def plus_di( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="plus_di", + return register_plugin_function( + plugin_path=plugin_path, + function_name="plus_di", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1139,13 +1137,11 @@ def plus_dm(self, low: IntoExpr = pl.col("low"), timeperiod: int = 14) -> pl.Exp Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="plus_dm", + return register_plugin_function( + plugin_path=plugin_path, + function_name="plus_dm", + args=[self._expr, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1162,15 +1158,11 @@ def ppo(self, fastperiod: int = 12, slowperiod: int = 26, matype: int = 0) -> pl Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "fastperiod": fastperiod, - "slowperiod": slowperiod, - "matype": matype, - }, - symbol="ppo", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ppo", + args=self._expr, + kwargs={"fastperiod": fastperiod, "slowperiod": slowperiod, "matype": matype}, is_elementwise=False, ) @@ -1185,13 +1177,11 @@ def roc(self, timeperiod: int = 10) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="roc", + return register_plugin_function( + plugin_path=plugin_path, + function_name="roc", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1206,13 +1196,11 @@ def rocp(self, timeperiod: int = 10) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="rocp", + return register_plugin_function( + plugin_path=plugin_path, + function_name="rocp", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1227,13 +1215,11 @@ def rocr(self, timeperiod: int = 10) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="rocr", + return register_plugin_function( + plugin_path=plugin_path, + function_name="rocr", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1248,13 +1234,11 @@ def rocr100(self, timeperiod: int = 10) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="rocr100", + return register_plugin_function( + plugin_path=plugin_path, + function_name="rocr100", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1269,25 +1253,23 @@ def rsi(self, timeperiod: int = 14) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="rsi", + return register_plugin_function( + plugin_path=plugin_path, + function_name="rsi", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def stoch( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - fastk_period: int = 5, - slowk_period: int = 3, - slowk_matype: int = 0, - slowd_period: int = 3, - slowd_matype: int = 0, + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + fastk_period: int = 5, + slowk_period: int = 3, + slowk_matype: int = 0, + slowd_period: int = 3, + slowd_matype: int = 0, ) -> pl.Expr: """Stochastic (Momentum Indicators) pl.col("close").ta.stoch("high", "low", fastk_period=5, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0) @@ -1304,9 +1286,10 @@ def stoch( slowk slowd """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], + return register_plugin_function( + plugin_path=plugin_path, + function_name="stoch", + args=[self._expr, high, low], kwargs={ "fastk_period": fastk_period, "slowk_period": slowk_period, @@ -1314,17 +1297,16 @@ def stoch( "slowd_period": slowd_period, "slowd_matype": slowd_matype, }, - symbol="stoch", is_elementwise=False, ) def stochf( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - fastk_period: int = 5, - fastd_period: int = 3, - fastd_matype: int = 0, + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + fastk_period: int = 5, + fastd_period: int = 3, + fastd_matype: int = 0, ) -> pl.Expr: """Stochastic Fast (Momentum Indicators) pl.col("close").ta.stochf("high", "low", fastk_period=5, fastd_period=3, fastd_matype=0) @@ -1339,24 +1321,24 @@ def stochf( fastk fastd """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], + return register_plugin_function( + plugin_path=plugin_path, + function_name="stochf", + args=[self._expr, high, low], kwargs={ "fastk_period": fastk_period, "fastd_period": fastd_period, "fastd_matype": fastd_matype, }, - symbol="stochf", is_elementwise=False, ) def stochrsi( - self, - timeperiod: int = 14, - fastk_period: int = 5, - fastd_period: int = 3, - fastd_matype: int = 0, + self, + timeperiod: int = 14, + fastk_period: int = 5, + fastd_period: int = 3, + fastd_matype: int = 0, ) -> pl.Expr: """Stochastic Relative Strength Index (Momentum Indicators) pl.col("close").ta.stochrsi(timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0) @@ -1372,16 +1354,16 @@ def stochrsi( fastk fastd """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="stochrsi", + args=self._expr, kwargs={ "timeperiod": timeperiod, "fastk_period": fastk_period, "fastd_period": fastd_period, "fastd_matype": fastd_matype, }, - symbol="stochrsi", is_elementwise=False, ) @@ -1396,29 +1378,27 @@ def trix(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="trix", + return register_plugin_function( + plugin_path=plugin_path, + function_name="trix", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def ultosc( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - timeperiod1: int = 7, - timeperiod2: int = 14, - timeperiod3: int = 28, + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + timeperiod1: int = 7, + timeperiod2: int = 14, + timeperiod3: int = 28, ) -> pl.Expr: """Ultimate Oscillator (Momentum Indicators) pl.col("close").ta.ultosc("high", "low", timeperiod1=7, timeperiod2=14, timeperiod3=28) Inputs: - prices: ['open', 'high', 'low', 'close'] + prices: ['high', 'low', 'close'] Parameters: timeperiod1: 7 timeperiod2: 14 @@ -1426,20 +1406,20 @@ def ultosc( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], + return register_plugin_function( + plugin_path=plugin_path, + function_name="ultosc", + args=[self._expr, high, low], kwargs={ "timeperiod1": timeperiod1, "timeperiod2": timeperiod2, "timeperiod3": timeperiod3, }, - symbol="ultosc", is_elementwise=False, ) def willr( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 ) -> pl.Expr: """Williams' %R (Momentum Indicators) pl.col("close").ta.willr("high", "low", timeperiod=14) @@ -1451,18 +1431,16 @@ def willr( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="willr", + return register_plugin_function( + plugin_path=plugin_path, + function_name="willr", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def bbands( - self, timeperiod: int = 5, nbdevup: float = 2.0, nbdevdn: float = 2.0, matype: int = 0 + self, timeperiod: int = 5, nbdevup: float = 2.0, nbdevdn: float = 2.0, matype: int = 0 ) -> pl.Expr: """Bollinger Bands (Overlap Studies) ta.pol("close").ta.bbands(timeperiod=5, nbdevup=2.0, nbdevdn=2.0, matype=0) @@ -1479,25 +1457,22 @@ def bbands( middleband: real lowerband: real """ - return self._expr.register_plugin( - lib=lib, - args=[], + return register_plugin_function( + plugin_path=plugin_path, + function_name="bbands", + args=self._expr, kwargs={ "timeperiod": timeperiod, "nbdevup": nbdevup, "nbdevdn": nbdevdn, "matype": matype, }, - symbol="bbands", is_elementwise=False, ) - def ema( - self, - timeperiod: int = 30, - ) -> pl.Expr: + def dema(self, timeperiod: int = 30) -> pl.Expr: """Double Exponential Moving Average (Overlap Studies) - ta.pol("close").ta.ema(timeperiod=30) + ta.pol("close").ta.dema(timeperiod=30) Inputs: real: (any ndarray) @@ -1506,19 +1481,17 @@ def ema( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="ema", + return register_plugin_function( + plugin_path=plugin_path, + function_name="dema", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def dema(self, timeperiod: int = 30) -> pl.Expr: - """Double Exponential Moving Average (Overlap Studies) - ta.pol("close").ta.dema(timeperiod=30) + def ema(self, timeperiod: int = 30) -> pl.Expr: + """Exponential Moving Average (Overlap Studies) + ta.pol("close").ta.ema(timeperiod=30) Inputs: real: (any ndarray) @@ -1527,13 +1500,11 @@ def dema(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="dema", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ema", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1546,9 +1517,10 @@ def ht_trendline(self) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - symbol="ht_trendline", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ht_trendline", + args=self._expr, is_elementwise=False, ) @@ -1563,13 +1535,11 @@ def kama(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="kama", + return register_plugin_function( + plugin_path=plugin_path, + function_name="kama", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1585,14 +1555,11 @@ def ma(self, timeperiod: int = 30, matype: int = 0) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - "matype": matype, - }, - symbol="ma", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ma", + args=self._expr, + kwargs={"timeperiod": timeperiod, "matype": matype}, is_elementwise=False, ) @@ -1609,19 +1576,16 @@ def mama(self, fastlimit: float = 0.5, slowlimit: float = 0.05) -> pl.Expr: mama: real fama: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "fastlimit": fastlimit, - "slowlimit": slowlimit, - }, - symbol="mama", + return register_plugin_function( + plugin_path=plugin_path, + function_name="mama", + args=self._expr, + kwargs={"fastlimit": fastlimit, "slowlimit": slowlimit}, is_elementwise=False, ) def mavp( - self, periods: IntoExpr, minperiod: int = 2, maxperiod: int = 30, matype: int = 0 + self, periods: IntoExpr, minperiod: int = 2, maxperiod: int = 30, matype: int = 0 ) -> pl.Expr: """Moving average with variable period (Overlap Studies) ta.pol("close").ta.mavp(periods, minperiod=2, maxperiod=30, matype=0) @@ -1636,15 +1600,11 @@ def mavp( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[periods], - kwargs={ - "minperiod": minperiod, - "maxperiod": maxperiod, - "matype": matype, - }, - symbol="mavp", + return register_plugin_function( + plugin_path=plugin_path, + function_name="mavp", + args=[self._expr, periods], + kwargs={"minperiod": minperiod, "maxperiod": maxperiod, "matype": matype}, is_elementwise=False, ) @@ -1659,13 +1619,11 @@ def midpoint(self, timeperiod: int = 14) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="midpoint", + return register_plugin_function( + plugin_path=plugin_path, + function_name="midpoint", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1681,18 +1639,16 @@ def midprice(self, low: IntoExpr = pl.col("low"), timeperiod: int = 14) -> pl.Ex Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="midprice", + return register_plugin_function( + plugin_path=plugin_path, + function_name="midprice", + args=[self._expr, low], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def sar( - self, low: IntoExpr = pl.col("low"), acceleration: float = 0.02, maximum: float = 0.2 + self, low: IntoExpr = pl.col("low"), acceleration: float = 0.02, maximum: float = 0.2 ) -> pl.Expr: """Parabolic SAR (Overlap Studies) ta.pol("high").ta.sar(pl.col("low"), acceleration=0.02, maximum=0.2) @@ -1706,28 +1662,25 @@ def sar( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], - kwargs={ - "acceleration": acceleration, - "maximum": maximum, - }, - symbol="sar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="sar", + args=[self._expr, low], + kwargs={"acceleration": acceleration, "maximum": maximum}, is_elementwise=False, ) def sarext( - self, - low: IntoExpr = pl.col("low"), - startvalue: float = 0.0, - offsetonreverse: float = 0.0, - accelerationinitlong: float = 0.02, - accelerationlong: float = 0.02, - accelerationmaxlong: float = 0.2, - accelerationinitshort: float = 0.02, - accelerationshort: float = 0.02, - accelerationmaxshort: float = 0.2, + self, + low: IntoExpr = pl.col("low"), + startvalue: float = 0.0, + offsetonreverse: float = 0.0, + accelerationinitlong: float = 0.02, + accelerationlong: float = 0.02, + accelerationmaxlong: float = 0.2, + accelerationinitshort: float = 0.02, + accelerationshort: float = 0.02, + accelerationmaxshort: float = 0.2, ) -> pl.Expr: """Parabolic SAR - Extended (Overlap Studies) ta.pol("high").ta.sarext(pl.col("low"), accelerationinitlong=0.02, accelerationlong=0.02) @@ -1747,9 +1700,10 @@ def sarext( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], + return register_plugin_function( + plugin_path=plugin_path, + function_name="sarext", + args=[self._expr, low], kwargs={ "startvalue": startvalue, "offsetonreverse": offsetonreverse, @@ -1760,7 +1714,6 @@ def sarext( "accelerationshort": accelerationshort, "accelerationmaxshort": accelerationmaxshort, }, - symbol="sarext", is_elementwise=False, ) @@ -1775,13 +1728,11 @@ def sma(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="sma", + return register_plugin_function( + plugin_path=plugin_path, + function_name="sma", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1797,14 +1748,11 @@ def t3(self, timeperiod: int = 5, vfactor: float = 0.7) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - "vfactor": vfactor, - }, - symbol="t3", + return register_plugin_function( + plugin_path=plugin_path, + function_name="t3", + args=self._expr, + kwargs={"timeperiod": timeperiod, "vfactor": vfactor}, is_elementwise=False, ) @@ -1819,13 +1767,11 @@ def tema(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="tema", + return register_plugin_function( + plugin_path=plugin_path, + function_name="tema", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1840,13 +1786,11 @@ def trima(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="trima", + return register_plugin_function( + plugin_path=plugin_path, + function_name="trima", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) @@ -1861,45 +1805,20 @@ def wma(self, timeperiod: int = 30) -> pl.Expr: Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="wma", - is_elementwise=False, - ) - - def natr( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 - ) -> pl.Expr: - """Normalized Average True Range (Volatility Indicators) - pl.col("close").ta.natr("high", "low", [, timeperiod=?]) - - Inputs: - prices: ['high', 'low', 'close'] - Parameters: - timeperiod: 14 - Outputs: - real - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="natr", + return register_plugin_function( + plugin_path=plugin_path, + function_name="wma", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) def cdl2crows( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Two Crows (Pattern Recognition) pl.col("open").ta.cdl2crows(pl.col("high"), pl.col("low"), pl.col("close")) @@ -1907,21 +1826,20 @@ def cdl2crows( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl2crows", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl2crows", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdl3blackcrows( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Three Black Crows (Pattern Recognition) pl.col("open").ta.cdl3blackcrows(pl.col("high"), pl.col("low"), pl.col("close")) @@ -1929,21 +1847,20 @@ def cdl3blackcrows( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl3blackcrows", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl3blackcrows", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdl3inside( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Three Inside Up/Down (Pattern Recognition) pl.col("open").ta.cdl3inside(pl.col("high"), pl.col("low"), pl.col("close")) @@ -1951,21 +1868,20 @@ def cdl3inside( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl3inside", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl3inside", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdl3linestrike( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Three-Line Strike (Pattern Recognition) pl.col("open").ta.cdl3linestrike(pl.col("high"), pl.col("low"), pl.col("close")) @@ -1973,21 +1889,20 @@ def cdl3linestrike( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl3linestrike", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl3linestrike", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdl3outside( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Three Outside Up/Down (Pattern Recognition) pl.col("open").ta.cdl3outside(pl.col("high"), pl.col("low"), pl.col("close")) @@ -1995,21 +1910,20 @@ def cdl3outside( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl3outside", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl3outside", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdl3starsinsouth( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Three Stars In The South (Pattern Recognition) pl.col("open").ta.cdl3starsinsouth(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2017,21 +1931,20 @@ def cdl3starsinsouth( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl3starsinsouth", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl3starsinsouth", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdl3whitesoldiers( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Three Advancing White Soldiers (Pattern Recognition) pl.col("open").ta.cdl3whitesoldiers(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2039,22 +1952,21 @@ def cdl3whitesoldiers( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdl3whitesoldiers", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdl3whitesoldiers", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlabandonedbaby( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.3, + ) -> pl.Expr: """Abandoned Baby (Pattern Recognition) pl.col("open").ta.cdlabandonedbaby(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) @@ -2064,24 +1976,21 @@ def cdlabandonedbaby( penetration: 0.3 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdlabandonedbaby", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlabandonedbaby", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdladvanceblock( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Advance Block (Pattern Recognition) pl.col("open").ta.cdladvanceblock(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2089,21 +1998,20 @@ def cdladvanceblock( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdladvanceblock", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdladvanceblock", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlbelthold( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Belt-hold (Pattern Recognition) pl.col("open").ta.cdlbelthold(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2111,21 +2019,20 @@ def cdlbelthold( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlbelthold", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlbelthold", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlbreakaway( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Breakaway (Pattern Recognition) pl.col("open").ta.cdlbreakaway(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2133,21 +2040,20 @@ def cdlbreakaway( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlbreakaway", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlbreakaway", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlclosingmarubozu( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Closing Marubozu (Pattern Recognition) pl.col("open").ta.cdlclosingmarubozu(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2155,21 +2061,20 @@ def cdlclosingmarubozu( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlclosingmarubozu", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlclosingmarubozu", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlconcealbabyswall( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Concealing Baby Swallow (Pattern Recognition) pl.col("open").ta.cdlconcealbabyswall(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2177,21 +2082,20 @@ def cdlconcealbabyswall( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlconcealbabyswall", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlconcealbabyswall", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlcounterattack( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Counterattack (Pattern Recognition) pl.col("open").ta.cdlcounterattack(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2199,24 +2103,23 @@ def cdlcounterattack( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlcounterattack", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlcounterattack", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdldarkcloudcover( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.5, + ) -> pl.Expr: """Dark Cloud Cover (Pattern Recognition) - pl.col("open").ta.cdldarkcloudcover(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) + pl.col("open").ta.cdldarkcloudcover(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.5) Inputs: prices: ['open', 'high', 'low', 'close'] @@ -2224,24 +2127,21 @@ def cdldarkcloudcover( penetration: 0.5 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdldarkcloudcover", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdldarkcloudcover", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdldoji( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Doji (Pattern Recognition) pl.col("open").ta.cdldoji(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2249,21 +2149,20 @@ def cdldoji( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdldoji", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdldoji", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdldojistar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Doji Star (Pattern Recognition) pl.col("open").ta.cdldojistar(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2271,21 +2170,20 @@ def cdldojistar( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdldojistar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdldojistar", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdldragonflydoji( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Dragonfly Doji (Pattern Recognition) pl.col("open").ta.cdldragonflydoji(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2293,21 +2191,20 @@ def cdldragonflydoji( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdldragonflydoji", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdldragonflydoji", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlengulfing( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Engulfing Pattern (Pattern Recognition) pl.col("open").ta.cdlengulfing(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2315,22 +2212,21 @@ def cdlengulfing( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlengulfing", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlengulfing", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdleveningdojistar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.3, + ) -> pl.Expr: """Evening Doji Star (Pattern Recognition) pl.col("open").ta.cdleveningdojistar(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) @@ -2340,25 +2236,22 @@ def cdleveningdojistar( penetration: 0.3 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdleveningdojistar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdleveningdojistar", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdleveningstar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.3, + ) -> pl.Expr: """Evening Star (Pattern Recognition) pl.col("open").ta.cdleveningstar(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) @@ -2368,24 +2261,21 @@ def cdleveningstar( penetration: 0.3 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdleveningstar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdleveningstar", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdlgapsidesidewhite( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Up/Down-gap side-by-side white lines (Pattern Recognition) pl.col("open").ta.cdlgapsidesidewhite(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2393,21 +2283,20 @@ def cdlgapsidesidewhite( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlgapsidesidewhite", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlgapsidesidewhite", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlgravestonedoji( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Gravestone Doji (Pattern Recognition) pl.col("open").ta.cdlgravestonedoji(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2415,21 +2304,20 @@ def cdlgravestonedoji( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlgravestonedoji", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlgravestonedoji", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlhammer( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Hammer (Pattern Recognition) pl.col("open").ta.cdlhammer(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2437,21 +2325,20 @@ def cdlhammer( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlhammer", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlhammer", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlhangingman( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Hanging Man (Pattern Recognition) pl.col("open").ta.cdlhangingman(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2459,21 +2346,20 @@ def cdlhangingman( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlhangingman", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlhangingman", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlharami( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Harami Pattern (Pattern Recognition) pl.col("open").ta.cdlharami(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2481,21 +2367,20 @@ def cdlharami( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlharami", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlharami", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlharamicross( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Harami Cross Pattern (Pattern Recognition) pl.col("open").ta.cdlharamicross(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2503,21 +2388,20 @@ def cdlharamicross( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlharamicross", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlharamicross", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlhighwave( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """High-Wave Candle (Pattern Recognition) pl.col("open").ta.cdlhighwave(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2525,21 +2409,20 @@ def cdlhighwave( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlhighwave", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlhighwave", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlhikkake( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Hikkake Pattern (Pattern Recognition) pl.col("open").ta.cdlhikkake(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2547,21 +2430,20 @@ def cdlhikkake( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlhikkake", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlhikkake", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlhikkakemod( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Modified Hikkake Pattern (Pattern Recognition) pl.col("open").ta.cdlhikkakemod(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2569,21 +2451,20 @@ def cdlhikkakemod( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlhikkakemod", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlhikkakemod", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlhomingpigeon( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Homing Pigeon (Pattern Recognition) pl.col("open").ta.cdlhomingpigeon(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2591,21 +2472,20 @@ def cdlhomingpigeon( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlhomingpigeon", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlhomingpigeon", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlidentical3crows( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Identical Three Crows (Pattern Recognition) pl.col("open").ta.cdlidentical3crows(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2613,21 +2493,20 @@ def cdlidentical3crows( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlidentical3crows", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlidentical3crows", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlinneck( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """In-Neck Pattern (Pattern Recognition) pl.col("open").ta.cdlinneck(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2635,21 +2514,20 @@ def cdlinneck( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlinneck", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlinneck", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlinvertedhammer( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Inverted Hammer (Pattern Recognition) pl.col("open").ta.cdlinvertedhammer(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2657,21 +2535,20 @@ def cdlinvertedhammer( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlinvertedhammer", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlinvertedhammer", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlkicking( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Kicking (Pattern Recognition) pl.col("open").ta.cdlkicking(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2679,21 +2556,20 @@ def cdlkicking( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlkicking", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlkicking", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlkickingbylength( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Kicking - bull/bear determined by the longer marubozu (Pattern Recognition) pl.col("open").ta.cdlkickingbylength(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2701,21 +2577,20 @@ def cdlkickingbylength( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlkickingbylength", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlkickingbylength", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlladderbottom( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Ladder Bottom (Pattern Recognition) pl.col("open").ta.cdlladderbottom(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2723,21 +2598,20 @@ def cdlladderbottom( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlladderbottom", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlladderbottom", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdllongleggeddoji( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Long Legged Doji (Pattern Recognition) pl.col("open").ta.cdllongleggeddoji(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2745,21 +2619,20 @@ def cdllongleggeddoji( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdllongleggeddoji", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdllongleggeddoji", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdllongline( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Long Line Candle (Pattern Recognition) pl.col("open").ta.cdllongline(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2767,21 +2640,20 @@ def cdllongline( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdllongline", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdllongline", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlmarubozu( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Marubozu (Pattern Recognition) pl.col("open").ta.cdlmarubozu(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2789,21 +2661,20 @@ def cdlmarubozu( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlmarubozu", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlmarubozu", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlmatchinglow( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Matching Low (Pattern Recognition) pl.col("open").ta.cdlmatchinglow(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2811,24 +2682,23 @@ def cdlmatchinglow( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlmatchinglow", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlmatchinglow", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlmathold( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.5, + ) -> pl.Expr: """Mat Hold (Pattern Recognition) - pl.col("open").ta.cdlmathold(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) + pl.col("open").ta.cdlmathold(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.5) Inputs: prices: ['open', 'high', 'low', 'close'] @@ -2836,25 +2706,22 @@ def cdlmathold( penetration: 0.5 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdlmathold", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlmathold", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdlmorningdojistar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.3, + ) -> pl.Expr: """Morning Doji Star (Pattern Recognition) pl.col("open").ta.cdlmorningdojistar(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) @@ -2864,25 +2731,22 @@ def cdlmorningdojistar( penetration: 0.3 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdlmorningdojistar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlmorningdojistar", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdlmorningstar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - penetration: float = 0.3, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + penetration: float = 0.3, + ) -> pl.Expr: """Morning Star (Pattern Recognition) pl.col("open").ta.cdlmorningstar(pl.col("high"), pl.col("low"), pl.col("close"), penetration=0.3) @@ -2892,24 +2756,21 @@ def cdlmorningstar( penetration: 0.3 Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - kwargs={ - "penetration": penetration, - }, - symbol="cdlmorningstar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlmorningstar", + args=[self._expr, high, low, close], + kwargs={"penetration": penetration}, is_elementwise=False, ) def cdlonneck( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """On-Neck Pattern (Pattern Recognition) pl.col("open").ta.cdlonneck(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2917,21 +2778,20 @@ def cdlonneck( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlonneck", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlonneck", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlpiercing( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Piercing Pattern (Pattern Recognition) pl.col("open").ta.cdlpiercing(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2939,21 +2799,20 @@ def cdlpiercing( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlpiercing", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlpiercing", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlrickshawman( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Rickshaw Man (Pattern Recognition) pl.col("open").ta.cdlrickshawman(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2961,21 +2820,20 @@ def cdlrickshawman( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlrickshawman", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlrickshawman", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlrisefall3methods( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Rising/Falling Three Methods (Pattern Recognition) pl.col("open").ta.cdlrisefall3methods(pl.col("high"), pl.col("low"), pl.col("close")) @@ -2983,21 +2841,20 @@ def cdlrisefall3methods( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlrisefall3methods", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlrisefall3methods", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlseparatinglines( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Separating Lines (Pattern Recognition) pl.col("open").ta.cdlseparatinglines(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3005,21 +2862,20 @@ def cdlseparatinglines( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlseparatinglines", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlseparatinglines", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlshootingstar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Shooting Star (Pattern Recognition) pl.col("open").ta.cdlshootingstar(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3027,21 +2883,20 @@ def cdlshootingstar( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlshootingstar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlshootingstar", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlshortline( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Short Line Candle (Pattern Recognition) pl.col("open").ta.cdlshortline(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3049,21 +2904,20 @@ def cdlshortline( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlshortline", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlshortline", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlspinningtop( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Spinning Top (Pattern Recognition) pl.col("open").ta.cdlspinningtop(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3071,21 +2925,20 @@ def cdlspinningtop( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlspinningtop", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlspinningtop", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlstalledpattern( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Stalled Pattern (Pattern Recognition) pl.col("open").ta.cdlstalledpattern(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3093,21 +2946,20 @@ def cdlstalledpattern( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlstalledpattern", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlstalledpattern", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlsticksandwich( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Stick Sandwich (Pattern Recognition) pl.col("open").ta.cdlsticksandwich(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3115,21 +2967,20 @@ def cdlsticksandwich( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlsticksandwich", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlsticksandwich", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdltakuri( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Takuri (Dragonfly Doji with very long lower shadow) (Pattern Recognition) pl.col("open").ta.cdltakuri(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3137,21 +2988,20 @@ def cdltakuri( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdltakuri", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdltakuri", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdltasukigap( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Tasuki Gap (Pattern Recognition) pl.col("open").ta.cdltasukigap(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3159,21 +3009,20 @@ def cdltasukigap( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdltasukigap", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdltasukigap", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlthrusting( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Thrusting Pattern (Pattern Recognition) pl.col("open").ta.cdlthrusting(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3181,21 +3030,20 @@ def cdlthrusting( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlthrusting", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlthrusting", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdltristar( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Tristar Pattern (Pattern Recognition) pl.col("open").ta.cdltristar(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3203,21 +3051,20 @@ def cdltristar( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdltristar", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdltristar", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlunique3river( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Unique 3 River (Pattern Recognition) pl.col("open").ta.cdlunique3river(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3225,21 +3072,20 @@ def cdlunique3river( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlunique3river", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlunique3river", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlupsidegap2crows( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Upside Gap Two Crows (Pattern Recognition) pl.col("open").ta.cdlupsidegap2crows(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3247,21 +3093,20 @@ def cdlupsidegap2crows( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlupsidegap2crows", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlupsidegap2crows", + args=[self._expr, high, low, close], is_elementwise=False, ) def cdlxsidegap3methods( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Upside/Downside Gap Three Methods (Pattern Recognition) pl.col("open").ta.cdlxsidegap3methods(pl.col("high"), pl.col("low"), pl.col("close")) @@ -3269,38 +3114,37 @@ def cdlxsidegap3methods( prices: ['open', 'high', 'low', 'close'] Outputs: integer (values are -100, 0 or 100) - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="cdlxsidegap3methods", + return register_plugin_function( + plugin_path=plugin_path, + function_name="cdlxsidegap3methods", + args=[self._expr, high, low, close], is_elementwise=False, ) def avgprice( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - close: IntoExpr = pl.col("close"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + close: IntoExpr = pl.col("close"), + ) -> pl.Expr: """Average Price (Price Transform) - pl.col("close").ta.avgprice("high", "low", "close") + pl.col("open").ta.avgprice("high", "low", "close") Inputs: prices: ['open', 'high', 'low', 'close'] Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, close], - symbol="avgprice", + return register_plugin_function( + plugin_path=plugin_path, + function_name="avgprice", + args=[self._expr, high, low, close], is_elementwise=False, ) - def medprice(self, low: IntoExpr = pl.col("low")): + def medprice(self, low: IntoExpr = pl.col("low")) -> pl.Expr: """Median Price (Price Transform) pl.col("high").ta.medprice("low") @@ -3309,14 +3153,14 @@ def medprice(self, low: IntoExpr = pl.col("low")): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[low], - symbol="medprice", + return register_plugin_function( + plugin_path=plugin_path, + function_name="medprice", + args=[self._expr, low], is_elementwise=False, ) - def typprice(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low")): + def typprice(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low")) -> pl.Expr: """Typical Price (Price Transform) pl.col("close").ta.typprice("high", "low") @@ -3325,14 +3169,14 @@ def typprice(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low" Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - symbol="typprice", + return register_plugin_function( + plugin_path=plugin_path, + function_name="typprice", + args=[self._expr, high, low], is_elementwise=False, ) - def wclprice(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low")): + def wclprice(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low")) -> pl.Expr: """Weighted Close Price (Price Transform) pl.col("close").ta.wclprice("high", "low") @@ -3341,14 +3185,14 @@ def wclprice(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low" Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - symbol="wclprice", + return register_plugin_function( + plugin_path=plugin_path, + function_name="wclprice", + args=[self._expr, high, low], is_elementwise=False, ) - def beta(self, real: IntoExpr, timeperiod: int = 5): + def beta(self, real: IntoExpr, timeperiod: int = 5) -> pl.Expr: """Beta (Statistic Functions) pl.col("close").ta.beta(pl.col("high"), timeperiod=5) Inputs: @@ -3359,17 +3203,15 @@ def beta(self, real: IntoExpr, timeperiod: int = 5): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[real], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="beta", + return register_plugin_function( + plugin_path=plugin_path, + function_name="beta", + args=[self._expr, real], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def correl(self, real: IntoExpr, timeperiod: int = 30): + def correl(self, real: IntoExpr, timeperiod: int = 30) -> pl.Expr: """Pearson's Correlation Coefficient (r) (Statistic Functions) pl.col("close").ta.correl(pl.col("high"), timeperiod=30) Inputs: @@ -3380,17 +3222,15 @@ def correl(self, real: IntoExpr, timeperiod: int = 30): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[real], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="correl", + return register_plugin_function( + plugin_path=plugin_path, + function_name="correl", + args=[self._expr, real], + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def linearreg(self, timeperiod: int = 14): + def linearreg(self, timeperiod: int = 14) -> pl.Expr: """Linear Regression (Statistic Functions) pl.col("close").ta.linearreg(timeperiod=14) Inputs: @@ -3400,17 +3240,15 @@ def linearreg(self, timeperiod: int = 14): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="linearreg", + return register_plugin_function( + plugin_path=plugin_path, + function_name="linearreg", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def linearreg_angle(self, timeperiod: int = 14): + def linearreg_angle(self, timeperiod: int = 14) -> pl.Expr: """Linear Regression Angle (Statistic Functions) pl.col("close").ta.linearreg_angle(timeperiod=14) Inputs: @@ -3420,17 +3258,15 @@ def linearreg_angle(self, timeperiod: int = 14): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="linearreg_angle", + return register_plugin_function( + plugin_path=plugin_path, + function_name="linearreg_angle", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def linearreg_intercept(self, timeperiod: int = 14): + def linearreg_intercept(self, timeperiod: int = 14) -> pl.Expr: """Linear Regression Intercept (Statistic Functions) pl.col("close").ta.linearreg_intercept(timeperiod=14) Inputs: @@ -3440,17 +3276,15 @@ def linearreg_intercept(self, timeperiod: int = 14): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="linearreg_intercept", + return register_plugin_function( + plugin_path=plugin_path, + function_name="linearreg_intercept", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def linearreg_slope(self, timeperiod: int = 14): + def linearreg_slope(self, timeperiod: int = 14) -> pl.Expr: """Linear Regression Slope (Statistic Functions) pl.col("close").ta.linearreg_slope(timeperiod=14) Inputs: @@ -3460,17 +3294,15 @@ def linearreg_slope(self, timeperiod: int = 14): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="linearreg_slope", + return register_plugin_function( + plugin_path=plugin_path, + function_name="linearreg_slope", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def stddev(self, timeperiod: int = 5, nbdev: float = 1.0): + def stddev(self, timeperiod: int = 5, nbdev: float = 1.0) -> pl.Expr: """Standard Deviation (Statistic Functions) pl.col("close").ta.stddev(timeperiod=5, nbdev=1.0) Inputs: @@ -3481,18 +3313,15 @@ def stddev(self, timeperiod: int = 5, nbdev: float = 1.0): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - "nbdev": nbdev, - }, - symbol="stddev", + return register_plugin_function( + plugin_path=plugin_path, + function_name="stddev", + args=self._expr, + kwargs={"timeperiod": timeperiod, "nbdev": nbdev}, is_elementwise=False, ) - def tsf(self, timeperiod: int = 14): + def tsf(self, timeperiod: int = 14) -> pl.Expr: """Time Series Forecast (Statistic Functions) pl.col("close").ta.tsf(timeperiod=14) Inputs: @@ -3502,17 +3331,15 @@ def tsf(self, timeperiod: int = 14): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="tsf", + return register_plugin_function( + plugin_path=plugin_path, + function_name="tsf", + args=self._expr, + kwargs={"timeperiod": timeperiod}, is_elementwise=False, ) - def var(self, timeperiod: int = 5, nbdev: float = 1.0): + def var(self, timeperiod: int = 5, nbdev: float = 1.0) -> pl.Expr: """Variance (Statistic Functions) pl.col("close").ta.var(timeperiod=5, nbdev=1.0) Inputs: @@ -3523,61 +3350,99 @@ def var(self, timeperiod: int = 5, nbdev: float = 1.0): Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[], - kwargs={ - "timeperiod": timeperiod, - "nbdev": nbdev, - }, - symbol="var", + return register_plugin_function( + plugin_path=plugin_path, + function_name="var", + args=self._expr, + kwargs={"timeperiod": timeperiod, "nbdev": nbdev}, is_elementwise=False, ) - def obv(self, volume: IntoExpr = pl.col("volume")): - """OBV(close, volume) + def atr( + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + ) -> pl.Expr: + """Average True Range (Volatility Indicators) + pl.col("close").ta.atr("high", "low", [, timeperiod=?]) - On Balance Volume (Volume Indicators) + Inputs: + prices: ['high', 'low', 'close'] + Parameters: + timeperiod: 14 + Outputs: + real + """ + return register_plugin_function( + plugin_path=plugin_path, + function_name="atr", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, + is_elementwise=False, + ) + + def natr( + self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 + ) -> pl.Expr: + """Normalized Average True Range (Volatility Indicators) + pl.col("close").ta.natr("high", "low", [, timeperiod=?]) Inputs: - prices: ['close', 'volume'] + prices: ['high', 'low', 'close'] + Parameters: + timeperiod: 14 + Outputs: + real + """ + return register_plugin_function( + plugin_path=plugin_path, + function_name="natr", + args=[self._expr, high, low], + kwargs={"timeperiod": timeperiod}, + is_elementwise=False, + ) + + def trange(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low")) -> pl.Expr: + """True Range (Volatility Indicators) + pl.col("close").ta.trange("high", "low") + + Inputs: + prices: ['high', 'low', 'close'] Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[volume], - symbol="obv", + return register_plugin_function( + plugin_path=plugin_path, + function_name="trange", + args=[self._expr, high, low], is_elementwise=False, ) def ad( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - volume: IntoExpr = pl.col("volume"), - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + volume: IntoExpr = pl.col("volume"), + ) -> pl.Expr: """Chaikin A/D Line (Volume Indicators) pl.col("close").ta.ad(pl.col("high"), pl.col("low"), pl.col("volume")) """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, volume], - symbol="ad", + return register_plugin_function( + plugin_path=plugin_path, + function_name="ad", + args=[self._expr, high, low, volume], is_elementwise=False, ) def adosc( - self, - high: IntoExpr = pl.col("high"), - low: IntoExpr = pl.col("low"), - volume: IntoExpr = pl.col("volume"), - fastperiod: int = 3, - slowperiod: int = 10, - ): + self, + high: IntoExpr = pl.col("high"), + low: IntoExpr = pl.col("low"), + volume: IntoExpr = pl.col("volume"), + fastperiod: int = 3, + slowperiod: int = 10, + ) -> pl.Expr: """Chaikin A/D Oscillator (Volume Indicators) - pl.col("close").ta.adosc(pl.col("high"), pl.col("low"), pl.col("volume"), timeperiod=3) + pl.col("close").ta.adosc(pl.col("high"), pl.col("low"), pl.col("volume"), fastperiod=3, slowperiod=10) Parameters: fastperiod: 3 @@ -3585,57 +3450,30 @@ def adosc( Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low, volume], - kwargs={ - "fastperiod": fastperiod, - "slowperiod": slowperiod, - }, - symbol="adosc", + return register_plugin_function( + plugin_path=plugin_path, + function_name="adosc", + args=[self._expr, high, low, volume], + kwargs={"fastperiod": fastperiod, "slowperiod": slowperiod}, is_elementwise=False, ) - def atr( - self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low"), timeperiod: int = 14 - ): - """Average True Range (Volatility Indicators) - pl.col("close").ta.atr("high", "low", [, timeperiod=?]) + def obv(self, volume: IntoExpr = pl.col("volume")) -> pl.Expr: + """On Balance Volume (Volume Indicators) + pl.col("close").ta.obv(pl.col("volume")) Inputs: - prices: ['high', 'low', 'close'] - Parameters: - timeperiod: 14 - Outputs: - real - """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - kwargs={ - "timeperiod": timeperiod, - }, - symbol="atr", - is_elementwise=False, - ) - - def trange(self, high: IntoExpr = pl.col("high"), low: IntoExpr = pl.col("low")) -> pl.Expr: - """True Range (Volatility Indicators) - pl.col("close").ta.trange("high", "low") - - Inputs: - prices: ['high', 'low', 'close'] + prices: ['close', 'volume'] Outputs: real """ - return self._expr.register_plugin( - lib=lib, - args=[high, low], - symbol="trange", + return register_plugin_function( + plugin_path=plugin_path, + function_name="obv", + args=[self._expr, volume], is_elementwise=False, ) - def ht_dcperiod(real: IntoExpr = pl.col("close")) -> pl.Expr: """Hilbert Transform - Dominant Cycle Period (Cycle Indicators) pl.col("close").ta.ht_dcperiod() From c8b93144305584b095c4c29144d65bc6a4bc6686 Mon Sep 17 00:00:00 2001 From: Radek Szambelan Date: Sat, 3 Aug 2024 18:34:32 -0700 Subject: [PATCH 2/2] feat: adding HMA (Hull Moving Average) --- python/polars_talib/__init__.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/python/polars_talib/__init__.py b/python/polars_talib/__init__.py index 7dfad7d..082fbea 100644 --- a/python/polars_talib/__init__.py +++ b/python/polars_talib/__init__.py @@ -4,6 +4,7 @@ from polars._typing import IntoExpr from polars.plugins import register_plugin_function from ._polars_talib import initialize, shutdown, version +import numpy as np __talib_version__ = version() @@ -98,6 +99,7 @@ "tema", "trima", "wma", + "hma" ], "Pattern Recognition": [ "cdl2crows", @@ -1813,6 +1815,21 @@ def wma(self, timeperiod: int = 30) -> pl.Expr: is_elementwise=False, ) + def hma(self, period: int = 16) -> pl.Expr: + """Hull Moving Average + ta.pol("close").ta.hma(period=16) + Inputs: + real: (any ndarray) + Parameters: + period: 10 + Outputs: + real + """ + wma_half = self.wma(timeperiod=period // 2) + wma_full = self.wma(timeperiod=period) + return (2 * wma_half - wma_full).ta.wma(timeperiod=int(np.sqrt(period))) + + def cdl2crows( self, high: IntoExpr = pl.col("high"), @@ -4857,6 +4874,20 @@ def wma( """ return real.ta.wma(timeperiod=timeperiod) +def hma( + real: IntoExpr = pl.col("close"), + period: int = 16, +) -> pl.Expr: + """Hull Moving Average + pl.col("close").ta.hma(period=16) + Inputs: + real + Parameters: + period: 16 + Outputs: + real + """ + return real.ta.hma(period=period) def cdl2crows( open: IntoExpr = pl.col("open"),