From 0d9a397beddd90ec48516b5c468a8e239d5a034e Mon Sep 17 00:00:00 2001 From: Yvictor Date: Wed, 13 Mar 2024 22:15:59 +0800 Subject: [PATCH] feat: func output struct --- Cargo.toml | 2 +- python/polars_talib/__init__.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index cab7035..5ccccc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polars_talib" -version = "0.1.1" +version = "0.1.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/python/polars_talib/__init__.py b/python/polars_talib/__init__.py index 6c082d4..ee3c812 100644 --- a/python/polars_talib/__init__.py +++ b/python/polars_talib/__init__.py @@ -190,6 +190,27 @@ def get_function_groups(): return __function_groups__.copy() +def get_functions_output_struct(): + """ + Returns a dict with keys of function names and keys of the output struct + """ + return { + "ht_phasor": ["inphase", "quadrature"], + "ht_sine": ["sine", "leadsine"], + "minmax": ["min", "max"], + "minmaxindex": ["minidx", "maxidx"], + "aroon": ["aroondown", "aroonup"], + "macd": ["macd", "macdsignal", "macdhist"], + "macdext": ["macd", "macdsignal", "macdhist"], + "macdfix": ["macd", "macdsignal", "macdhist"], + "stoch": ["slowk", "slowd"], + "stochf": ["fastk", "fastd"], + "stochrsi": ["fastk", "fastd"], + "bbands": ["upperband", "middleband", "lowerband"], + "mama": ["mama", "fama"], + } + + @pl.api.register_expr_namespace("ta") class TAExpr: def __init__(self, expr: pl.Expr):