From 3388ca8d5e81c917d70848b71cb22a032b605597 Mon Sep 17 00:00:00 2001 From: Kevin Johnson Date: Thu, 10 Sep 2020 10:26:22 -0700 Subject: [PATCH] MAINT slope refactoring --- pandas_ta/core.py | 2 +- pandas_ta/momentum/slope.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas_ta/core.py b/pandas_ta/core.py index f952250..4559635 100644 --- a/pandas_ta/core.py +++ b/pandas_ta/core.py @@ -23,7 +23,7 @@ from pandas_ta.volatility import * from pandas_ta.volume import * from pandas_ta.utils import * -version = ".".join(("0", "2", "04b")) +version = ".".join(("0", "2", "05b")) # Strategy (Data)Class diff --git a/pandas_ta/momentum/slope.py b/pandas_ta/momentum/slope.py index c6e2ef5..0206378 100644 --- a/pandas_ta/momentum/slope.py +++ b/pandas_ta/momentum/slope.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- from math import atan, pi -from ..utils import get_offset, verify_series +from pandas_ta.utils import get_offset, verify_series -def slope(close, length=None, as_angle=None, to_degrees=None, offset=None, **kwargs): +def slope(close, length=None, as_angle=None, to_degrees=None, vertical=None, offset=None, **kwargs): """Indicator: Slope""" # Validate arguments close = verify_series(close) length = int(length) if length and length > 0 else 1 - as_angle = True if as_angle and isinstance(as_angle, bool) else False - to_degrees = True if to_degrees and isinstance(to_degrees, bool) else False + as_angle = True if isinstance(as_angle, bool) else False + to_degrees = True if isinstance(to_degrees, bool) else False offset = get_offset(offset) # Calculate Result @@ -23,14 +23,14 @@ def slope(close, length=None, as_angle=None, to_degrees=None, offset=None, **kwa slope = slope.shift(offset) # Handle fills - if 'fillna' in kwargs: - slope.fillna(kwargs['fillna'], inplace=True) - if 'fill_method' in kwargs: - slope.fillna(method=kwargs['fill_method'], inplace=True) + if "fillna" in kwargs: + slope.fillna(kwargs["fillna"], inplace=True) + if "fill_method" in kwargs: + slope.fillna(method=kwargs["fill_method"], inplace=True) # Name and Categorize it slope.name = f"SLOPE_{length}" if not as_angle else f"ANGLE{'d' if to_degrees else 'r'}_{length}" - slope.category = 'momentum' + slope.category = "momentum" return slope