all trend indicators fully typed

This commit is contained in:
P S Solanki
2021-12-20 19:53:12 +05:30
parent 6a3557199a
commit 0e4db9a275
19 changed files with 50 additions and 28 deletions
+3 -2
View File
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta.overlap import ma
from pandas_ta.volatility import atr
from pandas_ta.utils import get_drift, get_offset, verify_series, zero
def adx(high, low, close, length=None, lensig=None, scalar=None, mamode=None, drift=None, offset=None, **kwargs):
def adx(high: Series, low: Series, close: Series, length: int = None, lensig: int = None, scalar: float = None,
mamode: str = None, drift: int = None, offset: int = None, **kwargs) -> DataFrame:
"""Average Directional Movement (ADX)
Average Directional Movement is meant to quantify trend strength by measuring
+3 -2
View File
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from .long_run import long_run
from .short_run import short_run
from pandas_ta.overlap import ma
from pandas_ta.utils import get_offset, verify_series
def amat(close=None, fast=None, slow=None, lookback=None, mamode=None, offset=None, **kwargs):
def amat(close: Series, fast: int = None, slow: int = None, lookback: int = None, mamode: str = None,
offset: int = None, **kwargs) -> DataFrame:
"""Archer Moving Averages Trends (AMAT)
Archer Moving Averages Trends (AMAT) developed by Kevin Johnson provides
+3 -2
View File
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta import Imports
from pandas_ta.utils import get_offset, verify_series
from pandas_ta.utils import recent_maximum_index, recent_minimum_index
def aroon(high, low, length=None, scalar=None, talib=None, offset=None, **kwargs):
def aroon(high: Series, low: Series, length: int = None, scalar: float = None, talib: bool = None, offset: int = None,
**kwargs) -> DataFrame:
"""Aroon & Aroon Oscillator (AROON)
Aroon attempts to identify if a security is trending and how strong.
+3 -1
View File
@@ -3,9 +3,11 @@ from numpy import log10 as npLog10
from numpy import log as npLn
from pandas_ta.volatility import atr
from pandas_ta.utils import get_drift, get_offset, verify_series
from pandas import Series
def chop(high, low, close, length=None, atr_length=None, ln=None, scalar=None, drift=None, offset=None, **kwargs):
def chop(high: Series, low: Series, close: Series, length: int = None, atr_length: int = None, ln: bool = None,
scalar: float = None, drift: int = None, offset: int = None, **kwargs) -> Series:
"""Choppiness Index (CHOP)
The Choppiness Index was created by Australian commodity trader
+3 -2
View File
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta.volatility import atr
from pandas_ta.utils import get_offset, verify_series
def cksp(high, low, close, p=None, x=None, q=None, tvmode=None, offset=None, **kwargs):
def cksp(high: Series, low: Series, close: Series, p: int = None, x: float = None, q: int = None, tvmode: bool = None,
offset: int = None, **kwargs) -> DataFrame:
"""Chande Kroll Stop (CKSP)
The Tushar Chande and Stanley Kroll in their book
+2 -2
View File
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from numpy import exp as npExp
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta.utils import get_offset, verify_series
def decay(close, kind=None, length=None, mode=None, offset=None, **kwargs):
def decay(close: Series, kind=None, length: int = None, mode: str = None, offset: int = None, **kwargs) -> Series:
"""Decay
Creates a decay moving forward from prior signals like crosses. The default is
+4 -1
View File
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
from pandas_ta.utils import get_drift, get_offset, is_percent, verify_series
from pandas import Series
def decreasing(close, length=None, strict=None, asint=None, percent=None, drift=None, offset=None, **kwargs):
def decreasing(close: Series, length: int = None, strict: bool = None, asint: bool = None, percent: float = None,
drift: int = None, offset: int = None, **kwargs) -> Series:
"""Decreasing
Returns True if the series is decreasing over a period, False otherwise.
+2 -1
View File
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from pandas_ta.overlap import sma
from pandas_ta.utils import get_offset, verify_series
from pandas import Series
def dpo(close, length=None, centered=True, offset=None, **kwargs):
def dpo(close: Series, length: int = None, centered: bool = True, offset: int = None, **kwargs) -> Series:
"""Detrend Price Oscillator (DPO)
Is an indicator designed to remove trend from price and make it easier to
+4 -1
View File
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
from pandas_ta.utils import get_drift, get_offset, is_percent, verify_series
from pandas import Series
def increasing(close, length=None, strict=None, asint=None, percent=None, drift=None, offset=None, **kwargs):
def increasing(close: Series, length: int = None, strict: bool = None, asint: bool = None, percent: float = None,
drift: int = None, offset: int = None, **kwargs) -> Series:
"""Increasing
Returns True if the series is increasing over a period, False otherwise.
+2 -1
View File
@@ -2,9 +2,10 @@
from .decreasing import decreasing
from .increasing import increasing
from pandas_ta.utils import get_offset, verify_series
from pandas import Series
def long_run(fast, slow, length=None, offset=None, **kwargs):
def long_run(fast: Series, slow: Series, length: int = None, offset: int = None, **kwargs) -> Series:
"""Long Run
Long Run was developed by Kevin Johnson that returns a binary Series
+2 -1
View File
@@ -4,7 +4,8 @@ from pandas import DataFrame, Series
from pandas_ta.utils import get_offset, verify_series, zero
def psar(high, low, close=None, af0=None, af=None, max_af=None, offset=None, **kwargs):
def psar(high: Series, low: Series, close: Series = None, af0: float = None, af: float = None, max_af: float = None,
offset: int = None, **kwargs) -> DataFrame:
"""Parabolic Stop and Reverse (psar)
Parabolic Stop and Reverse (PSAR) was developed by J. Wells Wilder, that is used
+2 -1
View File
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from pandas_ta.overlap import dema, ema, hma, rma, sma
from pandas_ta.utils import get_offset, non_zero_range, verify_series
from pandas import Series
def qstick(open_, close, length=None, offset=None, **kwargs):
def qstick(open_: Series, close: Series, length: int = None, offset: int = None, **kwargs) -> Series:
"""Q Stick
The Q Stick indicator, developed by Tushar Chande, attempts to quantify and
+2 -1
View File
@@ -2,9 +2,10 @@
from .decreasing import decreasing
from .increasing import increasing
from pandas_ta.utils import get_offset, verify_series
from pandas import Series
def short_run(fast, slow, length=None, offset=None, **kwargs):
def short_run(fast: Series, slow: Series, length: int = None, offset: int = None, **kwargs) -> Series:
"""Short Run
Short Run was developed by Kevin Johnson that returns a binary Series
+2 -1
View File
@@ -10,7 +10,8 @@ from pandas import Series
from pandas_ta.utils import get_offset, verify_series
def trendflex(close, length=None, smooth=None, alpha=None, offset=None, **kwargs):
def trendflex(close: Series, length: int = None, smooth: int = None, alpha: float = None, offset: int = None,
**kwargs) -> Series:
"""Trendflex (trendflex)
John F. Ehlers introduced two indicators within the article "Reflex: A New
+3 -2
View File
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta.utils import get_drift, get_offset, verify_series
def tsignals(trend, asbool=None, trend_reset=0, trade_offset=None, drift=None, offset=None, **kwargs):
def tsignals(trend: Series, asbool: bool = None, trend_reset=0, trade_offset=None, drift: int = None,
offset: int = None, **kwargs) -> DataFrame:
"""Trend Signals
Given a Trend, Trend Signals returns the Trend, Trades, Entries and Exits as
+2 -2
View File
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta.overlap import hl2
from pandas_ta.utils import get_offset, verify_series
def ttm_trend(high, low, close, length=None, offset=None, **kwargs):
def ttm_trend(high: Series, low: Series, close: Series, length: int = None, offset: int = None, **kwargs) -> DataFrame:
"""TTM Trend (TTM_TRND)
This indicator is from John Carters book “Mastering the Trade” and plots the
+2 -1
View File
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
from numpy import fabs as npFabs
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
from pandas import Series
def vhf(close, length=None, drift=None, offset=None, **kwargs):
def vhf(close: Series, length: int = None, drift: int = None, offset: int = None, **kwargs) -> Series:
"""Vertical Horizontal Filter (VHF)
VHF was created by Adam White to identify trending and ranging markets.
+3 -2
View File
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas import DataFrame, Series
from pandas_ta.volatility import true_range
from pandas_ta.utils import get_drift, get_offset, verify_series
def vortex(high, low, close, length=None, drift=None, offset=None, **kwargs):
def vortex(high: Series, low: Series, close: Series, length: int = None, drift: int = None, offset: int = None,
**kwargs) -> DataFrame:
"""Vortex
Two oscillators that capture positive and negative trend movement.
+3 -2
View File
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import nan as npNaN
from pandas import DataFrame
from pandas import DataFrame, Series
from .tsignals import tsignals
from pandas_ta.utils._signals import cross_value
from pandas_ta.utils import get_offset, verify_series
def xsignals(signal, xa, xb, above:bool=True, long:bool=True, asbool:bool=None, trend_reset:int=0, trade_offset:int=None, offset:int=None, **kwargs):
def xsignals(signal: Series, xa: Series, xb: Series, above: bool = True, long: bool = True, asbool: bool = None,
trend_reset: int = 0, trade_offset: int = None, offset: int = None, **kwargs) -> DataFrame:
"""Cross Signals (XSIGNALS)
Cross Signals returns Trend Signal (TSIGNALS) results for Signal Crossings. This