From e949e632cea2fc1f154d945088579d2aa32af932 Mon Sep 17 00:00:00 2001 From: oscarcui Date: Wed, 30 May 2018 21:13:58 +0800 Subject: [PATCH 1/4] fix bug with talib --- funcat/func.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/funcat/func.py b/funcat/func.py index aca5846..6da7981 100644 --- a/funcat/func.py +++ b/funcat/func.py @@ -28,7 +28,7 @@ def __init__(self, series, arg): try: series[series == np.inf] = np.nan - series = self.func(series, arg) + series = self.__class__.func(series, arg) except Exception as e: raise FormulaException(e) super(OneArgumentSeries, self).__init__(series) From 2780486e2d1b750cb14a1c92c8fcc11616cbcb83 Mon Sep 17 00:00:00 2001 From: oscarcui Date: Tue, 12 Jun 2018 23:30:21 +0800 Subject: [PATCH 2/4] fix with pip10 --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 10f66de..bd25841 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,10 @@ setup, ) -from pip.req import parse_requirements +try: + from pip._internal.req import parse_requirements +except ImportError: + from pip.req import parse_requirements with open(join(dirname(__file__), 'funcat/VERSION.txt'), 'rb') as f: From 433fd627dd384fddfbbb4badf2470f64fe24b8c3 Mon Sep 17 00:00:00 2001 From: oscarcui Date: Wed, 13 Jun 2018 00:24:29 +0800 Subject: [PATCH 3/4] fix bug with py2 --- funcat/func.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/funcat/func.py b/funcat/func.py index 6da7981..5bfffb9 100644 --- a/funcat/func.py +++ b/funcat/func.py @@ -20,7 +20,10 @@ class OneArgumentSeries(NumericSeries): - func = talib.MA + + @staticmethod + def func(*args, **kwargs): + return talib.MA(*args, **kwargs) def __init__(self, series, arg): if isinstance(series, NumericSeries): @@ -28,7 +31,7 @@ def __init__(self, series, arg): try: series[series == np.inf] = np.nan - series = self.__class__.func(series, arg) + series = self.func(series, arg) except Exception as e: raise FormulaException(e) super(OneArgumentSeries, self).__init__(series) @@ -37,21 +40,32 @@ def __init__(self, series, arg): class MovingAverageSeries(OneArgumentSeries): """http://www.tadoc.org/indicator/MA.htm""" - func = talib.MA + + @staticmethod + def func(*args, **kwargs): + return talib.MA(*args, **kwargs) class WeightedMovingAverageSeries(OneArgumentSeries): """http://www.tadoc.org/indicator/WMA.htm""" - func = talib.WMA + + @staticmethod + def func(*args, **kwargs): + return talib.WMA(*args, **kwargs) class ExponentialMovingAverageSeries(OneArgumentSeries): """http://www.fmlabs.com/reference/default.htm?url=ExpMA.htm""" - func = talib.EMA + + @staticmethod + def func(*args, **kwargs): + return talib.EMA(*args, **kwargs) class StdSeries(OneArgumentSeries): - func = talib.STDDEV + @staticmethod + def func(*args, **kwargs): + return talib.STDDEV(*args, **kwargs) class TwoArgumentSeries(NumericSeries): From b1b8369328fa8f3578fadb1d15b50950b66de598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=98=B1=E9=91=AB?= Date: Fri, 24 Aug 2018 10:58:39 +0800 Subject: [PATCH 4/4] be comptible with pip 10+ --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 10f66de..edc6f60 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,10 @@ setup, ) -from pip.req import parse_requirements +try: # pip >= 10 + from pip._internal.req import parse_requirements +except ImportError: + from pip.req import parse_requirements with open(join(dirname(__file__), 'funcat/VERSION.txt'), 'rb') as f: