From 05349f82af4a0ef9b4dd800fb5c945dfd6843e89 Mon Sep 17 00:00:00 2001 From: Kevin Johnson Date: Sun, 20 Mar 2022 13:07:09 -0700 Subject: [PATCH] MAINT swap strategy with study --- README.md | 2 +- pandas_ta/core.py | 50 ++++++++++++++++++++++----------------------- setup.py | 2 +- tests/test_study.py | 3 ++- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9997c90..44c18d8 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ $ pip install pandas_ta[full] Latest Version -------------- -Best choice! Version: *0.3.57b* +Best choice! Version: *0.3.58b* * Includes all fixes and updates between **pypi** and what is covered in this README. ```sh $ pip install -U git+https://github.com/twopirllc/pandas-ta diff --git a/pandas_ta/core.py b/pandas_ta/core.py index 8ea77f7..bc49111 100644 --- a/pandas_ta/core.py +++ b/pandas_ta/core.py @@ -558,7 +558,31 @@ class AnalysisIndicators(object): disabled when using it's replacement method: df.ta.study(). Default: True """ - _dep_warning = kwargs.pop("warning", True) + kwargs.update({"warning": True}) + return self.study(*args, **kwargs) + + def study(self, *args: Args, **kwargs: DictLike) -> dataclass: + """Study Method + + An experimental method that by default runs all applicable indicators. + + Kwargs: + chunksize (bool): Adjust the chunksize for the Multiprocessing Pool. + Default: Number of cores of the OS + exclude (list): List of indicator names to exclude. Some are + excluded by default for various reasons; they require additional + sources, performance (td_seq), not a time series chart (vp) etc. + name (str): Select all indicators or indicators by + Category such as: "candles", "cycles", "momentum", "overlap", + "performance", "statistics", "trend", "volatility", "volume", or + "all". Default: "all" + ordered (bool): Whether to run "all" in order. Default: True + timed (bool): Show the process time of the study(). + Default: False + verbose (bool): Provide some additional insight on the progress of + the study() execution. Default: False + """ + _dep_warning = kwargs.pop("warning", False) all_ordered = kwargs.pop("ordered", True) # Append indicators to the DataFrame by default kwargs.setdefault("append", True) @@ -734,30 +758,6 @@ class AnalysisIndicators(object): if returns: return self._df - def study(self, *args: Args, **kwargs: DictLike) -> dataclass: - """Study Method - - An experimental method that by default runs all applicable indicators. - - Kwargs: - chunksize (bool): Adjust the chunksize for the Multiprocessing Pool. - Default: Number of cores of the OS - exclude (list): List of indicator names to exclude. Some are - excluded by default for various reasons; they require additional - sources, performance (td_seq), not a time series chart (vp) etc. - name (str): Select all indicators or indicators by - Category such as: "candles", "cycles", "momentum", "overlap", - "performance", "statistics", "trend", "volatility", "volume", or - "all". Default: "all" - ordered (bool): Whether to run "all" in order. Default: True - timed (bool): Show the process time of the study(). - Default: False - verbose (bool): Provide some additional insight on the progress of - the study() execution. Default: False - """ - kwargs.update({"warning": False}) - return self.strategy(*args, **kwargs) - def ticker(self, ticker: str, ds: str = None, **kwargs: DictLike): """ticker diff --git a/setup.py b/setup.py index 25001e4..17ceaff 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup( "pandas_ta.volatility", "pandas_ta.volume" ], - version=".".join(("0", "3", "57b")), + version=".".join(("0", "3", "58b")), description=long_description, long_description=long_description, author="Kevin Johnson", diff --git a/tests/test_study.py b/tests/test_study.py index 336f5a7..1248bbd 100644 --- a/tests/test_study.py +++ b/tests/test_study.py @@ -18,8 +18,8 @@ timed_test = False timed = True verbose = VERBOSE -class TestStudyMethods(TestCase): +class TestStudyMethods(TestCase): @classmethod def setUpClass(cls): cls.data = sample_data @@ -112,6 +112,7 @@ class TestStudyMethods(TestCase): self.category = "Candles" self.data.ta.study(pandas_ta.AllStudy, verbose=verbose, timed=timed_test) + @skipUnless(verbose, "verbose mode only") def test_all_without_append(self): """Study: All sans append""" self.category = "All: Sans append"