diff --git a/README.md b/README.md
index d8fbd72..0037002 100644
--- a/README.md
+++ b/README.md
@@ -192,7 +192,7 @@ $ pip install pandas_ta[full]
Latest Version
--------------
-Best choice! Version: *0.3.51b*
+Best choice! Version: *0.3.52b*
* 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
@@ -1229,8 +1229,12 @@ Back to [Contents](#contents)
# **Sources**
+### Technical Analysis
[Original TA-LIB](http://ta-lib.org/) | [TradingView](http://www.tradingview.com) | [Sierra Chart](https://search.sierrachart.com/?Query=indicators&submitted=true) | [MQL5](https://www.mql5.com) | [FM Labs](https://www.fmlabs.com/reference/default.htm) | [Pro Real Code](https://www.prorealcode.com/prorealtime-indicators) | [User 42](https://user42.tuxfamily.org/chart/manual/index.html) | [Technical Traders](http://technical.traders.com/tradersonline/FeedTT-2014.html)
+### Supplemental
+[What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)
+
# **Support**
diff --git a/pandas_ta/_typing.py b/pandas_ta/_typing.py
new file mode 100644
index 0000000..fff4b35
--- /dev/null
+++ b/pandas_ta/_typing.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+from decimal import Decimal
+from functools import partial
+from pathlib import Path
+from typing import *
+
+from numpy import argmax, argmin, nan, ndarray, recarray, void
+from numpy import bool_ as np_bool_
+from numpy import floating as np_floating
+from numpy import generic as np_generic
+from numpy import integer as np_integer
+from numpy import number as np_number
+from pandas import DataFrame, Series
+from sys import float_info as sflt
+
+
+# Generic types
+T = TypeVar("T")
+
+# Scalars
+Scalar = Union[str, float, int, complex, bool, object, np_generic]
+Number = Union[int, float, complex, np_number, np_bool_]
+Int = Union[int, np_integer]
+Float = Union[float, np_floating]
+IntFloat = Union[Int, Float]
+
+# Basic sequences
+MaybeTuple = Union[T, Tuple[T, ...]]
+MaybeList = Union[T, List[T]]
+TupleList = Union[List[T], Tuple[T, ...]]
+MaybeTupleList = Union[T, List[T], Tuple[T, ...]]
+MaybeIterable = Union[T, Iterable[T]]
+MaybeSequence = Union[T, Sequence[T]]
+ListStr = List[str]
+
+DictLike = Union[None, dict]
+DictLikeSequence = MaybeSequence[DictLike]
+Args = Tuple[Any, ...]
+ArgsLike = Union[None, Args]
+Kwargs = Dict[str, Any]
+KwargsLike = Union[None, Kwargs]
+KwargsLikeSequence = MaybeSequence[KwargsLike]
+FileName = Union[str, Path]
+
+DTypeLike = Any
+PandasDTypeLike = Any
+Shape = Tuple[int, ...]
+RelaxedShape = Union[int, Shape]
+Array = ndarray # ready to be used for n-dim data
+Array1d = ndarray
+Array2d = ndarray
+Array3d = ndarray
+Record = void
+RecordArray = ndarray
+RecArray = recarray
+MaybeArray = Union[T, Array]
+SeriesFrame = Union[Series, DataFrame]
+MaybeSeries = Union[T, Series]
+MaybeSeriesFrame = Union[T, Series, DataFrame]
+AnyArray = Union[Array, Series, DataFrame]
+AnyArray1d = Union[Array1d, Series]
+AnyArray2d = Union[Array2d, DataFrame]
\ No newline at end of file
diff --git a/pandas_ta/candles/cdl_doji.py b/pandas_ta/candles/cdl_doji.py
index ce6f483..cc6603e 100644
--- a/pandas_ta/candles/cdl_doji.py
+++ b/pandas_ta/candles/cdl_doji.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from pandas import Series
from pandas_ta.overlap import sma
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, high_low_range, is_percent
from pandas_ta.utils import real_body, verify_series
def cdl_doji(
open_: Series, high: Series, low: Series, close: Series,
- length: int = None, factor: float = None, scalar: float = None,
+ length: Int = None, factor: IntFloat = None, scalar: IntFloat = None,
asint: bool = True,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Candle Type: Doji
diff --git a/pandas_ta/candles/cdl_inside.py b/pandas_ta/candles/cdl_inside.py
index e06bd36..72acd1a 100644
--- a/pandas_ta/candles/cdl_inside.py
+++ b/pandas_ta/candles/cdl_inside.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import candle_color, get_offset, verify_series
def cdl_inside(
open_: Series, high: Series, low: Series, close: Series,
asbool: bool = False,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Candle Type: Inside Bar
diff --git a/pandas_ta/candles/cdl_pattern.py b/pandas_ta/candles/cdl_pattern.py
index ab394f2..9c6ebe9 100644
--- a/pandas_ta/candles/cdl_pattern.py
+++ b/pandas_ta/candles/cdl_pattern.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from typing import Sequence, Union
from pandas import Series, DataFrame
+from pandas_ta._typing import DictLike, Int, IntFloat, List, Union
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from pandas_ta.candles import cdl_doji, cdl_inside
@@ -24,8 +24,8 @@ ALL_PATTERNS = [
def cdl_pattern(
open_: Series, high: Series, low: Series, close: Series,
- name: Union[str, Sequence[str]] = "all", scalar: float = None,
- offset: int = None, **kwargs
+ name: Union[str, List[str]] = "all", scalar: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""TA Lib Candle Patterns
@@ -89,6 +89,8 @@ def cdl_pattern(
if n in pta_patterns:
pattern_result = pta_patterns[n](
open_, high, low, close, offset=offset, scalar=scalar, **kwargs)
+ if not isinstance(pattern_result,Series):
+ continue
result[pattern_result.name] = pattern_result
else:
if not Imports["talib"]:
@@ -96,16 +98,10 @@ def cdl_pattern(
f"[X] Please install TA-Lib to use {n}. (pip install TA-Lib)")
continue
- pattern_func = tala.Function(f"CDL{n.upper()}")
+ pf = tala.Function(f"CDL{n.upper()}")
pattern_result = Series(
- pattern_func(
- open_,
- high,
- low,
- close,
- **kwargs) /
- 100 *
- scalar)
+ 0.01 * scalar * pf(open_, high, low, close, **kwargs)
+ )
pattern_result.index = close.index
# Offset
@@ -130,5 +126,4 @@ def cdl_pattern(
df.category = "candles"
return df
-
cdl = cdl_pattern # Alias
diff --git a/pandas_ta/candles/cdl_z.py b/pandas_ta/candles/cdl_z.py
index f7743a3..467ffb0 100644
--- a/pandas_ta/candles/cdl_z.py
+++ b/pandas_ta/candles/cdl_z.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.statistics import zscore
from pandas_ta.utils import get_offset, verify_series
def cdl_z(
open_: Series, high: Series, low: Series, close: Series,
- length: int = None, full: bool = None, ddof=None,
- offset: int = None, **kwargs
+ length: Int = None, full: bool = None, ddof: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Candle Type: Z
@@ -21,6 +22,8 @@ def cdl_z(
low (pd.Series): Series of 'low's
close (pd.Series): Series of 'close's
length (int): The period. Default: 10
+ full (bool): Apply to whole DataFrame. Default: False
+ ddof (int): Degrees of Freedom. Default: 1
Kwargs:
naive (bool, optional): If True, prefills potential Doji less than
diff --git a/pandas_ta/candles/ha.py b/pandas_ta/candles/ha.py
index 4e730e5..3cca8e3 100644
--- a/pandas_ta/candles/ha.py
+++ b/pandas_ta/candles/ha.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def ha(
open_: Series, high: Series, low: Series, close: Series,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Heikin Ashi Candles (HA)
diff --git a/pandas_ta/core.py b/pandas_ta/core.py
index 86adc98..f43335d 100644
--- a/pandas_ta/core.py
+++ b/pandas_ta/core.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
+from dataclasses import dataclass
from multiprocessing import cpu_count, Pool
from pathlib import Path
from time import perf_counter
-from typing import Union
from warnings import simplefilter
from numpy import log10, ndarray
@@ -11,6 +11,7 @@ from pandas.core.base import PandasObject
from pandas.errors import PerformanceWarning
from pandas import DataFrame, Series
+from pandas_ta._typing import *
from pandas_ta import *
if Imports["dotenv"]:
@@ -114,20 +115,20 @@ class AnalysisIndicators(object):
_last_run = get_time(_exchange, to_string=True)
_time_range = "years"
- def __init__(self, obj: Union[DataFrame, Series]):
+ def __init__(self, obj: SeriesFrame):
self._validate(obj)
self._df = obj
self._last_run = get_time(self._exchange, to_string=True)
@staticmethod
- def _validate(obj: Union[DataFrame, Series]):
+ def _validate(obj: SeriesFrame):
if not isinstance(obj, DataFrame) and not isinstance(obj, Series):
raise AttributeError("[X] Requires a Pandas Series or DataFrame.")
# DataFrame Behavioral Methods
def __call__(
self, kind: str = None,
- timed: bool = False, version: bool = False, **kwargs
+ timed: bool = False, version: bool = False, **kwargs: DictLike
):
if version: print(f"Pandas TA - Technical Analysis Indicators - v{self.version}")
try:
@@ -168,12 +169,12 @@ class AnalysisIndicators(object):
self._adjusted = None
@property
- def cores(self) -> int:
+ def cores(self) -> Int:
"""Returns the number of CPU cores."""
return self._cores
@cores.setter
- def cores(self, value: int) -> None:
+ def cores(self, value: Int) -> None:
"""property: df.ta.cores = integer"""
cpus = cpu_count()
if value is not None and isinstance(value, int):
@@ -210,7 +211,7 @@ class AnalysisIndicators(object):
# Public Get DataFrame Properties
@property
- def categories(self) -> list:
+ def categories(self) -> List:
"""Returns the categories."""
return list(Category.keys())
@@ -242,7 +243,7 @@ class AnalysisIndicators(object):
return self._df.iloc[::-1]
@property
- def time_range(self) -> float:
+ def time_range(self) -> Float:
"""Returns the time ranges of the DataFrame as a float. Default is in "years". help(ta.toal_time)"""
return total_time(self._df, self._time_range)
@@ -265,7 +266,9 @@ class AnalysisIndicators(object):
return version
# Private DataFrame Methods
- def _add_prefix_suffix(self, result=None, **kwargs) -> None:
+ def _add_prefix_suffix(self,
+ result: MaybeSeriesFrame = None, **kwargs: DictLike
+ ) -> MaybeSeriesFrame:
"""Add prefix and/or suffix to the result columns"""
if result is None:
return
@@ -283,7 +286,9 @@ class AnalysisIndicators(object):
else:
result.columns = [prefix + column + suffix for column in result.columns]
- def _append(self, result=None, **kwargs) -> None:
+ def _append(self,
+ result: MaybeSeriesFrame = None, **kwargs: DictLike
+ ) -> MaybeSeriesFrame:
"""Appends a Pandas Series or DataFrame columns to self._df."""
if "append" in kwargs and kwargs["append"]:
df = self._df
@@ -314,7 +319,7 @@ class AnalysisIndicators(object):
)
df[ind_name] = result
- def _check_na_columns(self, stdout: bool = True):
+ def _check_na_columns(self):
"""Returns the columns in which all it's values are na."""
return [x for x in self._df.columns if all(self._df[x].isna())]
@@ -351,11 +356,11 @@ class AnalysisIndicators(object):
else:
print(NOT_FOUND)
- def _indicators_by_category(self, name: str) -> list:
+ def _indicators_by_category(self, name: str) -> List:
"""Returns indicators by Categorical name."""
return Category[name] if name in self.categories else None
- def _mp_worker(self, arguments: tuple):
+ def _mp_worker(self, arguments: Tuple):
"""Multiprocessing Worker to handle different Methods."""
method, args, kwargs = arguments
@@ -364,7 +369,9 @@ class AnalysisIndicators(object):
else:
return getattr(self, method)(*args, **kwargs)[0]
- def _post_process(self, result: Union[Series, DataFrame], **kwargs) -> Union[Series, DataFrame]:
+ def _post_process(self,
+ result: Union[Series, DataFrame], **kwargs: DictLike
+ ) -> Union[Series, DataFrame]:
"""Applies any additional modifications to the DataFrame
* Applies prefixes and/or suffixes
* Appends the result to main DataFrame
@@ -386,7 +393,7 @@ class AnalysisIndicators(object):
self._append(result=result, **kwargs)
return result
- def _study_mode(self, *args) -> tuple:
+ def _study_mode(self, *args: Args) -> Tuple:
"""Helper method to determine the mode and name of the study.
Returns tuple: (name:str, mode:dict)"""
name = "All"
@@ -413,7 +420,7 @@ class AnalysisIndicators(object):
return name, mode
# Public DataFrame Methods
- def constants(self, append: bool, values: list):
+ def constants(self, append: bool, values: List):
"""Constants
Add or remove constants to the DataFrame easily with Numpy's arrays or
@@ -451,19 +458,25 @@ class AnalysisIndicators(object):
for x in values:
del self._df[f"{x}"]
- def indicators(self, **kwargs):
+ def indicators(self,
+ as_list: bool = None, exclude: ListStr = None
+ ) -> List:
"""List of Indicators
- kwargs:
- as_list (bool, optional): When True, it returns a list of the
+ Args:
+ as_list (bool): When True, it returns a list of the
indicators. Default: False.
- exclude (list, optional): The passed in list will be excluded
+ exclude (List): The passed in list will be excluded
from the indicators list. Default: None.
Returns:
Prints the list of indicators. If as_list=True, then a list.
"""
- as_list = kwargs.setdefault("as_list", False)
+ as_list = bool(as_list) if isinstance(as_list, bool) else False
+ user_excluded = []
+ if isinstance(exclude, list) and len(exclude):
+ user_excluded = exclude
+
# Public non-indicator methods
helper_methods = ["constants", "indicators", "strategy", "study"]
# Public df.ta.properties
@@ -492,7 +505,6 @@ class AnalysisIndicators(object):
removed = helper_methods + ta_properties
# Add user excluded methods to be removed
- user_excluded = kwargs.setdefault("exclude", [])
if isinstance(user_excluded, list) and len(user_excluded) > 0:
removed += user_excluded
@@ -517,13 +529,13 @@ class AnalysisIndicators(object):
s += f"\nTotal Candles, Indicators and Utilities: {_count}"
print(s)
- def sample(self, **kwargs):
+ def sample(self, **kwargs: DictLike):
"""sample
See help(ta.sample) for parameters.
"""
return sample(**kwargs)
- def strategy(self, *args, **kwargs):
+ def strategy(self, *args: Args, **kwargs: DictLike):
"""Strategy Method
An experimental method that by default runs all applicable indicators.
@@ -713,7 +725,7 @@ class AnalysisIndicators(object):
if returns: return self._df
- def study(self, *args, **kwargs):
+ def study(self, *args: Args, **kwargs: DictLike) -> dataclass:
"""Study Method
An experimental method that by default runs all applicable indicators.
@@ -738,7 +750,7 @@ class AnalysisIndicators(object):
return self.strategy(*args, **kwargs)
- def ticker(self, ticker: str, ds: str = None, **kwargs):
+ def ticker(self, ticker: str, ds: str = None, **kwargs: DictLike):
"""ticker
This method downloads Historical Data if the package yfinance is
@@ -822,7 +834,7 @@ class AnalysisIndicators(object):
# Public DataFrame Methods: Indicators and Utilities
# Candles
- def cdl_pattern(self, name: str = "all", offset=None, **kwargs):
+ def cdl_pattern(self, name: str = "all", offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -830,7 +842,7 @@ class AnalysisIndicators(object):
result = cdl_pattern(open_=open_, high=high, low=low, close=close, name=name, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cdl_z(self, full=None, offset=None, **kwargs):
+ def cdl_z(self, full=None, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -838,7 +850,7 @@ class AnalysisIndicators(object):
result = cdl_z(open_=open_, high=high, low=low, close=close, full=full, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ha(self, offset=None, **kwargs):
+ def ha(self, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -847,34 +859,34 @@ class AnalysisIndicators(object):
return self._post_process(result, **kwargs)
# Cycles
- def ebsw(self, close=None, length=None, bars=None, offset=None, **kwargs):
+ def ebsw(self, close=None, length=None, bars=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ebsw(close=close, length=length, bars=bars, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def reflex(self, close=None, length=None, smooth=None, alpha=None, pi=None, sqrt2=None, offset=None, **kwargs):
+ def reflex(self, close=None, length=None, smooth=None, alpha=None, pi=None, sqrt2=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = reflex(close=close, length=length, smooth=smooth, alpha=alpha, pi=pi, sqrt2=sqrt2, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
# Momentum
- def ao(self, fast=None, slow=None, offset=None, **kwargs):
+ def ao(self, fast=None, slow=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = ao(high=high, low=low, fast=fast, slow=slow, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def apo(self, fast=None, slow=None, mamode=None, offset=None, **kwargs):
+ def apo(self, fast=None, slow=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = apo(close=close, fast=fast, slow=slow, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def bias(self, length=None, mamode=None, offset=None, **kwargs):
+ def bias(self, length=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = bias(close=close, length=length, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def bop(self, percentage=False, offset=None, **kwargs):
+ def bop(self, percentage=False, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -882,7 +894,7 @@ class AnalysisIndicators(object):
result = bop(open_=open_, high=high, low=low, close=close, percentage=percentage, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def brar(self, length=None, scalar=None, drift=None, offset=None, **kwargs):
+ def brar(self, length=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -890,63 +902,63 @@ class AnalysisIndicators(object):
result = brar(open_=open_, high=high, low=low, close=close, length=length, scalar=scalar, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cci(self, length=None, c=None, offset=None, **kwargs):
+ def cci(self, length=None, c=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = cci(high=high, low=low, close=close, length=length, c=c, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cfo(self, length=None, offset=None, **kwargs):
+ def cfo(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = cfo(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cg(self, length=None, offset=None, **kwargs):
+ def cg(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = cg(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cmo(self, length=None, scalar=None, drift=None, offset=None, **kwargs):
+ def cmo(self, length=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = cmo(close=close, length=length, scalar=scalar, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def coppock(self, length=None, fast=None, slow=None, offset=None, **kwargs):
+ def coppock(self, length=None, fast=None, slow=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = coppock(close=close, length=length, fast=fast, slow=slow, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cti(self, length=None, offset=None, **kwargs):
+ def cti(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = cti(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def dm(self, drift=None, offset=None, mamode=None, **kwargs):
+ def dm(self, drift=None, offset: Int = None, mamode=None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = dm(high=high, low=low, drift=drift, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def er(self, length=None, drift=None, offset=None, **kwargs):
+ def er(self, length=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = er(close=close, length=length, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def eri(self, length=None, offset=None, **kwargs):
+ def eri(self, length=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = eri(high=high, low=low, close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def fisher(self, length=None, signal=None, offset=None, **kwargs):
+ def fisher(self, length=None, signal=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = fisher(high=high, low=low, length=length, signal=signal, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def inertia(self, length=None, rvi_length=None, scalar=None, refined=None, thirds=None, mamode=None, drift=None, offset=None, **kwargs):
+ def inertia(self, length=None, rvi_length=None, scalar=None, refined=None, thirds=None, mamode=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
if refined is not None or thirds is not None:
high = self._get_column(kwargs.pop("high", "high"))
@@ -959,42 +971,42 @@ class AnalysisIndicators(object):
return self._post_process(result, **kwargs)
- def kdj(self, length=None, signal=None, offset=None, **kwargs):
+ def kdj(self, length=None, signal=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = kdj(high=high, low=low, close=close, length=length, signal=signal, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def kst(self, roc1=None, roc2=None, roc3=None, roc4=None, sma1=None, sma2=None, sma3=None, sma4=None, signal=None, offset=None, **kwargs):
+ def kst(self, roc1=None, roc2=None, roc3=None, roc4=None, sma1=None, sma2=None, sma3=None, sma4=None, signal=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = kst(close=close, roc1=roc1, roc2=roc2, roc3=roc3, roc4=roc4, sma1=sma1, sma2=sma2, sma3=sma3,
sma4=sma4, signal=signal, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def macd(self, fast=None, slow=None, signal=None, offset=None, **kwargs):
+ def macd(self, fast=None, slow=None, signal=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = macd(close=close, fast=fast, slow=slow, signal=signal, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def mom(self, length=None, offset=None, **kwargs):
+ def mom(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = mom(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def pgo(self, length=None, offset=None, **kwargs):
+ def pgo(self, length=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = pgo(high=high, low=low, close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ppo(self, fast=None, slow=None, scalar=None, mamode=None, offset=None, **kwargs):
+ def ppo(self, fast=None, slow=None, scalar=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ppo(close=close, fast=fast, slow=slow, scalar=scalar, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def psl(self, open_=None, length=None, scalar=None, drift=None, offset=None, **kwargs):
+ def psl(self, open_=None, length=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
if open_ is not None:
open_ = self._get_column(kwargs.pop("open", "open"))
@@ -1002,32 +1014,32 @@ class AnalysisIndicators(object):
result = psl(close=close, open_=open_, length=length, scalar=scalar, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def pvo(self, fast=None, slow=None, signal=None, scalar=None, offset=None, **kwargs):
+ def pvo(self, fast=None, slow=None, signal=None, scalar=None, offset: Int = None, **kwargs: DictLike):
volume = self._get_column(kwargs.pop("volume", "volume"))
result = pvo(volume=volume, fast=fast, slow=slow, signal=signal, scalar=scalar, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def qqe(self, length=None, smooth=None, factor=None, mamode=None, offset=None, **kwargs):
+ def qqe(self, length=None, smooth=None, factor=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = qqe(close=close, length=length, smooth=smooth, factor=factor, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def roc(self, length=None, offset=None, **kwargs):
+ def roc(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = roc(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def rsi(self, length=None, scalar=None, drift=None, offset=None, **kwargs):
+ def rsi(self, length=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = rsi(close=close, length=length, scalar=scalar, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def rsx(self, length=None, drift=None, offset=None, **kwargs):
+ def rsx(self, length=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = rsx(close=close, length=length, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def rvgi(self, length=None, swma_length=None, offset=None, **kwargs):
+ def rvgi(self, length=None, swma_length=None, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -1036,17 +1048,17 @@ class AnalysisIndicators(object):
offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def slope(self, length=None, offset=None, **kwargs):
+ def slope(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = slope(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def smi(self, fast=None, slow=None, signal=None, scalar=None, offset=None, **kwargs):
+ def smi(self, fast=None, slow=None, signal=None, scalar=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = smi(close=close, fast=fast, slow=slow, signal=signal, scalar=scalar, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def squeeze(self, bb_length=None, bb_std=None, kc_length=None, kc_scalar=None, mom_length=None, mom_smooth=None, use_tr=None, mamode=None, offset=None, **kwargs):
+ def squeeze(self, bb_length=None, bb_std=None, kc_length=None, kc_scalar=None, mom_length=None, mom_smooth=None, use_tr=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1055,7 +1067,7 @@ class AnalysisIndicators(object):
mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def squeeze_pro(self, bb_length=None, bb_std=None, kc_length=None, kc_scalar_wide=None, kc_scalar_normal=None, kc_scalar_narrow=None, mom_length=None, mom_smooth=None, use_tr=None, mamode=None, offset=None, **kwargs):
+ def squeeze_pro(self, bb_length=None, bb_std=None, kc_length=None, kc_scalar_wide=None, kc_scalar_normal=None, kc_scalar_narrow=None, mom_length=None, mom_smooth=None, use_tr=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1065,27 +1077,27 @@ class AnalysisIndicators(object):
use_tr=use_tr, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def stc(self, tclength=None, ma1=None, ma2=None, osc=None, fast=None, slow=None, factor=None, offset=None, **kwargs):
+ def stc(self, tclength=None, ma1=None, ma2=None, osc=None, fast=None, slow=None, factor=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = stc(close=close, tclength=tclength, ma1=ma1, ma2=ma2, osc=osc, fast=fast, slow=slow, factor=factor,
offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def stoch(self, k=None, d=None, smooth_k=None, mamode=None, talib=None, offset=None, **kwargs):
+ def stoch(self, k=None, d=None, smooth_k=None, mamode=None, talib=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = stoch(high=high, low=low, close=close, k=k, d=d, smooth_k=smooth_k, mamode=mamode, talib=talib, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def stochf(self, k=None, d=None, mamode=None, talib=None, offset=None, **kwargs):
+ def stochf(self, k=None, d=None, mamode=None, talib=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = stochf(high=high, low=low, close=close, k=k, d=d, mamode=mamode, talib=talib, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def stochrsi(self, length=None, rsi_length=None, k=None, d=None, mamode=None, offset=None, **kwargs):
+ def stochrsi(self, length=None, rsi_length=None, k=None, d=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1093,22 +1105,22 @@ class AnalysisIndicators(object):
mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def td_seq(self, asint=None, offset=None, show_all=None, **kwargs):
+ def td_seq(self, asint=None, offset: Int = None, show_all=None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = td_seq(close=close, asint=asint, offset=offset, show_all=show_all, **kwargs)
return self._post_process(result, **kwargs)
- def trix(self, length=None, signal=None, scalar=None, drift=None, offset=None, **kwargs):
+ def trix(self, length=None, signal=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = trix(close=close, length=length, signal=signal, scalar=scalar, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def tsi(self, fast=None, slow=None, drift=None, mamode=None, offset=None, **kwargs):
+ def tsi(self, fast=None, slow=None, drift=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = tsi(close=close, fast=fast, slow=slow, drift=drift, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def uo(self, fast=None, medium=None, slow=None, fast_w=None, medium_w=None, slow_w=None, drift=None, offset=None, **kwargs):
+ def uo(self, fast=None, medium=None, slow=None, fast_w=None, medium_w=None, slow_w=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1116,7 +1128,7 @@ class AnalysisIndicators(object):
medium_w=medium_w, slow_w=slow_w, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def willr(self, length=None, percentage=True, offset=None, **kwargs):
+ def willr(self, length=None, percentage=True, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1124,73 +1136,73 @@ class AnalysisIndicators(object):
return self._post_process(result, **kwargs)
# Overlap
- def alligator(self, jaw=None, teeth=None, lips=None, offset=None, **kwargs):
+ def alligator(self, jaw=None, teeth=None, lips=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = alligator(close=close, jaw=jaw, teeth=teeth, lips=lips, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def alma(self, length=None, sigma=None, distribution_offset=None, offset=None, **kwargs):
+ def alma(self, length=None, sigma=None, distribution_offset=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = alma(close=close, length=length, sigma=sigma, distribution_offset=distribution_offset, offset=offset,
**kwargs)
return self._post_process(result, **kwargs)
- def dema(self, length=None, offset=None, **kwargs):
+ def dema(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = dema(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ema(self, length=None, offset=None, **kwargs):
+ def ema(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ema(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def fwma(self, length=None, offset=None, **kwargs):
+ def fwma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = fwma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def hilo(self, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
+ def hilo(self, high_length=None, low_length=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = hilo(high=high, low=low, close=close, high_length=high_length, low_length=low_length, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def hl2(self, offset=None, **kwargs):
+ def hl2(self, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = hl2(high=high, low=low, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def hlc3(self, offset=None, **kwargs):
+ def hlc3(self, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = hlc3(high=high, low=low, close=close, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def hma(self, length=None, offset=None, **kwargs):
+ def hma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = hma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def hwma(self, na=None, nb=None, nc=None, offset=None, **kwargs):
+ def hwma(self, na=None, nb=None, nc=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = hwma(close=close, na=na, nb=nb, nc=nc, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def jma(self, length=None, phase=None, offset=None, **kwargs):
+ def jma(self, length=None, phase=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = jma(close=close, length=length, phase=phase, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def kama(self, length=None, fast=None, slow=None, offset=None, **kwargs):
+ def kama(self, length=None, fast=None, slow=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = kama(close=close, length=length, fast=fast, slow=slow, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ichimoku(self, tenkan=None, kijun=None, senkou=None, include_chikou=True, offset=None, **kwargs):
+ def ichimoku(self, tenkan=None, kijun=None, senkou=None, include_chikou=True, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1202,28 +1214,28 @@ class AnalysisIndicators(object):
# return self._post_process(result, **kwargs), span
return result, span
- def linreg(self, length=None, offset=None, adjust=None, **kwargs):
+ def linreg(self, length=None, offset: Int = None, adjust=None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = linreg(close=close, length=length, offset=offset, adjust=adjust, **kwargs)
return self._post_process(result, **kwargs)
- def mcgd(self, length=None, offset=None, **kwargs):
+ def mcgd(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = mcgd(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def midpoint(self, length=None, offset=None, **kwargs):
+ def midpoint(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = midpoint(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def midprice(self, length=None, offset=None, **kwargs):
+ def midprice(self, length=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = midprice(high=high, low=low, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ohlc4(self, offset=None, **kwargs):
+ def ohlc4(self, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -1231,42 +1243,42 @@ class AnalysisIndicators(object):
result = ohlc4(open_=open_, high=high, low=low, close=close, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def pwma(self, length=None, offset=None, **kwargs):
+ def pwma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = pwma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def rma(self, length=None, offset=None, **kwargs):
+ def rma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = rma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def sinwma(self, length=None, offset=None, **kwargs):
+ def sinwma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = sinwma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def sma(self, length=None, offset=None, **kwargs):
+ def sma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = sma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def smma(self, length=None, offset=None, **kwargs):
+ def smma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = smma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ssf(self, length=None, everget=None, pi=None, sqrt2=None, offset=None, **kwargs):
+ def ssf(self, length=None, everget=None, pi=None, sqrt2=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ssf(close=close, length=length, everget=everget, pi=pi, sqrt2=sqrt2, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ssf3(self, length=None, pi=None, sqrt3=None, offset=None, **kwargs):
+ def ssf3(self, length=None, pi=None, sqrt3=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ssf3(close=close, length=length, pi=pi, sqrt3=sqrt3, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def supertrend(self, length=None, multiplier=None, offset=None, **kwargs):
+ def supertrend(self, length=None, multiplier=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1274,32 +1286,32 @@ class AnalysisIndicators(object):
**kwargs)
return self._post_process(result, **kwargs)
- def swma(self, length=None, offset=None, **kwargs):
+ def swma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = swma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def t3(self, length=None, a=None, offset=None, **kwargs):
+ def t3(self, length=None, a=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = t3(close=close, length=length, a=a, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def tema(self, length=None, offset=None, **kwargs):
+ def tema(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = tema(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def trima(self, length=None, offset=None, **kwargs):
+ def trima(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = trima(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def vidya(self, length=None, offset=None, **kwargs):
+ def vidya(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = vidya(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def vwap(self, anchor=None, offset=None, **kwargs):
+ def vwap(self, anchor=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1311,110 +1323,110 @@ class AnalysisIndicators(object):
result = vwap(high=high, low=low, close=close, volume=volume, anchor=anchor, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def vwma(self, volume=None, length=None, offset=None, **kwargs):
+ def vwma(self, volume=None, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = vwma(close=close, volume=volume, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def wcp(self, offset=None, **kwargs):
+ def wcp(self, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = wcp(high=high, low=low, close=close, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def wma(self, length=None, offset=None, **kwargs):
+ def wma(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = wma(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def zlma(self, length=None, mamode=None, offset=None, **kwargs):
+ def zlma(self, length=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = zlma(close=close, length=length, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
# Performance
- def log_return(self, length=None, cumulative=False, percent=False, offset=None, **kwargs):
+ def log_return(self, length=None, cumulative=False, percent=False, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = log_return(close=close, length=length, cumulative=cumulative, percent=percent, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def percent_return(self, length=None, cumulative=False, percent=False, offset=None, **kwargs):
+ def percent_return(self, length=None, cumulative=False, percent=False, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = percent_return(close=close, length=length, cumulative=cumulative, percent=percent, offset=offset,
**kwargs)
return self._post_process(result, **kwargs)
# Statistics
- def entropy(self, length=None, base=None, offset=None, **kwargs):
+ def entropy(self, length=None, base=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = entropy(close=close, length=length, base=base, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def kurtosis(self, length=None, offset=None, **kwargs):
+ def kurtosis(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = kurtosis(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def mad(self, length=None, offset=None, **kwargs):
+ def mad(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = mad(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def median(self, length=None, offset=None, **kwargs):
+ def median(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = median(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def quantile(self, length=None, q=None, offset=None, **kwargs):
+ def quantile(self, length=None, q=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = quantile(close=close, length=length, q=q, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def skew(self, length=None, offset=None, **kwargs):
+ def skew(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = skew(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def stdev(self, length=None, offset=None, **kwargs):
+ def stdev(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = stdev(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def tos_stdevall(self, length=None, stds=None, offset=None, **kwargs):
+ def tos_stdevall(self, length=None, stds=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = tos_stdevall(close=close, length=length, stds=stds, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def variance(self, length=None, offset=None, **kwargs):
+ def variance(self, length=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = variance(close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def zscore(self, length=None, std=None, offset=None, **kwargs):
+ def zscore(self, length=None, std=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = zscore(close=close, length=length, std=std, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
# Transform
- def cube(self, cubing_exponent=None, signal_offset=None, offset=None, **kwargs):
+ def cube(self, cubing_exponent=None, signal_offset=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = cube(close=close, cubing_exponent=cubing_exponent, signal_offset=signal_offset, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ifisher(self, amplifying_factor=None, signal_offset=None, offset=None, **kwargs):
+ def ifisher(self, amplifying_factor=None, signal_offset=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ifisher(close=close, amplifying_factor=amplifying_factor, signal_offset=signal_offset, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def remap(self, from_min=None, from_max=None, to_min=None, to_max=None, offset=None, **kwargs):
+ def remap(self, from_min=None, from_max=None, to_min=None, to_max=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = remap(close=close, from_min=from_min, from_max=from_max, to_min=to_min, to_max=to_max, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
# Trend
- def adx(self, length=None, lensig=None, mamode=None, scalar=None, drift=None, offset=None, **kwargs):
+ def adx(self, length=None, lensig=None, mamode=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1422,18 +1434,18 @@ class AnalysisIndicators(object):
drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def amat(self, fast=None, slow=None, mamode=None, lookback=None, offset=None, **kwargs):
+ def amat(self, fast=None, slow=None, mamode=None, lookback=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = amat(close=close, fast=fast, slow=slow, mamode=mamode, lookback=lookback, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def aroon(self, length=None, scalar=None, offset=None, **kwargs):
+ def aroon(self, length=None, scalar=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = aroon(high=high, low=low, length=length, scalar=scalar, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def chop(self, length=None, atr_length=None, ln=None, scalar=None, drift=None, offset=None, **kwargs):
+ def chop(self, length=None, atr_length=None, ln=None, scalar=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1441,61 +1453,61 @@ class AnalysisIndicators(object):
drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cksp(self, p=None, x=None, q=None, mamode=None, offset=None, **kwargs):
+ def cksp(self, p=None, x=None, q=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = cksp(high=high, low=low, close=close, p=p, x=x, q=q, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def decay(self, length=None, mode=None, offset=None, **kwargs):
+ def decay(self, length=None, mode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = decay(close=close, length=length, mode=mode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def decreasing(self, length=None, strict=None, asint=None, offset=None, **kwargs):
+ def decreasing(self, length=None, strict=None, asint=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = decreasing(close=close, length=length, strict=strict, asint=asint, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def dpo(self, length=None, centered=True, offset=None, **kwargs):
+ def dpo(self, length=None, centered=True, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = dpo(close=close, length=length, centered=centered, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def increasing(self, length=None, strict=None, asint=None, offset=None, **kwargs):
+ def increasing(self, length=None, strict=None, asint=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = increasing(close=close, length=length, strict=strict, asint=asint, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def long_run(self, fast=None, slow=None, length=None, offset=None, **kwargs):
+ def long_run(self, fast=None, slow=None, length=None, offset: Int = None, **kwargs: DictLike):
if fast is None and slow is None:
return self._df
else:
result = long_run(fast=fast, slow=slow, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def psar(self, af0=None, af=None, max_af=None, offset=None, **kwargs):
+ def psar(self, af0=None, af=None, max_af=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", None))
result = psar(high=high, low=low, close=close, af0=af0, af=af, max_af=max_af, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def qstick(self, length=None, offset=None, **kwargs):
+ def qstick(self, length=None, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
close = self._get_column(kwargs.pop("close", "close"))
result = qstick(open_=open_, close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def short_run(self, fast=None, slow=None, length=None, offset=None, **kwargs):
+ def short_run(self, fast=None, slow=None, length=None, offset: Int = None, **kwargs: DictLike):
if fast is None and slow is None:
return self._df
else:
result = short_run(fast=fast, slow=slow, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def supertrend(self, period=None, multiplier=None, mamode=None, drift=None, offset=None, **kwargs):
+ def supertrend(self, period=None, multiplier=None, mamode=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1503,38 +1515,38 @@ class AnalysisIndicators(object):
drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def trendflex(self, close=None, length=None, smooth=None, alpha=None, pi=None, sqrt2=None, offset=None, **kwargs):
+ def trendflex(self, close=None, length=None, smooth=None, alpha=None, pi=None, sqrt2=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = trendflex(close=close, length=length, smooth=smooth, alpha=alpha, pi=pi, sqrt2=sqrt2, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def tsignals(self, trend=None, asbool=None, trend_reset=None, trend_offset=None, offset=None, **kwargs):
+ def tsignals(self, trend=None, asbool=None, trend_reset=None, trend_offset=None, offset: Int = None, **kwargs: DictLike):
if trend is None:
return self._df
else:
result = tsignals(trend, asbool=asbool, trend_offset=trend_offset, trend_reset=trend_reset, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ttm_trend(self, length=None, offset=None, **kwargs):
+ def ttm_trend(self, length=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = ttm_trend(high=high, low=low, close=close, length=length, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def vhf(self, length=None, drift=None, offset=None, **kwargs):
+ def vhf(self, length=None, drift=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = vhf(close=close, length=length, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def vortex(self, drift=None, offset=None, **kwargs):
+ def vortex(self, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = vortex(high=high, low=low, close=close, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def xsignals(self, signal=None, xa=None, xb=None, above=None, long=None, asbool=None, trend_reset=None, trend_offset=None, offset=None, **kwargs):
+ def xsignals(self, signal=None, xa=None, xb=None, above=None, long=None, asbool=None, trend_reset=None, trend_offset=None, offset: Int = None, **kwargs: DictLike):
if signal is None:
return self._df
else:
@@ -1543,7 +1555,7 @@ class AnalysisIndicators(object):
return self._post_process(result, **kwargs)
# Volatility
- def aberration(self, length=None, atr_length=None, offset=None, **kwargs):
+ def aberration(self, length=None, atr_length=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1551,38 +1563,38 @@ class AnalysisIndicators(object):
**kwargs)
return self._post_process(result, **kwargs)
- def accbands(self, length=None, c=None, mamode=None, offset=None, **kwargs):
+ def accbands(self, length=None, c=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = accbands(high=high, low=low, close=close, length=length, c=c, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def atr(self, length=None, mamode=None, offset=None, **kwargs):
+ def atr(self, length=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = atr(high=high, low=low, close=close, length=length, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def bbands(self, length=None, std=None, mamode=None, offset=None, **kwargs):
+ def bbands(self, length=None, std=None, mamode=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = bbands(close=close, length=length, std=std, mamode=mamode, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def donchian(self, lower_length=None, upper_length=None, offset=None, **kwargs):
+ def donchian(self, lower_length=None, upper_length=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = donchian(high=high, low=low, lower_length=lower_length, upper_length=upper_length, offset=offset,
**kwargs)
return self._post_process(result, **kwargs)
- def hwc(self, na=None, nb=None, nc=None, nd=None, scalar=None, offset=None, **kwargs):
+ def hwc(self, na=None, nb=None, nc=None, nd=None, scalar=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = hwc(close=close, na=na, nb=nb, nc=nc, nd=nd, scalar=scalar, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def kc(self, length=None, scalar=None, mamode=None, offset=None, **kwargs):
+ def kc(self, length=None, scalar=None, mamode=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1590,13 +1602,13 @@ class AnalysisIndicators(object):
**kwargs)
return self._post_process(result, **kwargs)
- def massi(self, fast=None, slow=None, offset=None, **kwargs):
+ def massi(self, fast=None, slow=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = massi(high=high, low=low, fast=fast, slow=slow, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def natr(self, length=None, mamode=None, scalar=None, offset=None, **kwargs):
+ def natr(self, length=None, mamode=None, scalar=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1604,7 +1616,7 @@ class AnalysisIndicators(object):
**kwargs)
return self._post_process(result, **kwargs)
- def pdist(self, drift=None, offset=None, **kwargs):
+ def pdist(self, drift=None, offset: Int = None, **kwargs: DictLike):
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
@@ -1612,7 +1624,7 @@ class AnalysisIndicators(object):
result = pdist(open_=open_, high=high, low=low, close=close, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def rvi(self, length=None, scalar=None, refined=None, thirds=None, mamode=None, drift=None, offset=None, **kwargs):
+ def rvi(self, length=None, scalar=None, refined=None, thirds=None, mamode=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1620,27 +1632,27 @@ class AnalysisIndicators(object):
mamode=mamode, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def thermo(self, long=None, short= None, length=None, mamode=None, drift=None, offset=None, **kwargs):
+ def thermo(self, long=None, short= None, length=None, mamode=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
result = thermo(high=high, low=low, long=long, short=short, length=length, mamode=mamode, drift=drift,
offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def true_range(self, drift=None, offset=None, **kwargs):
+ def true_range(self, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
result = true_range(high=high, low=low, close=close, drift=drift, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def ui(self, length=None, scalar=None, offset=None, **kwargs):
+ def ui(self, length=None, scalar=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
result = ui(close=close, length=length, scalar=scalar, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
# Volume
- def ad(self, open_=None, signed=True, offset=None, **kwargs):
+ def ad(self, open_=None, signed=True, offset: Int = None, **kwargs: DictLike):
if open_ is not None:
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
@@ -1650,7 +1662,7 @@ class AnalysisIndicators(object):
result = ad(high=high, low=low, close=close, volume=volume, open_=open_, signed=signed, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def adosc(self, open_=None, fast=None, slow=None, signed=True, offset=None, **kwargs):
+ def adosc(self, open_=None, fast=None, slow=None, signed=True, offset: Int = None, **kwargs: DictLike):
if open_ is not None:
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
@@ -1661,14 +1673,14 @@ class AnalysisIndicators(object):
signed=signed, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def aobv(self, fast=None, slow=None, mamode=None, max_lookback=None, min_lookback=None, offset=None, **kwargs):
+ def aobv(self, fast=None, slow=None, mamode=None, max_lookback=None, min_lookback=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = aobv(close=close, volume=volume, fast=fast, slow=slow, mamode=mamode, max_lookback=max_lookback,
min_lookback=min_lookback, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def cmf(self, open_=None, length=None, offset=None, **kwargs):
+ def cmf(self, open_=None, length=None, offset: Int = None, **kwargs: DictLike):
if open_ is not None:
open_ = self._get_column(kwargs.pop("open", "open"))
high = self._get_column(kwargs.pop("high", "high"))
@@ -1679,13 +1691,13 @@ class AnalysisIndicators(object):
**kwargs)
return self._post_process(result, **kwargs)
- def efi(self, length=None, mamode=None, offset=None, drift=None, **kwargs):
+ def efi(self, length=None, mamode=None, offset: Int = None, drift=None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = efi(close=close, volume=volume, length=length, offset=offset, mamode=mamode, drift=drift, **kwargs)
return self._post_process(result, **kwargs)
- def eom(self, length=None, divisor=None, offset=None, drift=None, **kwargs):
+ def eom(self, length=None, divisor=None, offset: Int = None, drift=None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1694,7 +1706,7 @@ class AnalysisIndicators(object):
drift=drift, **kwargs)
return self._post_process(result, **kwargs)
- def kvo(self, fast=None, slow=None, length_sig=None, mamode=None, offset=None, drift=None, **kwargs):
+ def kvo(self, fast=None, slow=None, length_sig=None, mamode=None, offset: Int = None, drift=None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1703,7 +1715,7 @@ class AnalysisIndicators(object):
mamode=mamode, offset=offset, drift=drift, **kwargs)
return self._post_process(result, **kwargs)
- def mfi(self, length=None, drift=None, offset=None, **kwargs):
+ def mfi(self, length=None, drift=None, offset: Int = None, **kwargs: DictLike):
high = self._get_column(kwargs.pop("high", "high"))
low = self._get_column(kwargs.pop("low", "low"))
close = self._get_column(kwargs.pop("close", "close"))
@@ -1712,43 +1724,43 @@ class AnalysisIndicators(object):
**kwargs)
return self._post_process(result, **kwargs)
- def nvi(self, length=None, initial=None, signed=True, offset=None, **kwargs):
+ def nvi(self, length=None, initial=None, signed=True, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = nvi(close=close, volume=volume, length=length, initial=initial, signed=signed, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def obv(self, offset=None, **kwargs):
+ def obv(self, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = obv(close=close, volume=volume, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def pvi(self, length=None, initial=None, signed=True, offset=None, **kwargs):
+ def pvi(self, length=None, initial=None, signed=True, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = pvi(close=close, volume=volume, length=length, initial=initial, signed=signed, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def pvol(self, volume=None, offset=None, **kwargs):
+ def pvol(self, volume=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = pvol(close=close, volume=volume, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def pvr(self, **kwargs):
+ def pvr(self, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = pvr(close=close, volume=volume)
return self._post_process(result, **kwargs)
- def pvt(self, offset=None, **kwargs):
+ def pvt(self, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = pvt(close=close, volume=volume, offset=offset, **kwargs)
return self._post_process(result, **kwargs)
- def wb_tsv(self, length=None, signal=None, offset=None, **kwargs):
+ def wb_tsv(self, length=None, signal=None, offset: Int = None, **kwargs: DictLike):
close = self._get_column(kwargs.pop("close", "close"))
volume = self._get_column(kwargs.pop("volume", "volume"))
result = wb_tsv(close=close, volume=volume, signal=signal, offset=offset, **kwargs)
diff --git a/pandas_ta/custom.py b/pandas_ta/custom.py
index 4453640..d8fbb40 100644
--- a/pandas_ta/custom.py
+++ b/pandas_ta/custom.py
@@ -8,6 +8,7 @@ from os.path import abspath, join, exists, basename, splitext
from glob import glob
import pandas_ta
+from pandas_ta._typing import DictLike
def bind(name: str, f: types.FunctionType):#, method: types.MethodType = None):
@@ -56,9 +57,10 @@ def create_dir(path: str, create_categories: bool = True, verbose: bool = True):
print(f"[i] Created an empty sub-directory '{dirname}'.")
-def get_module_functions(module: types.ModuleType) -> dict:
+def get_module_functions(module: types.ModuleType) -> DictLike:
"""
- Helper function to get the functions of an imported module as a dictionary.
+ Helper function to get the functions of an imported module
+ as a dictionary.
Args:
module: python module
@@ -87,14 +89,14 @@ def import_dir(path: str, verbose: bool = True):
path (str): Full path to your indicator tree
verbose (bool): If True verbose output of results
- This method allows you to experiment and develop your own technical analysis
- indicators in a separate local directory of your choice but use them seamlessly
- together with the existing pandas_ta functions just like if they were part of
- pandas_ta.
+ This method allows you to experiment and develop your own technical
+ analysis indicators in a separate local directory of your choice but
+ use them seamlessly together with the existing pandas_ta functions just
+ like if they were part of pandas_ta.
- If you at some late point would like to push them into the pandas_ta library
- you can do so very easily by following the step by step instruction here
- https://github.com/twopirllc/pandas-ta/issues/355.
+ If you at some late point would like to push them into the pandas_ta
+ library you can do so very easily by following the step by step
+ instruction here https://github.com/twopirllc/pandas-ta/issues/355.
A brief example of usage:
@@ -102,9 +104,9 @@ def import_dir(path: str, verbose: bool = True):
>>> import pandas as pd
>>> import pandas_ta as ta
- 2. Create an empty directory on your machine where you want to work with your
- indicators. Invoke pandas_ta.custom.import_dir once to pre-populate it with
- sub-folders for all available indicator categories, e.g.:
+ 2. Create an empty directory on your machine where you want to work with
+ your indicators. Invoke pandas_ta.custom.import_dir once to pre-populate
+ it with sub-folders for all available indicator categories, e.g.:
>>> import os
>>> from os.path import abspath, join, expanduser
@@ -121,8 +123,8 @@ def import_dir(path: str, verbose: bool = True):
ending with '_method'. E.g. 'ni_method'
In essence these modules should look exactly like the standard indicators
- available in categories under the pandas_ta-folder. The only difference will
- be an addition of a matching class method.
+ available in categories under the pandas_ta-folder. The only difference
+ will be an addition of a matching class method.
For an example of the correct structure, look at the example ni.py in the
examples folder.
diff --git a/pandas_ta/cycles/ebsw.py b/pandas_ta/cycles/ebsw.py
index fbd9091..2ab4e95 100644
--- a/pandas_ta/cycles/ebsw.py
+++ b/pandas_ta/cycles/ebsw.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import cos, exp, mean, nan, pi, roll, sin, sqrt, zeros
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def ebsw(
- close: Series, length: int = None, bars: int = None,
+ close: Series, length: Int = None, bars: Int = None,
initial_version: bool = False,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Even Better SineWave (EBSW)
diff --git a/pandas_ta/cycles/reflex.py b/pandas_ta/cycles/reflex.py
index adea56a..5878b1d 100644
--- a/pandas_ta/cycles/reflex.py
+++ b/pandas_ta/cycles/reflex.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
-from numpy import cos, exp, nan, ndarray, sqrt, zeros_like
+from numpy import cos, exp, nan, sqrt, zeros_like
from pandas import Series
+from pandas_ta._typing import Array, DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
@@ -11,8 +12,9 @@ except ImportError:
@njit
-def np_reflex(x: ndarray, n: int, k: int,
- alpha: float, pi: float, sqrt2: float):
+def np_reflex(
+ x: Array, n: Int, k: Int, alpha: IntFloat, pi: IntFloat, sqrt2: IntFloat
+):
m, ratio = x.size, 2 * sqrt2 / k
a = exp(-pi * ratio)
b = 2 * a * cos(180 * ratio)
@@ -41,10 +43,10 @@ def np_reflex(x: ndarray, n: int, k: int,
def reflex(
- close: Series, length: int = None,
- smooth: int = None, alpha: float = None,
- pi: float = None, sqrt2: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ smooth: Int = None, alpha: IntFloat = None,
+ pi: IntFloat = None, sqrt2: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Reflex (reflex)
diff --git a/pandas_ta/ma.py b/pandas_ta/ma.py
index 79b5117..694a1e4 100644
--- a/pandas_ta/ma.py
+++ b/pandas_ta/ma.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap.dema import dema
from pandas_ta.overlap.ema import ema
from pandas_ta.overlap.fwma import fwma
@@ -19,7 +20,7 @@ from pandas_ta.overlap.vidya import vidya
from pandas_ta.overlap.wma import wma
-def ma(name: str = None, source: Series = None, **kwargs) -> Series:
+def ma(name: str = None, source: Series = None, **kwargs: DictLike) -> Series:
"""Simple MA Utility for easier MA selection
Available MAs:
diff --git a/pandas_ta/maps.py b/pandas_ta/maps.py
index 69b52ae..64fe578 100644
--- a/pandas_ta/maps.py
+++ b/pandas_ta/maps.py
@@ -3,6 +3,8 @@ from importlib.util import find_spec
from pathlib import Path
from pkg_resources import get_distribution, DistributionNotFound
+from pandas_ta._typing import Dict, IntFloat, ListStr
+
_dist = get_distribution("pandas_ta")
try:
@@ -16,7 +18,7 @@ except DistributionNotFound:
version = __version__ = _dist.version
-Imports = {
+Imports: Dict[str, bool] = {
"alphaVantage-api": find_spec("alphaVantageAPI") is not None,
"dotenv": find_spec("dotenv") is not None,
"matplotlib": find_spec("matplotlib") is not None,
@@ -36,7 +38,7 @@ Imports = {
# Not ideal and not dynamic but it works.
# Will find a dynamic solution later.
-Category = {
+Category: Dict[str, ListStr] = {
# Candles
"candles": [
"cdl_pattern", "cdl_z", "ha"
@@ -88,7 +90,7 @@ Category = {
],
}
-CANDLE_AGG = {
+CANDLE_AGG: Dict[str, str] = {
"open": "first",
"high": "max",
"low": "min",
@@ -97,7 +99,7 @@ CANDLE_AGG = {
}
# https://www.worldtimezone.com/markets24.php
-EXCHANGE_TZ = {
+EXCHANGE_TZ: Dict[str, IntFloat] = {
"NZSX": 12, "ASX": 11,
"TSE": 9, "HKE": 8, "SSE": 8, "SGX": 8,
"NSE": 5.5, "DIFX": 4, "RTS": 3,
@@ -106,7 +108,7 @@ EXCHANGE_TZ = {
"GENR": 0 # Generated Data
}
-RATE = {
+RATE: Dict[str, IntFloat] = {
"DAYS_PER_MONTH": 21,
"MINUTES_PER_HOUR": 60,
"MONTHS_PER_YEAR": 12,
diff --git a/pandas_ta/momentum/ao.py b/pandas_ta/momentum/ao.py
index 534bd46..fda8165 100644
--- a/pandas_ta/momentum/ao.py
+++ b/pandas_ta/momentum/ao.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import sma
from pandas_ta.utils import get_offset, verify_series
def ao(
- high: Series, low: Series, fast: int = None, slow: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, fast: Int = None, slow: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Awesome Oscillator (AO)
diff --git a/pandas_ta/momentum/apo.py b/pandas_ta/momentum/apo.py
index 82ba968..6ad3cbf 100644
--- a/pandas_ta/momentum/apo.py
+++ b/pandas_ta/momentum/apo.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, tal_ma, verify_series
def apo(
- close: Series, fast: int = None, slow: int = None,
+ close: Series, fast: Int = None, slow: Int = None,
mamode: str = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Absolute Price Oscillator (APO)
diff --git a/pandas_ta/momentum/bias.py b/pandas_ta/momentum/bias.py
index 05a1887..ad1f4fe 100644
--- a/pandas_ta/momentum/bias.py
+++ b/pandas_ta/momentum/bias.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_offset, verify_series
def bias(
- close: Series, length: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Bias (BIAS)
diff --git a/pandas_ta/momentum/bop.py b/pandas_ta/momentum/bop.py
index 80f1434..4803c31 100644
--- a/pandas_ta/momentum/bop.py
+++ b/pandas_ta/momentum/bop.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def bop(
open_: Series, high: Series, low: Series, close: Series,
- scalar: float = None, talib: bool = None,
- offset: int = None, **kwargs
+ scalar: IntFloat = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Balance of Power (BOP)
diff --git a/pandas_ta/momentum/brar.py b/pandas_ta/momentum/brar.py
index 161ab31..ec4d8c6 100644
--- a/pandas_ta/momentum/brar.py
+++ b/pandas_ta/momentum/brar.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def brar(
open_: Series, high: Series, low: Series, close: Series,
- length: int = None, scalar: float = None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, scalar: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""BRAR (BRAR)
diff --git a/pandas_ta/momentum/cci.py b/pandas_ta/momentum/cci.py
index bbd8bc1..2716078 100644
--- a/pandas_ta/momentum/cci.py
+++ b/pandas_ta/momentum/cci.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.overlap import hlc3, sma
from pandas_ta.statistics import mad
@@ -7,9 +8,9 @@ from pandas_ta.utils import get_offset, verify_series
def cci(
- high: Series, low: Series, close: Series, length: int = None,
- c: float = None, talib: bool = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, close: Series, length: Int = None,
+ c: IntFloat = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Commodity Channel Index (CCI)
diff --git a/pandas_ta/momentum/cfo.py b/pandas_ta/momentum/cfo.py
index cecf8e2..aed816e 100644
--- a/pandas_ta/momentum/cfo.py
+++ b/pandas_ta/momentum/cfo.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import linreg
from pandas_ta.utils import get_drift, get_offset, verify_series
def cfo(
- close: Series, length: int = None,
- scalar: float = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ scalar: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Chande Forcast Oscillator (CFO)
diff --git a/pandas_ta/momentum/cg.py b/pandas_ta/momentum/cg.py
index 9169e71..a2450b3 100644
--- a/pandas_ta/momentum/cg.py
+++ b/pandas_ta/momentum/cg.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series, weights
def cg(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Center of Gravity (CG)
diff --git a/pandas_ta/momentum/cmo.py b/pandas_ta/momentum/cmo.py
index b84d154..17c20e9 100644
--- a/pandas_ta/momentum/cmo.py
+++ b/pandas_ta/momentum/cmo.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.overlap import rma
from pandas_ta.utils import get_drift, get_offset, verify_series
def cmo(
- close: Series, length: int = None, scalar: float = None,
- talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, scalar: IntFloat = None,
+ talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Chande Momentum Oscillator (CMO)
diff --git a/pandas_ta/momentum/coppock.py b/pandas_ta/momentum/coppock.py
index 249f62a..0d4fb21 100644
--- a/pandas_ta/momentum/coppock.py
+++ b/pandas_ta/momentum/coppock.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import wma
from pandas_ta.utils import get_offset, verify_series
from .roc import roc
def coppock(
- close: Series, length: int = None, fast: int = None, slow: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, fast: Int = None, slow: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Coppock Curve (COPC)
diff --git a/pandas_ta/momentum/cti.py b/pandas_ta/momentum/cti.py
index 3071788..7fddf06 100644
--- a/pandas_ta/momentum/cti.py
+++ b/pandas_ta/momentum/cti.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import linreg
from pandas_ta.utils import get_offset, verify_series
def cti(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Correlation Trend Indicator (CTI)
diff --git a/pandas_ta/momentum/dm.py b/pandas_ta/momentum/dm.py
index 23bbfe6..a9e0543 100644
--- a/pandas_ta/momentum/dm.py
+++ b/pandas_ta/momentum/dm.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series, get_drift, zero
def dm(
- high: Series, low: Series, length: int = None,
- mamode: str = None, talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, length: Int = None,
+ mamode: str = None, talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Directional Movement (DM)
diff --git a/pandas_ta/momentum/er.py b/pandas_ta/momentum/er.py
index c3b2e67..d3375f9 100644
--- a/pandas_ta/momentum/er.py
+++ b/pandas_ta/momentum/er.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, concat, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, verify_series, signals
def er(
- close: Series, length: int = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Efficiency Ratio (ER)
diff --git a/pandas_ta/momentum/eri.py b/pandas_ta/momentum/eri.py
index 03afbca..af60925 100644
--- a/pandas_ta/momentum/eri.py
+++ b/pandas_ta/momentum/eri.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import ema
from pandas_ta.utils import get_offset, verify_series
def eri(
- high: Series, low: Series, close: Series, length: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Elder Ray Index (ERI)
diff --git a/pandas_ta/momentum/fisher.py b/pandas_ta/momentum/fisher.py
index 911cec3..bb4b821 100644
--- a/pandas_ta/momentum/fisher.py
+++ b/pandas_ta/momentum/fisher.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import log, nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import hl2
from pandas_ta.utils import get_offset, high_low_range, verify_series
def fisher(
- high: Series, low: Series, length: int = None, signal: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, length: Int = None, signal: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Fisher Transform (FISHT)
diff --git a/pandas_ta/momentum/inertia.py b/pandas_ta/momentum/inertia.py
index 201627f..f1c9a16 100644
--- a/pandas_ta/momentum/inertia.py
+++ b/pandas_ta/momentum/inertia.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import linreg
from pandas_ta.utils import get_drift, get_offset, verify_series
from pandas_ta.volatility import rvi
@@ -7,10 +8,10 @@ from pandas_ta.volatility import rvi
def inertia(
close: Series, high: Series = None, low: Series = None,
- length: int = None, rvi_length: int = None, scalar: float = None,
+ length: Int = None, rvi_length: Int = None, scalar: IntFloat = None,
refined: bool = None, thirds: bool = None,
- drift: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ drift: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Inertia (INERTIA)
diff --git a/pandas_ta/momentum/kdj.py b/pandas_ta/momentum/kdj.py
index c028607..7f3c72e 100644
--- a/pandas_ta/momentum/kdj.py
+++ b/pandas_ta/momentum/kdj.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, non_zero_range, rma_pandas, verify_series
def kdj(
high: Series, low: Series, close: Series,
- length: int = None, signal: int = None,
- offset: int = None, **kwargs
+ length: Int = None, signal: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""KDJ (KDJ)
diff --git a/pandas_ta/momentum/kst.py b/pandas_ta/momentum/kst.py
index 620319a..04a8621 100644
--- a/pandas_ta/momentum/kst.py
+++ b/pandas_ta/momentum/kst.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, verify_series
from .roc import roc
def kst(
- close: Series, signal: int = None,
- roc1: int = None, roc2: int = None, roc3: int = None, roc4: int = None,
- sma1: int = None, sma2: int = None, sma3: int = None, sma4: int = None,
- drift: int = None,
- offset: int = None, **kwargs
+ close: Series, signal: Int = None,
+ roc1: Int = None, roc2: Int = None, roc3: Int = None, roc4: Int = None,
+ sma1: Int = None, sma2: Int = None, sma3: Int = None, sma4: Int = None,
+ drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""'Know Sure Thing' (KST)
diff --git a/pandas_ta/momentum/macd.py b/pandas_ta/momentum/macd.py
index c3dfd07..5a0e9e6 100644
--- a/pandas_ta/momentum/macd.py
+++ b/pandas_ta/momentum/macd.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import concat, DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.overlap import ema
from pandas_ta.utils import get_offset, verify_series, signals
def macd(
- close: Series, fast: int = None, slow: int = None, signal: int = None,
- talib: bool = None, offset: int = None, **kwargs
+ close: Series, fast: Int = None, slow: Int = None, signal: Int = None,
+ talib: bool = None, offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Moving Average Convergence Divergence (MACD)
diff --git a/pandas_ta/momentum/mom.py b/pandas_ta/momentum/mom.py
index 78726be..f1eb006 100644
--- a/pandas_ta/momentum/mom.py
+++ b/pandas_ta/momentum/mom.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def mom(
- close: Series, length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Momentum (MOM)
diff --git a/pandas_ta/momentum/pgo.py b/pandas_ta/momentum/pgo.py
index fb7257c..1440c09 100644
--- a/pandas_ta/momentum/pgo.py
+++ b/pandas_ta/momentum/pgo.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import ema, sma
from pandas_ta.utils import get_offset, verify_series
from pandas_ta.volatility import atr
def pgo(
- high: Series, low: Series, close: Series, length: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Pretty Good Oscillator (PGO)
diff --git a/pandas_ta/momentum/ppo.py b/pandas_ta/momentum/ppo.py
index f23bd0f..d7fc95c 100644
--- a/pandas_ta/momentum/ppo.py
+++ b/pandas_ta/momentum/ppo.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, tal_ma, verify_series
def ppo(
- close: Series, fast: int = None, slow: int = None, signal: int = None,
- scalar: float = None, mamode: str = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, fast: Int = None, slow: Int = None, signal: Int = None,
+ scalar: IntFloat = None, mamode: str = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Percentage Price Oscillator (PPO)
diff --git a/pandas_ta/momentum/psl.py b/pandas_ta/momentum/psl.py
index 8aef062..ff1d28f 100644
--- a/pandas_ta/momentum/psl.py
+++ b/pandas_ta/momentum/psl.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import sign
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_drift, get_offset, verify_series
def psl(
close: Series, open_: Series = None,
- length: int = None, scalar: float = None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, scalar: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Psychological Line (PSL)
diff --git a/pandas_ta/momentum/pvo.py b/pandas_ta/momentum/pvo.py
index 6cd753f..32280c3 100644
--- a/pandas_ta/momentum/pvo.py
+++ b/pandas_ta/momentum/pvo.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import ema
from pandas_ta.utils import get_offset, verify_series
def pvo(
- volume: Series, fast: int = None, slow: int = None, signal: int = None,
- scalar: float = None,
- offset: int = None, **kwargs
+ volume: Series, fast: Int = None, slow: Int = None,
+ signal: Int = None, scalar: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Percentage Volume Oscillator (PVO)
diff --git a/pandas_ta/momentum/qqe.py b/pandas_ta/momentum/qqe.py
index 9b970fa..bd8a13e 100644
--- a/pandas_ta/momentum/qqe.py
+++ b/pandas_ta/momentum/qqe.py
@@ -1,16 +1,17 @@
# -*- coding: utf-8 -*-
from numpy import isnan, maximum, minimum, nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.utils import get_drift, get_offset, verify_series
from .rsi import rsi
def qqe(
- close: Series, length: int = None,
- smooth: int = None, factor: float = None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ smooth: Int = None, factor: IntFloat = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Quantitative Qualitative Estimation (QQE)
diff --git a/pandas_ta/momentum/roc.py b/pandas_ta/momentum/roc.py
index 4ceb390..233efbb 100644
--- a/pandas_ta/momentum/roc.py
+++ b/pandas_ta/momentum/roc.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from .mom import mom
def roc(
- close: Series, length: int = None,
- scalar: float = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ scalar: IntFloat = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rate of Change (ROC)
diff --git a/pandas_ta/momentum/rsi.py b/pandas_ta/momentum/rsi.py
index 40a9b8f..da5c1ee 100644
--- a/pandas_ta/momentum/rsi.py
+++ b/pandas_ta/momentum/rsi.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, concat, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.overlap import rma
from pandas_ta.utils import get_drift, get_offset, verify_series, signals
def rsi(
- close: Series, length: int = None, scalar: float = None,
- talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, scalar: IntFloat = None,
+ talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Relative Strength Index (RSI)
diff --git a/pandas_ta/momentum/rsx.py b/pandas_ta/momentum/rsx.py
index 9cb4f0f..cb2217f 100644
--- a/pandas_ta/momentum/rsx.py
+++ b/pandas_ta/momentum/rsx.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import nan
+from pandas_ta._typing import DictLike, Int
from pandas import concat, DataFrame, Series
from pandas_ta.utils import get_drift, get_offset, verify_series, signals
def rsx(
- close: Series, length: int = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Relative Strength Xtra (rsx)
diff --git a/pandas_ta/momentum/rvgi.py b/pandas_ta/momentum/rvgi.py
index e5003aa..5351f8c 100644
--- a/pandas_ta/momentum/rvgi.py
+++ b/pandas_ta/momentum/rvgi.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import swma
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def rvgi(
open_: Series, high: Series, low: Series, close: Series,
- length: int = None, swma_length: int = None,
- offset: int = None, **kwargs
+ length: Int = None, swma_length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Relative Vigor Index (RVGI)
diff --git a/pandas_ta/momentum/slope.py b/pandas_ta/momentum/slope.py
index 947c8c2..38f1e8d 100644
--- a/pandas_ta/momentum/slope.py
+++ b/pandas_ta/momentum/slope.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import arctan, pi
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def slope(
- close: Series, length: int = None,
- as_angle=None, to_degrees=None, vertical=None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ as_angle: bool = None, to_degrees: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Slope
diff --git a/pandas_ta/momentum/smi.py b/pandas_ta/momentum/smi.py
index 49f3486..bf0180f 100644
--- a/pandas_ta/momentum/smi.py
+++ b/pandas_ta/momentum/smi.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
from .tsi import tsi
def smi(
- close: Series, fast: int = None, slow: int = None, signal: int = None,
- scalar: float = None,
- offset: int = None, **kwargs
+ close: Series, fast: Int = None, slow: Int = None,
+ signal: Int = None, scalar: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""SMI Ergodic Indicator (SMI)
diff --git a/pandas_ta/momentum/squeeze.py b/pandas_ta/momentum/squeeze.py
index ee3b3de..d2da630 100644
--- a/pandas_ta/momentum/squeeze.py
+++ b/pandas_ta/momentum/squeeze.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import ema, linreg, sma
from pandas_ta.trend import decreasing, increasing
from pandas_ta.utils import get_offset, simplify_columns, unsigned_differences, verify_series
@@ -10,11 +11,11 @@ from .mom import mom
def squeeze(
high: Series, low: Series, close: Series,
- bb_length: int = None, bb_std: float = None,
- kc_length: int = None, kc_scalar: float = None,
- mom_length: int = None, mom_smooth: int = None,
- use_tr=None, mamode: str = None,
- offset: int = None, **kwargs
+ bb_length: Int = None, bb_std: IntFloat = None,
+ kc_length: Int = None, kc_scalar: IntFloat = None,
+ mom_length: Int = None, mom_smooth: Int = None,
+ use_tr: bool = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Squeeze (SQZ)
diff --git a/pandas_ta/momentum/squeeze_pro.py b/pandas_ta/momentum/squeeze_pro.py
index 0369fb7..2916acb 100644
--- a/pandas_ta/momentum/squeeze_pro.py
+++ b/pandas_ta/momentum/squeeze_pro.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.momentum import mom
from pandas_ta.overlap import ema, sma
from pandas_ta.trend import decreasing, increasing
@@ -10,12 +11,12 @@ from pandas_ta.utils import get_offset, simplify_columns, unsigned_differences,
def squeeze_pro(
high: Series, low: Series, close: Series,
- bb_length: int = None, bb_std: float = None,
- kc_length: int = None, kc_scalar_wide: float = None,
- kc_scalar_normal: float = None, kc_scalar_narrow: float = None,
- mom_length: int = None, mom_smooth: int = None,
- use_tr=None, mamode: str = None,
- offset: int = None, **kwargs
+ bb_length: Int = None, bb_std: IntFloat = None,
+ kc_length: Int = None, kc_scalar_wide: IntFloat = None,
+ kc_scalar_normal: IntFloat = None, kc_scalar_narrow: IntFloat = None,
+ mom_length: Int = None, mom_smooth: Int = None,
+ use_tr: bool = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Squeeze PRO(SQZPRO)
@@ -94,7 +95,8 @@ def squeeze_pro(
close = verify_series(close, _length)
offset = get_offset(offset)
- valid_kc_scaler = kc_scalar_wide > kc_scalar_normal and kc_scalar_normal > kc_scalar_narrow
+ valid_kc_scaler = kc_scalar_wide > kc_scalar_normal \
+ and kc_scalar_normal > kc_scalar_narrow
if not valid_kc_scaler:
return
diff --git a/pandas_ta/momentum/stc.py b/pandas_ta/momentum/stc.py
index 4ac0031..6af8efb 100644
--- a/pandas_ta/momentum/stc.py
+++ b/pandas_ta/momentum/stc.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import ema
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def stc(
- close: Series, tclength: int = None,
- fast: int = None, slow: int = None, factor: float = None,
- offset: int = None, **kwargs
+ close: Series, tclength: Int = None,
+ fast: Int = None, slow: Int = None, factor: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Schaff Trend Cycle (STC)
@@ -29,7 +30,8 @@ def stc(
extMa2 = df.ta.ema(close=df["close"], length=ma2_interval, append=True)
stc = ta.stc(close=df["close"], tclen=stc_tclen, ma1=extMa1, ma2=extMa2, factor=stc_factor)
- The same goes for osc=, which allows the input of an externally calculated oscillator, overriding ma1 & ma2.
+ The same goes for osc=, which allows the input of an externally
+ calculated oscillator, overriding ma1 & ma2.
Sources:
Implemented by rengel8 based on work found here:
diff --git a/pandas_ta/momentum/stoch.py b/pandas_ta/momentum/stoch.py
index e7624d7..1731858 100644
--- a/pandas_ta/momentum/stoch.py
+++ b/pandas_ta/momentum/stoch.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, non_zero_range, tal_ma, verify_series
@@ -7,9 +8,9 @@ from pandas_ta.utils import get_offset, non_zero_range, tal_ma, verify_series
def stoch(
high: Series, low: Series, close: Series,
- k: int = None, d: int = None, smooth_k: int = None,
+ k: Int = None, d: Int = None, smooth_k: Int = None,
mamode: str = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Stochastic (STOCH)
diff --git a/pandas_ta/momentum/stochf.py b/pandas_ta/momentum/stochf.py
index b4fecfd..345538f 100644
--- a/pandas_ta/momentum/stochf.py
+++ b/pandas_ta/momentum/stochf.py
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, non_zero_range, tal_ma, verify_series
def stochf(
- high: Series, low: Series, close: Series, k: int = None, d: int = None,
+ high: Series, low: Series, close: Series,
+ k: Int = None, d: Int = None,
mamode: str = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Fast Stochastic (STOCHF)
diff --git a/pandas_ta/momentum/stochrsi.py b/pandas_ta/momentum/stochrsi.py
index f707aa9..4ef4f3f 100644
--- a/pandas_ta/momentum/stochrsi.py
+++ b/pandas_ta/momentum/stochrsi.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.momentum import rsi
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def stochrsi(
- close: Series, length: int = None, rsi_length: int = None,
- k: int = None, d: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, rsi_length: Int = None,
+ k: Int = None, d: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Stochastic (STOCHRSI)
diff --git a/pandas_ta/momentum/td_seq.py b/pandas_ta/momentum/td_seq.py
index 3dbc129..6dcd59f 100644
--- a/pandas_ta/momentum/td_seq.py
+++ b/pandas_ta/momentum/td_seq.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import where
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def td_seq(
close: Series, asint: bool = None, show_all: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""TD Sequential (TD_SEQ)
diff --git a/pandas_ta/momentum/trix.py b/pandas_ta/momentum/trix.py
index 8526c12..c08777e 100644
--- a/pandas_ta/momentum/trix.py
+++ b/pandas_ta/momentum/trix.py
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
-# from numpy import isnan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap.ema import ema
from pandas_ta.utils import get_drift, get_offset, verify_series
def trix(
- close: Series, length: int = None, signal: int = None,
- scalar: float = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, signal: Int = None,
+ scalar: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Trix (TRIX)
diff --git a/pandas_ta/momentum/tsi.py b/pandas_ta/momentum/tsi.py
index 5594114..bd3c926 100644
--- a/pandas_ta/momentum/tsi.py
+++ b/pandas_ta/momentum/tsi.py
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.overlap import ema
from pandas_ta.utils import get_drift, get_offset, verify_series
def tsi(
- close: Series, fast: int = None, slow: int = None, signal: int = None,
- scalar: float = None, mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, fast: Int = None, slow: Int = None,
+ signal: Int = None, scalar: IntFloat = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""True Strength Index (TSI)
diff --git a/pandas_ta/momentum/uo.py b/pandas_ta/momentum/uo.py
index 4160b9f..c50ee61 100644
--- a/pandas_ta/momentum/uo.py
+++ b/pandas_ta/momentum/uo.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.utils import get_drift, get_offset, verify_series
def uo(
high: Series, low: Series, close: Series,
- fast: int = None, medium: int = None, slow: int = None,
- fast_w: float = None, medium_w: float = None, slow_w: float = None,
- talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ fast: Int = None, medium: Int = None, slow: Int = None,
+ fast_w: IntFloat = None, medium_w: IntFloat = None, slow_w: IntFloat = None,
+ talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Ultimate Oscillator (UO)
diff --git a/pandas_ta/momentum/willr.py b/pandas_ta/momentum/willr.py
index 7a28230..56c5d8c 100644
--- a/pandas_ta/momentum/willr.py
+++ b/pandas_ta/momentum/willr.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def willr(
high: Series, low: Series, close: Series,
- length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""William's Percent R (WILLR)
diff --git a/pandas_ta/overlap/alligator.py b/pandas_ta/overlap/alligator.py
index e914442..4ed2859 100644
--- a/pandas_ta/overlap/alligator.py
+++ b/pandas_ta/overlap/alligator.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
from .smma import smma
def alligator(
- close: Series, jaw: int = None, teeth: int = None, lips: int = None,
+ close: Series, jaw: Int = None, teeth: Int = None, lips: Int = None,
talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Bill Williams Alligator (ALLIGATOR)
diff --git a/pandas_ta/overlap/alma.py b/pandas_ta/overlap/alma.py
index f4b1fdb..7c1ffbb 100644
--- a/pandas_ta/overlap/alma.py
+++ b/pandas_ta/overlap/alma.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import append, arange, array, exp, floor, nan, tensordot
from numpy.version import version as npVersion
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas import Series
from pandas_ta.utils import get_offset, strided_window, verify_series
def alma(
- close: Series, length: int = None,
- sigma: float = None, dist_offset: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ sigma: IntFloat = None, dist_offset: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Arnaud Legoux Moving Average (ALMA)
diff --git a/pandas_ta/overlap/dema.py b/pandas_ta/overlap/dema.py
index dbc98a1..f1b6cf2 100644
--- a/pandas_ta/overlap/dema.py
+++ b/pandas_ta/overlap/dema.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from .ema import ema
def dema(
- close: Series, length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Double Exponential Moving Average (DEMA)
diff --git a/pandas_ta/overlap/ema.py b/pandas_ta/overlap/ema.py
index 57aac86..6b4cdc1 100644
--- a/pandas_ta/overlap/ema.py
+++ b/pandas_ta/overlap/ema.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
@@ -23,9 +24,9 @@ except ImportError:
def ema(
- close: Series, length: int = None,
+ close: Series, length: Int = None,
talib: bool = None, presma: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Exponential Moving Average (EMA)
diff --git a/pandas_ta/overlap/fwma.py b/pandas_ta/overlap/fwma.py
index f31a5cb..43d6269 100644
--- a/pandas_ta/overlap/fwma.py
+++ b/pandas_ta/overlap/fwma.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import fibonacci, get_offset, verify_series, weights
def fwma(
- close: Series, length: int = None, asc: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, asc: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Fibonacci's Weighted Moving Average (FWMA)
diff --git a/pandas_ta/overlap/hilo.py b/pandas_ta/overlap/hilo.py
index aff1204..676ac9c 100644
--- a/pandas_ta/overlap/hilo.py
+++ b/pandas_ta/overlap/hilo.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_offset, verify_series
def hilo(
high: Series, low: Series, close: Series,
- high_length: int = None, low_length: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ high_length: Int = None, low_length: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Gann HiLo Activator(HiLo)
diff --git a/pandas_ta/overlap/hl2.py b/pandas_ta/overlap/hl2.py
index 7809ded..9b4fbd7 100644
--- a/pandas_ta/overlap/hl2.py
+++ b/pandas_ta/overlap/hl2.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def hl2(
high: Series, low: Series,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""HL2
@@ -16,6 +17,12 @@ def hl2(
low (pd.Series): Series of 'low's
offset (int): How many periods to offset the result. Default: 0
+ Kwargs:
+ fillna (value, optional): pd.DataFrame.fillna(value). Only works if
+ result is offset.
+ fill_method (value, optional): Type of fill method. Only works if
+ result is offset.
+
Returns:
pd.Series: New feature generated.
"""
@@ -32,6 +39,12 @@ def hl2(
if offset != 0:
hl2 = hl2.shift(offset)
+ # Fill
+ if "fillna" in kwargs:
+ hl2.fillna(kwargs["fillna"], inplace=True)
+ if "fill_method" in kwargs:
+ hl2.fillna(method=kwargs["fill_method"], inplace=True)
+
# Name and Category
hl2.name = "HL2"
hl2.category = "overlap"
diff --git a/pandas_ta/overlap/hlc3.py b/pandas_ta/overlap/hlc3.py
index 598c670..9069ea9 100644
--- a/pandas_ta/overlap/hlc3.py
+++ b/pandas_ta/overlap/hlc3.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def hlc3(
high: Series, low: Series, close: Series, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""HLC3
@@ -18,6 +19,12 @@ def hlc3(
close (pd.Series): Series of 'close's
offset (int): How many periods to offset the result. Default: 0
+ Kwargs:
+ fillna (value, optional): pd.DataFrame.fillna(value). Only works if
+ result is offset.
+ fill_method (value, optional): Type of fill method. Only works if
+ result is offset.
+
Returns:
pd.Series: New feature generated.
"""
@@ -40,6 +47,12 @@ def hlc3(
if offset != 0:
hlc3 = hlc3.shift(offset)
+ # Fill
+ if "fillna" in kwargs:
+ hlc3.fillna(kwargs["fillna"], inplace=True)
+ if "fill_method" in kwargs:
+ hlc3.fillna(method=kwargs["fill_method"], inplace=True)
+
# Name and Category
hlc3.name = "HLC3"
hlc3.category = "overlap"
diff --git a/pandas_ta/overlap/hma.py b/pandas_ta/overlap/hma.py
index ddb57c0..880736c 100644
--- a/pandas_ta/overlap/hma.py
+++ b/pandas_ta/overlap/hma.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import sqrt
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
from .wma import wma
def hma(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Hull Moving Average (HMA)
diff --git a/pandas_ta/overlap/hwma.py b/pandas_ta/overlap/hwma.py
index 8c536d3..1c10b81 100644
--- a/pandas_ta/overlap/hwma.py
+++ b/pandas_ta/overlap/hwma.py
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def hwma(
- close: Series, na: float = None, nb: float = None, nc: float = None,
- offset: int = None, **kwargs
+ close: Series,
+ na: IntFloat = None, nb: IntFloat = None, nc: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""HWMA (Holt-Winter Moving Average)
diff --git a/pandas_ta/overlap/ichimoku.py b/pandas_ta/overlap/ichimoku.py
index 48362e5..5fd8638 100644
--- a/pandas_ta/overlap/ichimoku.py
+++ b/pandas_ta/overlap/ichimoku.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import date_range, DataFrame, RangeIndex, Timedelta, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
from .midprice import midprice
def ichimoku(
high: Series, low: Series, close: Series,
- tenkan: int = None, kijun: int = None, senkou: int = None,
+ tenkan: Int = None, kijun: Int = None, senkou: Int = None,
include_chikou: bool = True,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Ichimoku Kinkō Hyō (ichimoku)
diff --git a/pandas_ta/overlap/jma.py b/pandas_ta/overlap/jma.py
index 3dcb812..ba2dff9 100644
--- a/pandas_ta/overlap/jma.py
+++ b/pandas_ta/overlap/jma.py
@@ -3,12 +3,13 @@
from numpy import average, log, nan, sqrt, zeros_like
from numpy import power as np_power
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def jma(
- close: Series, length: int = None, phase: float = None,
- offset: int = None, **kwargs
+ close: Series, length: IntFloat = None, phase: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Jurik Moving Average Average (JMA)
diff --git a/pandas_ta/overlap/kama.py b/pandas_ta/overlap/kama.py
index 10c0d29..470b2c1 100644
--- a/pandas_ta/overlap/kama.py
+++ b/pandas_ta/overlap/kama.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def kama(
- close: Series, length: int = None, fast: int = None, slow: int = None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, fast: Int = None, slow: Int = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Kaufman's Adaptive Moving Average (KAMA)
diff --git a/pandas_ta/overlap/linreg.py b/pandas_ta/overlap/linreg.py
index 3d8a5a0..aafe391 100644
--- a/pandas_ta/overlap/linreg.py
+++ b/pandas_ta/overlap/linreg.py
@@ -2,13 +2,14 @@
from numpy import arctan, nan, pi, zeros_like
from numpy.version import version
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, strided_window, verify_series
def linreg(
- close: Series, length: int = None, talib: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Linear Regression Moving Average (linreg)
diff --git a/pandas_ta/overlap/mcgd.py b/pandas_ta/overlap/mcgd.py
index 674fd12..d273f5f 100644
--- a/pandas_ta/overlap/mcgd.py
+++ b/pandas_ta/overlap/mcgd.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def mcgd(
- close: Series, length: int = None, c: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, c: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""McGinley Dynamic Indicator
diff --git a/pandas_ta/overlap/midpoint.py b/pandas_ta/overlap/midpoint.py
index ac572d4..ee741cd 100644
--- a/pandas_ta/overlap/midpoint.py
+++ b/pandas_ta/overlap/midpoint.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def midpoint(
- close: Series, length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Midpoint
diff --git a/pandas_ta/overlap/midprice.py b/pandas_ta/overlap/midprice.py
index 827794c..312e949 100644
--- a/pandas_ta/overlap/midprice.py
+++ b/pandas_ta/overlap/midprice.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def midprice(
- high: Series, low: Series, length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Midprice
diff --git a/pandas_ta/overlap/ohlc4.py b/pandas_ta/overlap/ohlc4.py
index 64bea08..5db89c3 100644
--- a/pandas_ta/overlap/ohlc4.py
+++ b/pandas_ta/overlap/ohlc4.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def ohlc4(
open_: Series, high: Series, low: Series, close: Series,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""OHLC4
@@ -18,6 +19,12 @@ def ohlc4(
close (pd.Series): Series of 'close's
offset (int): How many periods to offset the result. Default: 0
+ Kwargs:
+ fillna (value, optional): pd.DataFrame.fillna(value). Only works if
+ result is offset.
+ fill_method (value, optional): Type of fill method. Only works if
+ result is offset.
+
Returns:
pd.Series: New feature generated.
"""
@@ -36,6 +43,12 @@ def ohlc4(
if offset != 0:
ohlc4 = ohlc4.shift(offset)
+ # Fill
+ if "fillna" in kwargs:
+ ohlc4.fillna(kwargs["fillna"], inplace=True)
+ if "fill_method" in kwargs:
+ ohlc4.fillna(method=kwargs["fill_method"], inplace=True)
+
# Name and Category
ohlc4.name = "OHLC4"
ohlc4.category = "overlap"
diff --git a/pandas_ta/overlap/pwma.py b/pandas_ta/overlap/pwma.py
index 2f95e07..4ae80df 100644
--- a/pandas_ta/overlap/pwma.py
+++ b/pandas_ta/overlap/pwma.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, pascals_triangle, verify_series, weights
def pwma(
- close: Series, length: int = None, asc: bool = None,
- offset: bool = None, **kwargs
+ close: Series, length: Int = None, asc: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Pascal's Weighted Moving Average (PWMA)
diff --git a/pandas_ta/overlap/rma.py b/pandas_ta/overlap/rma.py
index ceeed9a..b27be64 100644
--- a/pandas_ta/overlap/rma.py
+++ b/pandas_ta/overlap/rma.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def rma(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""wildeR's Moving Average (RMA)
diff --git a/pandas_ta/overlap/sinwma.py b/pandas_ta/overlap/sinwma.py
index aa8348a..24e77ab 100644
--- a/pandas_ta/overlap/sinwma.py
+++ b/pandas_ta/overlap/sinwma.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import pi, sin
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series, weights
def sinwma(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Sine Weighted Moving Average (SWMA)
diff --git a/pandas_ta/overlap/sma.py b/pandas_ta/overlap/sma.py
index 2d5a532..b59b5e5 100644
--- a/pandas_ta/overlap/sma.py
+++ b/pandas_ta/overlap/sma.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from numpy import convolve, ndarray, ones
from pandas import Series
+from pandas_ta._typing import Array, DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, np_prepend, verify_series
@@ -12,7 +13,7 @@ except ImportError:
@njit
-def np_sma(x: ndarray, n: int):
+def np_sma(x: Array, n: Int):
"""https://github.com/numba/numba/issues/4119"""
result = convolve(ones(n) / n, x)[n - 1:1 - n]
return np_prepend(result, n - 1)
@@ -32,9 +33,8 @@ def np_sma(x: ndarray, n: int):
def sma(
- close: Series, length: int = None,
- talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Simple Moving Average (SMA)
diff --git a/pandas_ta/overlap/smma.py b/pandas_ta/overlap/smma.py
index 9db5962..4ef66d8 100644
--- a/pandas_ta/overlap/smma.py
+++ b/pandas_ta/overlap/smma.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_offset, verify_series
def smma(
- close: Series, length: int = None,
+ close: Series, length: Int = None,
mamode: str = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""SMoothed Moving Average (SMMA)
diff --git a/pandas_ta/overlap/ssf.py b/pandas_ta/overlap/ssf.py
index c602f4b..ea85c52 100644
--- a/pandas_ta/overlap/ssf.py
+++ b/pandas_ta/overlap/ssf.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
-from numpy import copy, cos, exp, ndarray
+from numpy import copy, cos, exp
from pandas import Series
+from pandas_ta._typing import Array, DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
@@ -11,7 +12,7 @@ except ImportError:
@njit
-def np_ssf(x: ndarray, n: int, pi: float, sqrt2: float):
+def np_ssf(x: Array, n: Int, pi: IntFloat, sqrt2: IntFloat):
"""Ehler's Super Smoother Filter
http://traders.com/documentation/feedbk_docs/2014/01/traderstips.html
"""
@@ -28,7 +29,7 @@ def np_ssf(x: ndarray, n: int, pi: float, sqrt2: float):
@njit
-def np_ssf_everget(x: ndarray, n: int, pi: float, sqrt2: float):
+def np_ssf_everget(x: Array, n: Int, pi: IntFloat, sqrt2: IntFloat):
"""John F. Ehler's Super Smoother Filter by Everget (2 poles), Tradingview
https://www.tradingview.com/script/VdJy0yBJ-Ehlers-Super-Smoother-Filter/
"""
@@ -44,9 +45,9 @@ def np_ssf_everget(x: ndarray, n: int, pi: float, sqrt2: float):
def ssf(
- close: Series, length: int = None,
- everget: bool = None, pi: float = None, sqrt2: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ everget: bool = None, pi: IntFloat = None, sqrt2: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Ehler's Super Smoother Filter (SSF) © 2013
diff --git a/pandas_ta/overlap/ssf3.py b/pandas_ta/overlap/ssf3.py
index 2025932..5e82a40 100644
--- a/pandas_ta/overlap/ssf3.py
+++ b/pandas_ta/overlap/ssf3.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
-from numpy import copy, cos, exp, ndarray
+from numpy import copy, cos, exp
from pandas import Series
+from pandas_ta._typing import Array, DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
try:
@@ -10,7 +11,7 @@ except ImportError:
@njit
-def np_ssf3(x: ndarray, n: int, pi: float, sqrt3: float):
+def np_ssf3(x: Array, n: Int, pi: IntFloat, sqrt3: IntFloat):
"""John F. Ehler's Super Smoother Filter by Everget (3 poles), Tradingview
https://www.tradingview.com/script/VdJy0yBJ-Ehlers-Super-Smoother-Filter/"""
m, result = x.size, copy(x)
@@ -31,9 +32,9 @@ def np_ssf3(x: ndarray, n: int, pi: float, sqrt3: float):
def ssf3(
- close: Series, length: int = None,
- pi: float = None, sqrt3: float = None,
- offset=None, **kwargs
+ close: Series, length: Int = None,
+ pi: IntFloat = None, sqrt3: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
):
"""Ehler's 3 Pole Super Smoother Filter (SSF) © 2013
diff --git a/pandas_ta/overlap/supertrend.py b/pandas_ta/overlap/supertrend.py
index 95ee84d..b9f55b8 100644
--- a/pandas_ta/overlap/supertrend.py
+++ b/pandas_ta/overlap/supertrend.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import hl2
from pandas_ta.utils import get_offset, verify_series
from pandas_ta.volatility import atr
@@ -8,8 +9,8 @@ from pandas_ta.volatility import atr
def supertrend(
high: Series, low: Series, close: Series,
- length: int = None, multiplier: float = None,
- offset: int = None, **kwargs
+ length: Int = None, multiplier: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Supertrend (supertrend)
diff --git a/pandas_ta/overlap/swma.py b/pandas_ta/overlap/swma.py
index b16e030..2ad4d50 100644
--- a/pandas_ta/overlap/swma.py
+++ b/pandas_ta/overlap/swma.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, symmetric_triangle, verify_series, weights
def swma(
- close: Series, length: int = None, asc: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Symmetric Weighted Moving Average (SWMA)
@@ -20,7 +21,6 @@ def swma(
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
- asc (bool): Recent values weigh more. Default: True
offset (int): How many periods to offset the result. Default: 0
Kwargs:
diff --git a/pandas_ta/overlap/t3.py b/pandas_ta/overlap/t3.py
index 2d07a2f..4095734 100644
--- a/pandas_ta/overlap/t3.py
+++ b/pandas_ta/overlap/t3.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from .ema import ema
def t3(
- close: Series, length: int = None, a: float = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, a: IntFloat = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Tim Tillson's T3 Moving Average (T3)
diff --git a/pandas_ta/overlap/tema.py b/pandas_ta/overlap/tema.py
index 4c2d29d..723e42b 100644
--- a/pandas_ta/overlap/tema.py
+++ b/pandas_ta/overlap/tema.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from .ema import ema
def tema(
- close: Series, length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Triple Exponential Moving Average (TEMA)
diff --git a/pandas_ta/overlap/trima.py b/pandas_ta/overlap/trima.py
index 1bc7f2f..d7a81a0 100644
--- a/pandas_ta/overlap/trima.py
+++ b/pandas_ta/overlap/trima.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from .sma import sma
def trima(
- close: Series, length: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Triangular Moving Average (TRIMA)
diff --git a/pandas_ta/overlap/vidya.py b/pandas_ta/overlap/vidya.py
index 9b4ede6..200260f 100644
--- a/pandas_ta/overlap/vidya.py
+++ b/pandas_ta/overlap/vidya.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, verify_series
def vidya(
- close: Series, length: int = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Variable Index Dynamic Average (VIDYA)
diff --git a/pandas_ta/overlap/vwap.py b/pandas_ta/overlap/vwap.py
index a86a789..76ad22d 100644
--- a/pandas_ta/overlap/vwap.py
+++ b/pandas_ta/overlap/vwap.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, List
from pandas_ta.overlap import hlc3
from pandas_ta.utils import get_offset, is_datetime_ordered, verify_series
def vwap(
high: Series, low: Series, close: Series, volume: Series,
- anchor: str = None, bands: list = None,
- offset: int = None, **kwargs
+ anchor: str = None, bands: List = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Volume Weighted Average Price (VWAP)
diff --git a/pandas_ta/overlap/vwma.py b/pandas_ta/overlap/vwma.py
index 1057629..7384df1 100644
--- a/pandas_ta/overlap/vwma.py
+++ b/pandas_ta/overlap/vwma.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import sma
from pandas_ta.utils import get_offset, verify_series
def vwma(
- close: Series, volume: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, volume: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Volume Weighted Moving Average (VWMA)
diff --git a/pandas_ta/overlap/wcp.py b/pandas_ta/overlap/wcp.py
index d4cc775..e0c51f4 100644
--- a/pandas_ta/overlap/wcp.py
+++ b/pandas_ta/overlap/wcp.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def wcp(
high: Series, low: Series, close: Series, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Weighted Closing Price (WCP)
diff --git a/pandas_ta/overlap/wma.py b/pandas_ta/overlap/wma.py
index 961efcf..97c31a7 100644
--- a/pandas_ta/overlap/wma.py
+++ b/pandas_ta/overlap/wma.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import arange, dot
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def wma(
- close: Series, length: int = None,
+ close: Series, length: Int = None,
asc: bool = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Weighted Moving Average (WMA)
diff --git a/pandas_ta/overlap/zlma.py b/pandas_ta/overlap/zlma.py
index c636ba4..9e1c749 100644
--- a/pandas_ta/overlap/zlma.py
+++ b/pandas_ta/overlap/zlma.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
from .dema import dema
from .ema import ema
@@ -22,7 +23,7 @@ from .wma import wma
# Not ideal but it works. Submit a PR for a better solution. =)
# This design pattern is undesirable
-def _ma(mamode, **kwargs):
+def _ma(mamode: str, **kwargs: DictLike):
if mamode == "dema":
return dema(**kwargs)
elif mamode == "fwma":
@@ -58,9 +59,10 @@ def _ma(mamode, **kwargs):
else:
return ema(**kwargs)
+
def zlma(
- close: Series, length: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Zero Lag Moving Average (ZLMA)
diff --git a/pandas_ta/performance/drawdown.py b/pandas_ta/performance/drawdown.py
index 97a80f9..f76f840 100644
--- a/pandas_ta/performance/drawdown.py
+++ b/pandas_ta/performance/drawdown.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from numpy import log, seterr
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def drawdown(
- close: Series, offset: int = None, **kwargs
+ close: Series, offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Drawdown (DD)
diff --git a/pandas_ta/performance/log_return.py b/pandas_ta/performance/log_return.py
index 582f47f..8acdddc 100644
--- a/pandas_ta/performance/log_return.py
+++ b/pandas_ta/performance/log_return.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
from numpy import log, nan, roll
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def log_return(
- close: Series, length: int = None, cumulative: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, cumulative: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Log Return
diff --git a/pandas_ta/performance/percent_return.py b/pandas_ta/performance/percent_return.py
index cf5024f..99edc43 100644
--- a/pandas_ta/performance/percent_return.py
+++ b/pandas_ta/performance/percent_return.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import nan, roll
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def percent_return(
- close: Series, length: int = None, cumulative: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, cumulative: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Percent Return
diff --git a/pandas_ta/statistics/entropy.py b/pandas_ta/statistics/entropy.py
index a8960f7..5d95f85 100644
--- a/pandas_ta/statistics/entropy.py
+++ b/pandas_ta/statistics/entropy.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import log
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def entropy(
- close: Series, length: int = None, base: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, base: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Entropy (ENTP)
diff --git a/pandas_ta/statistics/kurtosis.py b/pandas_ta/statistics/kurtosis.py
index 7e12958..fbb856f 100644
--- a/pandas_ta/statistics/kurtosis.py
+++ b/pandas_ta/statistics/kurtosis.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def kurtosis(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Kurtosis
diff --git a/pandas_ta/statistics/mad.py b/pandas_ta/statistics/mad.py
index ada5899..ebb9368 100644
--- a/pandas_ta/statistics/mad.py
+++ b/pandas_ta/statistics/mad.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import fabs
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def mad(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Mean Absolute Deviation
diff --git a/pandas_ta/statistics/median.py b/pandas_ta/statistics/median.py
index dc79b9e..2f45ab6 100644
--- a/pandas_ta/statistics/median.py
+++ b/pandas_ta/statistics/median.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def median(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Median
diff --git a/pandas_ta/statistics/quantile.py b/pandas_ta/statistics/quantile.py
index 8a9478b..4d158e2 100644
--- a/pandas_ta/statistics/quantile.py
+++ b/pandas_ta/statistics/quantile.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def quantile(
- close: Series, length: int = None, q: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, q: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Quantile
diff --git a/pandas_ta/statistics/skew.py b/pandas_ta/statistics/skew.py
index b226a04..934f36d 100644
--- a/pandas_ta/statistics/skew.py
+++ b/pandas_ta/statistics/skew.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def skew(
- close: Series, length: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Skew
diff --git a/pandas_ta/statistics/stdev.py b/pandas_ta/statistics/stdev.py
index dd3889a..392dcf5 100644
--- a/pandas_ta/statistics/stdev.py
+++ b/pandas_ta/statistics/stdev.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from numpy import sqrt
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from .variance import variance
def stdev(
- close: Series, length: int = None,
- ddof: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ ddof: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Standard Deviation
diff --git a/pandas_ta/statistics/tos_stdevall.py b/pandas_ta/statistics/tos_stdevall.py
index 63d5274..b5c5ebc 100644
--- a/pandas_ta/statistics/tos_stdevall.py
+++ b/pandas_ta/statistics/tos_stdevall.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import arange, array, polyfit, std
from pandas import DataFrame, DatetimeIndex, Series
+from pandas_ta._typing import DictLike, Int, List
from pandas_ta.utils import get_offset, verify_series
def tos_stdevall(
- close: Series, length: int = None,
- stds: list = None, ddof: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ stds: List = None, ddof: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""TD Ameritrade's Think or Swim Standard Deviation All (TOS_STDEV)
diff --git a/pandas_ta/statistics/variance.py b/pandas_ta/statistics/variance.py
index 0c5d134..4603efa 100644
--- a/pandas_ta/statistics/variance.py
+++ b/pandas_ta/statistics/variance.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
def variance(
- close: Series, length: int = None,
- ddof: int = None, talib: bool = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ ddof: Int = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Variance
diff --git a/pandas_ta/statistics/zscore.py b/pandas_ta/statistics/zscore.py
index b6dbc89..6d69f86 100644
--- a/pandas_ta/statistics/zscore.py
+++ b/pandas_ta/statistics/zscore.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import sma
from pandas_ta.statistics import stdev
from pandas_ta.utils import get_offset, verify_series
def zscore(
- close: Series, length: int = None, std: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, std: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Rolling Z Score
diff --git a/pandas_ta/transform/cube.py b/pandas_ta/transform/cube.py
index 9444afe..68d6f2d 100644
--- a/pandas_ta/transform/cube.py
+++ b/pandas_ta/transform/cube.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def cube(
- close: Series, cubing_exponent: float = None, signal_offset: int = None,
- offset: int = None, **kwargs
+ close: Series, exp: IntFloat = None, signal_offset: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""
Indicator: Cube Transform
@@ -19,13 +20,15 @@ def cube(
removed (i.e. roofing filter).
Sources:
- Book: Cycle Analytics for Traders, 2014, written by John Ehlers, page 200
- Implemented by rengel8 for Pandas TA based on code of Markus K. (cryptocoinserver)
+ Book: Cycle Analytics for Traders, 2014, written by John Ehlers
+ page 200
+ Implemented by rengel8 for Pandas TA based on code of
+ Markus K. (cryptocoinserver)
Args:
close (pd.Series): Series of 'close's
- cubing_exponent (float): Use this exponent 'wisely' to increase the
- impact of the soft limiter. Default: 3
+ exp (float): Use this exponent 'wisely' to increase the impact of the
+ soft limiter. Default: 3
signal_offset (int): Offset the signal line. Default: -1
offset (int): How many periods to offset the result. Default: 0
@@ -38,12 +41,12 @@ def cube(
"""
# Validate
close = verify_series(close)
- cubing_exponent = float(cubing_exponent) if cubing_exponent and cubing_exponent >= 3.0 else 3.0
- signal_offset = int(signal_offset) if signal_offset and signal_offset > 0 else 1
+ exp = float(exp) if exp and exp >= 3.0 else 3.0
+ signal_offset = int(signal_offset) if signal_offset and signal_offset > 0 else -1
offset = get_offset(offset)
# Calculate
- result = close ** cubing_exponent
+ result = close ** exp
ct = Series(result, index=close.index)
ct_signal = Series(result, index=close.index)
@@ -64,7 +67,7 @@ def cube(
ct_signal.fillna(method=kwargs["fill_method"], inplace=True)
# Name and Category
- _props = f"_{cubing_exponent}_{signal_offset}"
+ _props = f"_{exp}_{signal_offset}"
ct.name = f"CUBE{_props}"
ct_signal.name = f"CUBEs{_props}"
ct.category = ct_signal.category = "transform"
diff --git a/pandas_ta/transform/ifisher.py b/pandas_ta/transform/ifisher.py
index 499dd45..ffd71dc 100644
--- a/pandas_ta/transform/ifisher.py
+++ b/pandas_ta/transform/ifisher.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import exp, logical_and, max, min
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
from .remap import remap
def ifisher(
close: Series,
- amp: float = None, signal_offset: int = None,
- offset: int = None, **kwargs
+ amp: IntFloat = None, signal_offset: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""
Indicator: Inverse Fisher Transform
@@ -29,8 +30,10 @@ def ifisher(
Sources:
https://www.mesasoftware.com/papers/TheInverseFisherTransform.pdf,
- Book: Cycle Analytics for Traders, 2014, written by John Ehlers, page 198
- Implemented by rengel8 for Pandas TA based on code of Markus K. (cryptocoinserver)
+ Book: Cycle Analytics for Traders, 2014, written by John Ehlers,
+ page 198
+ Implemented by rengel8 for Pandas TA based on code of
+ Markus K. (cryptocoinserver)
Args:
close (pd.Series): Series of 'close's
diff --git a/pandas_ta/transform/remap.py b/pandas_ta/transform/remap.py
index d334092..420bf44 100644
--- a/pandas_ta/transform/remap.py
+++ b/pandas_ta/transform/remap.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def remap(
- close: Series, from_min: float = None, from_max: float = None,
- to_min: float = None, to_max: float = None,
- offset: int = None, **kwargs
+ close: Series, from_min: IntFloat = None, from_max: IntFloat = None,
+ to_min: IntFloat = None, to_max: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""
Indicator: ReMap (REMAP)
diff --git a/pandas_ta/trend/adx.py b/pandas_ta/trend/adx.py
index 1636da0..2264192 100644
--- a/pandas_ta/trend/adx.py
+++ b/pandas_ta/trend/adx.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.utils import get_drift, get_offset, verify_series, zero
from pandas_ta.volatility import atr
@@ -7,9 +8,9 @@ from pandas_ta.volatility import atr
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
+ length: Int = None, lensig: Int = None, scalar: IntFloat = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Average Directional Movement (ADX)
diff --git a/pandas_ta/trend/amat.py b/pandas_ta/trend/amat.py
index 93b04a1..205e0c8 100644
--- a/pandas_ta/trend/amat.py
+++ b/pandas_ta/trend/amat.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.utils import get_offset, verify_series
from .long_run import long_run
@@ -7,9 +8,9 @@ from .short_run import short_run
def amat(
- close: Series, fast: int = None, slow: int = None,
- lookback: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ close: Series, fast: Int = None, slow: Int = None,
+ lookback: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Archer Moving Averages Trends (AMAT)
diff --git a/pandas_ta/trend/aroon.py b/pandas_ta/trend/aroon.py
index e8e5e4b..8987fdf 100644
--- a/pandas_ta/trend/aroon.py
+++ b/pandas_ta/trend/aroon.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, verify_series
from pandas_ta.utils import recent_maximum_index, recent_minimum_index
@@ -7,8 +8,8 @@ from pandas_ta.utils import recent_maximum_index, recent_minimum_index
def aroon(
high: Series, low: Series,
- length: int = None, scalar: float = None, talib: bool = None,
- offset: int = None, **kwargs
+ length: Int = None, scalar: IntFloat = None, talib: bool = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Aroon & Aroon Oscillator (AROON)
diff --git a/pandas_ta/trend/chop.py b/pandas_ta/trend/chop.py
index 35aee0f..5b65534 100644
--- a/pandas_ta/trend/chop.py
+++ b/pandas_ta/trend/chop.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from numpy import log, log10
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_drift, get_offset, verify_series
from pandas_ta.volatility import atr
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
+ length: Int = None, atr_length: Int = None,
+ ln: bool = None, scalar: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Choppiness Index (CHOP)
diff --git a/pandas_ta/trend/cksp.py b/pandas_ta/trend/cksp.py
index ab1f9fd..f2d72ef 100644
--- a/pandas_ta/trend/cksp.py
+++ b/pandas_ta/trend/cksp.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
from pandas_ta.volatility import atr
def cksp(
high: Series, low: Series, close: Series,
- p: int = None, x: float = None, q: int = None,
+ p: Int = None, x: IntFloat = None, q: Int = None,
tvmode: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Chande Kroll Stop (CKSP)
diff --git a/pandas_ta/trend/decay.py b/pandas_ta/trend/decay.py
index c7d666a..f9c7321 100644
--- a/pandas_ta/trend/decay.py
+++ b/pandas_ta/trend/decay.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from numpy import exp
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def decay(
- close: Series, kind=None, length: int = None, mode: str = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, mode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Decay
@@ -41,7 +42,7 @@ def decay(
# Calculate
_mode = "L"
- if mode == "exp" or kind == "exponential":
+ if mode in ["exp", "exponential"]:
_mode = "EXP"
diff = close.shift(1) - exp(-length)
else: # "linear"
diff --git a/pandas_ta/trend/decreasing.py b/pandas_ta/trend/decreasing.py
index aa62597..ae67e78 100644
--- a/pandas_ta/trend/decreasing.py
+++ b/pandas_ta/trend/decreasing.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_drift, get_offset, is_percent, verify_series
def decreasing(
- close: Series, length: int = None, strict: bool = None,
- asint: bool = None, percent: float = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, strict: bool = None,
+ asint: bool = None, percent: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Decreasing
diff --git a/pandas_ta/trend/dpo.py b/pandas_ta/trend/dpo.py
index 92b7442..7fb9e44 100644
--- a/pandas_ta/trend/dpo.py
+++ b/pandas_ta/trend/dpo.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import sma
from pandas_ta.utils import get_offset, verify_series
def dpo(
- close: Series, length: int = None, centered: bool = True,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, centered: bool = True,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Detrend Price Oscillator (DPO)
diff --git a/pandas_ta/trend/increasing.py b/pandas_ta/trend/increasing.py
index add9e83..2572d1f 100644
--- a/pandas_ta/trend/increasing.py
+++ b/pandas_ta/trend/increasing.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_drift, get_offset, is_percent, verify_series
def increasing(
- close: Series, length: int = None, strict: bool = None,
- asint: bool = None, percent: float = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, strict: bool = None,
+ asint: bool = None, percent: IntFloat = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Increasing
diff --git a/pandas_ta/trend/long_run.py b/pandas_ta/trend/long_run.py
index fce303b..b51d8bf 100644
--- a/pandas_ta/trend/long_run.py
+++ b/pandas_ta/trend/long_run.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
from .decreasing import decreasing
from .increasing import increasing
def long_run(
- fast: Series, slow: Series, length: int = None,
- offset: int = None, **kwargs
+ fast: Series, slow: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Long Run
diff --git a/pandas_ta/trend/psar.py b/pandas_ta/trend/psar.py
index 24a5591..cf29716 100644
--- a/pandas_ta/trend/psar.py
+++ b/pandas_ta/trend/psar.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series, zero
def psar(
high: Series, low: Series, close: Series = None,
- af0: float = None, af: float = None, max_af: float = None,
- offset: int = None, **kwargs
+ af0: IntFloat = None, af: IntFloat = None, max_af: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Parabolic Stop and Reverse (psar)
diff --git a/pandas_ta/trend/qstick.py b/pandas_ta/trend/qstick.py
index 542f3dc..df539ae 100644
--- a/pandas_ta/trend/qstick.py
+++ b/pandas_ta/trend/qstick.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import dema, ema, hma, rma, sma
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def qstick(
- open_: Series, close: Series, length: int = None,
- offset: int = None, **kwargs
+ open_: Series, close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Q Stick
diff --git a/pandas_ta/trend/short_run.py b/pandas_ta/trend/short_run.py
index eb9cf23..eb3e7ce 100644
--- a/pandas_ta/trend/short_run.py
+++ b/pandas_ta/trend/short_run.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
from .decreasing import decreasing
from .increasing import increasing
def short_run(
- fast: Series, slow: Series, length: int = None,
- offset: int = None, **kwargs
+ fast: Series, slow: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Short Run
diff --git a/pandas_ta/trend/trendflex.py b/pandas_ta/trend/trendflex.py
index c56fc98..e364151 100644
--- a/pandas_ta/trend/trendflex.py
+++ b/pandas_ta/trend/trendflex.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
-from numpy import cos, exp, nan, ndarray, sqrt, zeros_like
+from numpy import cos, exp, nan, sqrt, zeros_like
from pandas import Series
+from pandas_ta._typing import Array, DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
@@ -12,7 +13,7 @@ except ImportError:
@njit
def np_trendflex(
- x: ndarray, n: int, k: int, alpha: float, pi: float, sqrt2: float
+ x: Array, n: Int, k: Int, alpha: IntFloat, pi: IntFloat, sqrt2: IntFloat
):
"""Ehler's Trendflex
http://traders.com/Documentation/FEEDbk_docs/2020/02/TradersTips.html"""
@@ -42,10 +43,10 @@ def np_trendflex(
def trendflex(
- close: Series, length: int = None,
- smooth: int = None, alpha: float = None,
- pi: float = None, sqrt2: float = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None,
+ smooth: Int = None, alpha: IntFloat = None,
+ pi: IntFloat = None, sqrt2: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Trendflex (TRENDFLEX)
diff --git a/pandas_ta/trend/tsignals.py b/pandas_ta/trend/tsignals.py
index 320108d..e449a6c 100644
--- a/pandas_ta/trend/tsignals.py
+++ b/pandas_ta/trend/tsignals.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, verify_series
def tsignals(
trend: Series, asbool: bool = None,
- trend_reset=0, trade_offset=None, drift: int = None,
- offset: int = None, **kwargs
+ trend_reset: Int = None, trade_offset: Int = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Trend Signals
diff --git a/pandas_ta/trend/ttm_trend.py b/pandas_ta/trend/ttm_trend.py
index 6c69f30..df975e3 100644
--- a/pandas_ta/trend/ttm_trend.py
+++ b/pandas_ta/trend/ttm_trend.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import hl2
from pandas_ta.utils import get_offset, verify_series
def ttm_trend(
- high: Series, low: Series, close: Series, length: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, close: Series, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""TTM Trend (TTM_TRND)
diff --git a/pandas_ta/trend/vhf.py b/pandas_ta/trend/vhf.py
index 78a6ee1..80748d9 100644
--- a/pandas_ta/trend/vhf.py
+++ b/pandas_ta/trend/vhf.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
-from numpy import fabs, nan
+from numpy import fabs
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def vhf(
- close: Series, length: int = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Vertical Horizontal Filter (VHF)
diff --git a/pandas_ta/trend/vortex.py b/pandas_ta/trend/vortex.py
index eb1cdaf..b24580a 100644
--- a/pandas_ta/trend/vortex.py
+++ b/pandas_ta/trend/vortex.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, verify_series
from pandas_ta.volatility import true_range
def vortex(
high: Series, low: Series, close: Series,
- length: int = None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Vortex
diff --git a/pandas_ta/trend/xsignals.py b/pandas_ta/trend/xsignals.py
index 5b8c5d7..462eea9 100644
--- a/pandas_ta/trend/xsignals.py
+++ b/pandas_ta/trend/xsignals.py
@@ -1,24 +1,24 @@
# -*- coding: utf-8 -*-
-from typing import Union
from numpy import nan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat, Union
from pandas_ta.trend import tsignals
from pandas_ta.utils import cross_value, get_offset, verify_series
def xsignals(
signal: Series,
- xa: Union[int, float, Series],
- xb: Union[int, float, Series],
+ xa: Union[IntFloat, Series],
+ xb: Union[IntFloat, Series],
above: bool = True, long: bool = True, asbool: bool = None,
- trend_reset: int = 0, trade_offset: int = None,
- offset: int = None, **kwargs
+ trend_reset: Int = 0, trade_offset: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Cross Signals (XSIGNALS)
- Cross Signals returns Trend Signal (TSIGNALS) results for Signal Crossings. This
- is useful for indicators like RSI, ZSCORE, et al where one wants trade Entries
- and Exits (and Trends).
+ Cross Signals returns Trend Signal (TSIGNALS) results for Signal
+ Crossings. This is useful for indicators like RSI, ZSCORE, et al where
+ one wants trade Entries and Exits (and Trends).
Cross Signals has two kinds of modes: above and long.
diff --git a/pandas_ta/utils/_core.py b/pandas_ta/utils/_core.py
index ebb5031..ab656de 100644
--- a/pandas_ta/utils/_core.py
+++ b/pandas_ta/utils/_core.py
@@ -4,12 +4,12 @@ from contextlib import redirect_stdout
from io import StringIO
from pathlib import Path
from sys import float_info as sflt
-from typing import Union
from numpy import argmax, argmin
from pandas import DataFrame, Series
from pandas.api.types import is_datetime64_any_dtype
+from pandas_ta._typing import Int, IntFloat, ListStr, SeriesFrame, Union
from pandas_ta.maps import Imports
@@ -28,17 +28,17 @@ def category_files(category: str) -> list:
return files
-def get_drift(x: int) -> int:
- """Returns an int if not zero, otherwise defaults to one."""
+def get_drift(x: Int) -> Int:
+ """Returns an Int if not zero, otherwise defaults to one."""
return int(x) if isinstance(x, int) and x != 0 else 1
-def get_offset(x: int) -> int:
- """Returns an int, otherwise defaults to zero."""
+def get_offset(x: Int) -> Int:
+ """Returns an Int, otherwise defaults to zero."""
return int(x) if isinstance(x, int) else 0
-def is_datetime_ordered(df: Union[DataFrame, Series]) -> bool:
+def is_datetime_ordered(df: SeriesFrame) -> bool:
"""Returns True if the index is a datetime and ordered."""
index_is_datetime = is_datetime64_any_dtype(df.index)
try:
@@ -49,7 +49,7 @@ def is_datetime_ordered(df: Union[DataFrame, Series]) -> bool:
return True if index_is_datetime and ordered else False
-def is_percent(x: int or float) -> bool:
+def is_percent(x: IntFloat) -> bool:
if isinstance(x, (int, float)):
return x is not None and 0 <= x <= 100
return False
@@ -64,21 +64,21 @@ def non_zero_range(high: Series, low: Series) -> Series:
return diff
-def recent_maximum_index(x) -> int:
+def recent_maximum_index(x) -> Int:
return int(argmax(x[::-1]))
-def recent_minimum_index(x) -> int:
+def recent_minimum_index(x) -> Int:
return int(argmin(x[::-1]))
-def rma_pandas(series: Series, length: int):
+def rma_pandas(series: Series, length: Int):
series = verify_series(series)
alpha = (1.0 / length) if length > 0 else 0.5
return series.ewm(alpha=alpha, min_periods=length).mean()
-def signed_series(series: Series, initial: int, lag: int = None) -> Series:
+def signed_series(series: Series, initial: Int, lag: Int = None) -> Series:
"""Returns a Signed Series with or without an initial value
Default Example:
@@ -97,12 +97,12 @@ def signed_series(series: Series, initial: int, lag: int = None) -> Series:
return sign
-def simplify_columns(df, n=3):
+def simplify_columns(df, n: Int=3) -> ListStr:
df.columns = df.columns.str.lower()
return [c.split("_")[0][n - 1:n] for c in df.columns]
-def tal_ma(name: str) -> int:
+def tal_ma(name: str) -> Int:
"""Helper Function that returns the Enum value for TA Lib's MA Type"""
if Imports["talib"] and isinstance(name, str) and len(name) > 1:
from talib import MA_Type
@@ -128,7 +128,7 @@ def tal_ma(name: str) -> int:
return 0 # Default: SMA -> 0
-def unsigned_differences(series: Series, amount: int = None,
+def unsigned_differences(series: Series, amount: Int = None,
**kwargs) -> Union[Series, Series]:
"""Unsigned Differences
Returns two Series, an unsigned positive and unsigned negative series based
@@ -158,7 +158,7 @@ def unsigned_differences(series: Series, amount: int = None,
return positive, negative
-def verify_series(series: Series, min_length: int = None) -> Series:
+def verify_series(series: Series, min_length: Int = None) -> Series:
"""If a Pandas Series and it meets the min_length of the indicator return it."""
has_length = min_length is not None and isinstance(min_length, int)
if series is not None and isinstance(series, Series):
@@ -166,11 +166,34 @@ def verify_series(series: Series, min_length: int = None) -> Series:
def performance(df: DataFrame,
- excluded: list = None, top: int = None, talib: bool = False,
+ excluded: ListStr = None, top: Int = None, talib: bool = False,
ascending: bool = False, sortby: str = "secs",
- gradient: int = False, places: int = 5, stats: bool = False,
+ gradient: bool = False, places: Int = 5, stats: bool = False,
verbose: bool = False
) -> DataFrame:
+ """performance
+
+ Calculates the individual performance time for some DataFrame.
+
+ Args:
+ df (pd.DataFrame): DataFrame with ohlcv columns
+ excluded (list): List of indicators to exclude. Default: None
+ top (Int): Return a DataFrame the 'top' values. Default: None
+ talib (bool): Enable TA Lib. Default: False
+ ascending (bool): Ascending Order. Default: False
+ sortby (str): Options: "ms", "secs". Default: "secs"
+ gradient (bool): Returns a DataFrame the 'top' values with gradient
+ styling. Default: False
+ places (Int): Decimal places. Default: 5
+ stats (bool): Returns a Tuple of two DataFrames. The second tuple
+ contains Stats on the performance time. Default: False
+ verbose (bool): Default: False
+
+ Returns:
+ pd.DataFrame: if stats is False
+ (pd.DataFrame, pd.DataFrame): if stats is True
+
+ """
if df.empty: return
talib = bool(talib) if isinstance(talib, bool) and talib else False
top = int(top) if isinstance(top, int) and top > 0 else None
@@ -183,7 +206,7 @@ def performance(df: DataFrame,
indicators = df.ta.indicators(as_list=True, exclude=_ex)
if len(indicators) == 0: return None
- def ms2secs(ms, p: int):
+ def ms2secs(ms, p: Int):
return round(0.001 * ms, p)
def indicator_time(
diff --git a/pandas_ta/utils/_math.py b/pandas_ta/utils/_math.py
index 8e223e2..034e10b 100644
--- a/pandas_ta/utils/_math.py
+++ b/pandas_ta/utils/_math.py
@@ -3,21 +3,24 @@ from functools import reduce
from math import floor as mfloor
from operator import mul
from sys import float_info as sflt
-from typing import List, Optional, Union
from numpy import all, append, array, corrcoef, dot, exp, fabs
from numpy import log, nan, ndarray, ones, seterr, sqrt, sum, triu
from pandas import DataFrame, Series
+
+from pandas_ta._typing import Array, DictLike, Float, Int, IntFloat, List, Optional
from pandas_ta.maps import Imports
from pandas_ta.utils._core import verify_series
-def combination(**kwargs) -> int:
+def combination(
+ n: Int = 1, r: Int = 0,
+ repetition: bool = False, multichoose: bool = False
+) -> Int:
"""https://stackoverflow.com/questions/4941753/is-there-a-math-ncr-function-in-python"""
- n = int(fabs(kwargs.pop("n", 1)))
- r = int(fabs(kwargs.pop("r", 0)))
+ n, r = int(fabs(n)), int(fabs(r))
- if kwargs.pop("repetition", False) or kwargs.pop("multichoose", False):
+ if repetition or multichoose:
n = n + r - 1
# if r < 0: return None
@@ -30,7 +33,7 @@ def combination(**kwargs) -> int:
return numerator // denominator
-def erf(x: Union[int, float]):
+def erf(x: IntFloat) -> Float:
"""Error Function erf(x)
The algorithm comes from Handbook of Mathematical Functions, formula 7.1.26.
Source: https://stackoverflow.com/questions/457408/is-there-an-easily-available-implementation-of-erf-for-python
@@ -54,11 +57,12 @@ def erf(x: Union[int, float]):
return sign * y # erf(-x) = -erf(x)
-def fibonacci(n: int = 2, **kwargs: dict) -> ndarray:
+def fibonacci(
+ n: Int = 2, weighted: bool = False, zero: bool = False
+) -> Array:
"""Fibonacci Sequence as a numpy array"""
n = int(fabs(n)) if n >= 0 else 2
- zero = kwargs.pop("zero", False)
if zero:
a, b = 0, 1
else:
@@ -70,7 +74,6 @@ def fibonacci(n: int = 2, **kwargs: dict) -> ndarray:
a, b = b, a + b
result = append(result, a)
- weighted = kwargs.pop("weighted", False)
if weighted:
fib_sum = sum(result)
if fib_sum > 0:
@@ -81,7 +84,7 @@ def fibonacci(n: int = 2, **kwargs: dict) -> ndarray:
return result
-def geometric_mean(series: Series) -> float:
+def geometric_mean(series: Series) -> Float:
"""Returns the Geometric Mean for a Series of positive values."""
n = series.size
if n < 1:
@@ -96,7 +99,7 @@ def geometric_mean(series: Series) -> float:
return 0
-def hpoly(c: ndarray, x: Union[int, float]) -> float:
+def hpoly(c: Array, x: IntFloat) -> Float:
"""Horner Calculation for Polynomial Evaluation (hpoly)
array: np.array of polynomial coefficients
@@ -123,7 +126,7 @@ def hpoly(c: ndarray, x: Union[int, float]) -> float:
return y
-def linear_regression(x: Series, y: Series) -> dict:
+def linear_regression(x: Series, y: Series) -> DictLike:
"""Classic Linear Regression in Numpy or Scikit-Learn"""
x, y = verify_series(x), verify_series(y)
m, n = x.size, y.size
@@ -138,7 +141,7 @@ def linear_regression(x: Series, y: Series) -> dict:
return _linear_regression_np(x, y)
-def log_geometric_mean(series: Series) -> float:
+def log_geometric_mean(series: Series) -> Float:
"""Returns the Logarithmic Geometric Mean"""
n = series.size
if n < 2:
@@ -150,7 +153,9 @@ def log_geometric_mean(series: Series) -> float:
return 0
-def pascals_triangle(n: int = None, **kwargs: dict) -> ndarray:
+def pascals_triangle(
+ n: Int = None, inverse: bool = False, weighted: bool = False
+) -> Array:
"""Pascal's Triangle
Returns a numpy array of the nth row of Pascal's Triangle.
@@ -166,8 +171,6 @@ def pascals_triangle(n: int = None, **kwargs: dict) -> ndarray:
triangle_weights = triangle / triangle_sum
inverse_weights = 1 - triangle_weights
- weighted = kwargs.pop("weighted", False)
- inverse = kwargs.pop("inverse", False)
if weighted and inverse:
return inverse_weights
if weighted:
@@ -178,7 +181,7 @@ def pascals_triangle(n: int = None, **kwargs: dict) -> ndarray:
return triangle
-def strided_window(array, length: int):
+def strided_window(array: Array, length: Int) -> Array:
"""as_strided
creates a view into the array given the exact strides and shape.
* Recommended to avoid when possible.
@@ -192,7 +195,9 @@ def strided_window(array, length: int):
return as_strided(array, shape=shape, strides=strides, writeable=False)
-def symmetric_triangle(n: int = None, **kwargs: dict) -> Optional[List[int]]:
+def symmetric_triangle(
+ n: Int = None, weighted: bool = False
+) -> Optional[List[int]]:
"""Symmetric Triangle with n >= 2
Returns a numpy array of the nth row of Symmetric Triangle.
@@ -215,20 +220,20 @@ def symmetric_triangle(n: int = None, **kwargs: dict) -> Optional[List[int]]:
front.pop()
triangle += front[::-1]
- if kwargs.pop("weighted", False) and isinstance(triangle, list):
+ if weighted and isinstance(triangle, list):
return triangle / sum(triangle)
return triangle
-def weights(w: ndarray):
+def weights(w: Array):
"""Calculates the dot product of weights with values x"""
def _dot(x):
return dot(w, x)
return _dot
-def zero(x: Union[int, float]) -> Union[int, float]:
+def zero(x: IntFloat) -> IntFloat:
"""If the value is close to zero, then return zero.
Otherwise return itself."""
return 0 if abs(x) < sflt.epsilon else x
@@ -237,28 +242,33 @@ def zero(x: Union[int, float]) -> Union[int, float]:
# TESTING
-def df_error_analysis(dfA: DataFrame, dfB: DataFrame, **kwargs) -> DataFrame:
+def df_error_analysis(
+ A: DataFrame, B: DataFrame,
+ plot: bool = False, triangular: bool = False,
+ method: str = "pearson",
+) -> DataFrame:
"""DataFrame Correlation Analysis helper"""
- corr_method = kwargs.pop("corr_method", "pearson")
+ _r_method = ["pearson", "kendall", "spearman"]
+ corr_method = method if method in _r_method else _r_method[0]
# Find their differences and correlation
- diff = dfA - dfB
- corr = dfA.corr(dfB, method=corr_method)
+ diff = A - B
+ result = A.corr(B, method=corr_method)
# For plotting
- if kwargs.pop("plot", False):
+ if plot:
diff.hist()
if diff[diff > 0].any():
diff.plot(kind="kde")
- if kwargs.pop("triangular", False):
- return corr.where(triu(ones(corr.shape)).astype(bool))
+ if triangular:
+ return result.where(triu(ones(result.shape)).astype(bool))
- return corr
+ return result
# PRIVATE
-def _linear_regression_np(x: Series, y: Series) -> dict:
+def _linear_regression_np(x: Series, y: Series) -> DictLike:
"""Simple Linear Regression in Numpy
for two 1d arrays for environments without the sklearn package."""
result = {"a": nan, "b": nan, "r": nan, "t": nan, "line": nan}
@@ -287,7 +297,7 @@ def _linear_regression_np(x: Series, y: Series) -> dict:
return result
-def _linear_regression_sklearn(x: Series, y: Series) -> dict:
+def _linear_regression_sklearn(x: Series, y: Series) -> DictLike:
"""Simple Linear Regression in Scikit Learn for two 1d arrays for
environments with the sklearn package."""
from sklearn.linear_model import LinearRegression
diff --git a/pandas_ta/utils/_metrics.py b/pandas_ta/utils/_metrics.py
index b21d9ca..850d20a 100644
--- a/pandas_ta/utils/_metrics.py
+++ b/pandas_ta/utils/_metrics.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
-from typing import Union
-
from numpy import log, nan, sqrt
from pandas import Series, Timedelta
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import RATE
from pandas_ta.performance import drawdown, log_return, percent_return
from pandas_ta.utils._core import verify_series
@@ -11,7 +10,7 @@ from pandas_ta.utils._math import linear_regression, log_geometric_mean
from pandas_ta.utils._time import total_time
-def cagr(close: Series) -> float:
+def cagr(close: Series) -> IntFloat:
"""Compounded Annual Growth Rate
Args:
@@ -25,8 +24,8 @@ def cagr(close: Series) -> float:
def calmar_ratio(
- close: Series, method: str = "percent", years: int = 3
-) -> float:
+ close: Series, method: str = "percent", years: Int = 3
+) -> IntFloat:
"""The Calmar Ratio is the percent Max Drawdown Ratio 'typically' over
the past three years.
@@ -50,8 +49,8 @@ def calmar_ratio(
def downside_deviation(
- returns: Series, benchmark_rate: float = 0.0, tf: str = "years"
-) -> float:
+ returns: Series, benchmark_rate: IntFloat = 0.0, tf: str = "years"
+) -> IntFloat:
"""Downside Deviation for the Sortino ratio.
Benchmark rate is assumed to be annualized. Adjusted according for the
number of periods per year seen in the data.
@@ -76,7 +75,7 @@ def downside_deviation(
return downside_deviation * sqrt(days_per_year)
-def jensens_alpha(returns: Series, benchmark_returns: Series) -> float:
+def jensens_alpha(returns: Series, benchmark_returns: Series) -> IntFloat:
"""Jensen's 'Alpha' of a series and a benchmark.
Args:
@@ -92,7 +91,7 @@ def jensens_alpha(returns: Series, benchmark_returns: Series) -> float:
return linear_regression(benchmark_returns, returns)["a"]
-def log_max_drawdown(close: Series) -> float:
+def log_max_drawdown(close: Series) -> IntFloat:
"""Log Max Drawdown of a series.
Args:
@@ -107,7 +106,7 @@ def log_max_drawdown(close: Series) -> float:
def max_drawdown(
close: Series, method: str = None, all: bool = False
-) -> float:
+) -> IntFloat:
"""Maximum Drawdown from close. Default: 'dollar'.
Args:
@@ -136,10 +135,10 @@ def max_drawdown(
def optimal_leverage(
- close: Series, benchmark_rate: float = 0.0,
- period: Union[float, int] = RATE["TRADING_DAYS_PER_YEAR"],
- log: bool = False, capital: float = 1., **kwargs
-) -> float:
+ close: Series, benchmark_rate: IntFloat = 0.0,
+ period: IntFloat = RATE["TRADING_DAYS_PER_YEAR"],
+ log: bool = False, capital: IntFloat = 1., **kwargs: DictLike
+) -> IntFloat:
"""Optimal Leverage of a series. NOTE: Incomplete. Do NOT use.
Args:
@@ -172,7 +171,7 @@ def optimal_leverage(
return amount
-def pure_profit_score(close: Series) -> Union[float, int]:
+def pure_profit_score(close: Series) -> IntFloat:
"""Pure Profit Score of a series.
Args:
@@ -190,9 +189,9 @@ def pure_profit_score(close: Series) -> Union[float, int]:
def sharpe_ratio(
- close: Series, benchmark_rate: float = 0.0, log: bool = False,
- use_cagr: bool = False, period: int = RATE["TRADING_DAYS_PER_YEAR"]
-) -> float:
+ close: Series, benchmark_rate: IntFloat = 0.0, log: bool = False,
+ use_cagr: bool = False, period: IntFloat = RATE["TRADING_DAYS_PER_YEAR"]
+) -> IntFloat:
"""Sharpe Ratio of a series.
Args:
@@ -221,8 +220,8 @@ def sharpe_ratio(
def sortino_ratio(
- close: Series, benchmark_rate: float = 0.0, log: bool = False
-) -> float:
+ close: Series, benchmark_rate: IntFloat = 0.0, log: bool = False
+) -> IntFloat:
"""Sortino Ratio of a series.
Args:
@@ -245,7 +244,7 @@ def sortino_ratio(
def volatility(
close: Series, tf: str = "years", returns: bool = False, log: bool = False
-) -> float:
+) -> IntFloat:
"""Volatility of a series. Default: 'years'
Args:
diff --git a/pandas_ta/utils/_numba.py b/pandas_ta/utils/_numba.py
index eb6972a..a9b1373 100644
--- a/pandas_ta/utils/_numba.py
+++ b/pandas_ta/utils/_numba.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from numpy import append, array, empty_like, nan, ndarray, roll, zeros_like
+from pandas_ta._typing import Array, Int, IntFloat
+
try:
from numba import njit
except ImportError:
@@ -9,13 +11,13 @@ except ImportError:
# Utilities
@njit
-def np_prepend(x: ndarray, n: int, value=nan):
+def np_prepend(x: Array, n: Int, value: IntFloat = nan) -> Array:
"""Append array x to an array of values, typically nan."""
return append(array([value] * n), x)
@njit
-def np_roll(x: ndarray, n: int, fn=None):
+def np_roll(x: Array, n: Int, fn = None) -> Array:
"""Like Pandas Rolling Window. x.rolling(n).fn()"""
m = x.size
result = zeros_like(x, dtype=float)
@@ -30,7 +32,7 @@ def np_roll(x: ndarray, n: int, fn=None):
@njit
-def np_shift(x: ndarray, n: int, value=nan):
+def np_shift(x: Array, n: Int, value: IntFloat = nan) -> Array:
"""np shift
shift5 - preallocate empty array and assign slice by chrisaycock
https://stackoverflow.com/questions/30399534/shift-elements-in-a-numpy-array
@@ -49,7 +51,7 @@ def np_shift(x: ndarray, n: int, value=nan):
# Uncategorized
# @njit
-# def np_roofing_filter(x: np.ndarray, n: int, k: int, pi: float, sqrt2: float):
+# def np_roofing_filter(x: Array, n: Int, k: Int, pi: Float, sqrt2: Float):
# """Ehler's Roofing Filter (INCOMPLETE)
# http://traders.com/documentation/feedbk_docs/2014/01/traderstips.html"""
# m, hp = x.size, np.copy(x)
diff --git a/pandas_ta/utils/_signals.py b/pandas_ta/utils/_signals.py
index ba21e79..5bf856f 100644
--- a/pandas_ta/utils/_signals.py
+++ b/pandas_ta/utils/_signals.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Float, Int, IntFloat
from pandas_ta.utils._core import get_offset, verify_series
from pandas_ta.utils._math import zero
@@ -7,7 +8,7 @@ from pandas_ta.utils._math import zero
def _above_below(
series_a: Series, series_b: Series,
above: bool = True, asint: bool = True,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs
) -> Series:
# Verify
series_a = verify_series(series_a)
@@ -39,7 +40,7 @@ def _above_below(
def above(
series_a: Series, series_b: Series, asint: bool = True,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs
) -> Series:
return _above_below(
series_a, series_b, above=True, asint=asint, offset=offset, **kwargs
@@ -47,8 +48,8 @@ def above(
def above_value(
- series_a: Series, value: float, asint: bool = True,
- offset: int = None, **kwargs
+ series_a: Series, value: IntFloat, asint: bool = True,
+ offset: Int = None, **kwargs
) -> Series:
if not isinstance(value, (int, float, complex)):
print("[X] value is not a number")
@@ -64,7 +65,7 @@ def above_value(
def below(
series_a: Series, series_b: Series, asint: bool = True,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs
) -> Series:
return _above_below(
series_a, series_b, above=False, asint=asint, offset=offset, **kwargs
@@ -72,8 +73,8 @@ def below(
def below_value(
- series_a: Series, value: float, asint: bool = True,
- offset: int = None, **kwargs
+ series_a: Series, value: IntFloat, asint: bool = True,
+ offset: Int = None, **kwargs
) -> Series:
if not isinstance(value, (int, float, complex)):
print("[X] value is not a number")
@@ -87,8 +88,8 @@ def below_value(
def cross_value(
- series_a: Series, value: float, above: bool = True, asint: bool = True,
- offset: int = None, **kwargs
+ series_a: Series, value: IntFloat, above: bool = True, asint: bool = True,
+ offset: Int = None, **kwargs
) -> Series:
series_b = Series(
value, index=series_a.index, name=f"{value}".replace(".", "_")
@@ -100,7 +101,7 @@ def cross_value(
def cross(
series_a: Series, series_b: Series,
above: bool = True, asint: bool = True,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
# Validate
series_a = verify_series(series_a)
@@ -133,9 +134,9 @@ def cross(
def signals(
- indicator: Series, xa: float, xb: float, cross_values: bool,
+ indicator: Series, xa: IntFloat, xb: IntFloat, cross_values: bool,
xserie: Series, xserie_a: Series, xserie_b: Series, cross_series: bool,
- offset: int
+ offset: Int
) -> DataFrame:
df = DataFrame()
if xa is not None and isinstance(xa, (int, float)):
diff --git a/pandas_ta/utils/_stats.py b/pandas_ta/utils/_stats.py
index a2fc093..94c301a 100644
--- a/pandas_ta/utils/_stats.py
+++ b/pandas_ta/utils/_stats.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
-from typing import Union
-from numpy import array, infty, log, nan, ndarray, pi, sqrt
+from numpy import array, infty, log, nan, pi, sqrt
+from pandas_ta._typing import Array, IntFloat, Number, Union
from pandas_ta.maps import Imports
from pandas_ta.utils import hpoly
-def _gaussian_poly_coefficients() -> ndarray:
+def _gaussian_poly_coefficients() -> Array:
"""Three pairs of Polynomial Approximation Coefficients
for the Gaussian Normal CDF"""
@@ -55,7 +55,7 @@ def _gaussian_poly_coefficients() -> ndarray:
return [p0, q0, p1, q1, p2, q2]
-def inv_norm(value: Union[float, int]) -> Union[float, None]:
+def inv_norm(value: IntFloat) -> Union[None, Number]:
"""Inverse Normal (inv_norm)
Calculates the 'x' in which the area under the Gaussian PDF is
equal to value.
diff --git a/pandas_ta/utils/_study.py b/pandas_ta/utils/_study.py
index bfc7591..fc3ccd8 100644
--- a/pandas_ta/utils/_study.py
+++ b/pandas_ta/utils/_study.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from multiprocessing import cpu_count
-from typing import List
from dataclasses import dataclass, field
+from pandas_ta._typing import Int, List
from pandas_ta.utils._time import get_time
@@ -13,11 +13,16 @@ class Study:
Class to name and group indicators for processing
Args:
- name (str): Some short memorable string. Note: Case-insensitive "All" is reserved.
- ta (list of dicts): A list of dicts containing keyword arguments where "kind" is the indicator.
- cores (int): The number cores to use for the study(). Default: cpu_count()
- description (str): A more detailed description of what the Study tries to capture. Default: None
- created (str): At datetime string of when it was created. Default: Automatically generated. *Subject to change*
+ name (str): Some short memorable string.
+ Note: Case-insensitive "All" is reserved.
+ ta (list of dicts): A list of dicts containing keyword arguments
+ where "kind" is the indicator.
+ cores (int): The number cores to use for the study().
+ Default: cpu_count()
+ description (str): A more detailed description of what the Study
+ tries to capture. Default: None
+ created (str): At datetime string of when it was created.
+ Default: Automatically generated. *Subject to change*
Example TA:
ta = [
@@ -31,7 +36,7 @@ class Study:
"""
name: str # = None # Required.
ta: List = field(default_factory=list) # Required.
- cores: int = cpu_count() # Number of cores. Default cpu_count()
+ cores: Int = cpu_count() # Number of cores. Default cpu_count()
description: str = "" # Helpful. More descriptive version or notes or w/e.
# Optional. Gets Exchange Time and Local Time execution time
created: str = get_time(to_string=True)
diff --git a/pandas_ta/utils/_time.py b/pandas_ta/utils/_time.py
index 3cf9d44..d4d43b7 100644
--- a/pandas_ta/utils/_time.py
+++ b/pandas_ta/utils/_time.py
@@ -1,13 +1,15 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from time import localtime, perf_counter
-from typing import Tuple, Union
from pandas import DataFrame, Series, Timestamp, to_datetime
+from pandas_ta._typing import Float, MaybeSeriesFrame, Optional, Tuple, Union
from pandas_ta.maps import EXCHANGE_TZ, RATE
-def df_dates(df: DataFrame, dates: Tuple[str, list] = None) -> DataFrame:
+def df_dates(
+ df: DataFrame, dates: Tuple[str, list] = None
+) -> MaybeSeriesFrame:
"""Yields the DataFrame with the given dates"""
if dates is None:
return None
@@ -43,7 +45,7 @@ def df_year_to_date(df: DataFrame) -> DataFrame:
return df
-def final_time(stime: float) -> str:
+def final_time(stime: Float) -> str:
"""Human readable elapsed time. Calculates the final time elasped since
stime and returns a string with microseconds and seconds."""
time_diff = perf_counter() - stime
@@ -52,7 +54,7 @@ def final_time(stime: float) -> str:
def get_time(
exchange: str = "NYSE", full: bool = True, to_string: bool = False
-) -> Union[None, str]:
+) -> Optional[str]:
"""Returns Current Time, Day of the Year and Percentage, and the current
time of the selected Exchange."""
tz = EXCHANGE_TZ["NYSE"] # Default is NYSE (Eastern Time Zone)
@@ -80,7 +82,7 @@ def get_time(
return s if to_string else print(s)
-def total_time(df: DataFrame, tf: str = "years") -> float:
+def total_time(df: DataFrame, tf: str = "years") -> Float:
"""Calculates the total time of a DataFrame. Difference of the Last and
First index. Options: 'months', 'weeks', 'days', 'hours', 'minutes'
and 'seconds'. Default: 'years'.
diff --git a/pandas_ta/utils/data/processes.py b/pandas_ta/utils/data/processes.py
index d134e71..20c637d 100644
--- a/pandas_ta/utils/data/processes.py
+++ b/pandas_ta/utils/data/processes.py
@@ -7,6 +7,8 @@ from numpy import absolute, any, concatenate, cumsum, flip, max
from numpy import mean, min, ndarray, std, sum, where, zeros
from numpy.random import choice, normal, randint
from pandas import DataFrame, date_range
+
+from pandas_ta._typing import Array, Float, Int, IntFloat, List, Optional
from pandas_ta.maps import Imports, RATE
@@ -129,13 +131,15 @@ class sample(object):
_scales = ["m", "n", "s", None]
def __init__(self,
- name=None, process=None, noise=None, length=None,
- s0=None, b=None, t=None, drift=None, volatility=None,
- speed=None, hurst=None, steps=None, random_number=None,
- orient=None, positive=None, scale=None,
- future=None, freq=None, intraday=None,
- noise_percent=None,
- date_fmt=None, precision=None, verbose=None
+ name: str = None, process: str = None, noise: str = None,
+ length: Int = None, s0: IntFloat = None, b: IntFloat = None,
+ t: IntFloat = None, drift: Int = None, volatility: IntFloat = None,
+ speed: IntFloat = None, hurst: Float = None,
+ steps: List[IntFloat] = None, random_number: Optional[Int] = None,
+ orient: str = None, positive: bool = None, scale: str = None,
+ future: bool = None, freq: str = None, intraday: str = None,
+ noise_percent: Float = None, date_fmt: str = None,
+ precision: Int = None, verbose: bool = None
):
"""Validation and initialization of arguments and then runs the
_generate() method to build a sample realization with the given
@@ -201,8 +205,9 @@ class sample(object):
self._generate() # Run it
- def _bernoulli_mask(self, array: ndarray,
- percent: float = None, p: float = None):
+ def _bernoulli_mask(self,
+ array: Array, percent: Float = None, p: Float = None
+ ):
"""Bernoulli Mask - Positive or Negative"""
if array.size > 0:
percent = float(percent) if percent is not None and isinstance(
@@ -256,14 +261,14 @@ class sample(object):
if self._verbose:
print(self._dfname)
- def nonnegative(self, array: ndarray = None):
+ def nonnegative(self, array: Array = None):
"""Vertical Translation the 'array' where the resultant 'array' has
non-negative values."""
if isinstance(array, ndarray):
return self._nonnegative(array)
return array
- def _nonnegative(self, array: ndarray):
+ def _nonnegative(self, array: Array):
"""Translates the array up by the minimum of the 'array' if any values
are negative."""
if array.size > 0 and any(array < 0):
@@ -271,7 +276,7 @@ class sample(object):
self._s0 = array[0]
return array
- def _normal_mask(self, array: ndarray):
+ def _normal_mask(self, array: Array):
"""A method to add some additional randomness to the realized
process. Applies a mask based on the Normal Distribution and the 'array's
mean and standard deviation."""
@@ -280,14 +285,14 @@ class sample(object):
return array * self.noise_percent * norm
return array
- def orientation(self, array: ndarray, mode: str = None):
+ def orientation(self, array: Array, mode: str = None):
"""Orients the 'array' either by Inversion, Reversal, or an
Inverted Reversal."""
if isinstance(array, ndarray):
return self._orientation(array, mode=mode)
return array
- def _orientation(self, array: ndarray, mode: str = None):
+ def _orientation(self, array: Array, mode: str = None):
"""Orients the 'array' either by Inversion, Reversal, or an
Inverted Reversal."""
_modes = ["i", "r", "ir", "ri", None, "rand"]
@@ -314,13 +319,13 @@ class sample(object):
return result
- def scale(self, array: ndarray, mode: str):
+ def scale(self, array: Array, mode: str):
"""Mean, Normal or Standard scaling of the 'array'."""
if isinstance(array, ndarray):
return self._scaler(array, mode=mode)
return array
- def _scaler(self, array: ndarray, mode: str):
+ def _scaler(self, array: Array, mode: str):
"""Scaling: mean, normal, standard"""
result = array
if mode is None:
@@ -343,8 +348,9 @@ class sample(object):
return result
- def _simple_random_walk(self, up: float = None,
- down: float = None) -> ndarray:
+ def _simple_random_walk(self,
+ up: Float = None, down: Float = None
+ ) -> Array:
"""Simple Random Walk
Sources:
diff --git a/pandas_ta/volatility/aberration.py b/pandas_ta/volatility/aberration.py
index 5df28c3..81fa83b 100644
--- a/pandas_ta/volatility/aberration.py
+++ b/pandas_ta/volatility/aberration.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import hlc3, sma
from pandas_ta.utils import get_offset, verify_series
from .atr import atr
@@ -7,8 +8,8 @@ from .atr import atr
def aberration(
high: Series, low: Series, close: Series,
- length: int = None, atr_length: int = None,
- offset: int = None, **kwargs
+ length: Int = None, atr_length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Aberration (ABER)
diff --git a/pandas_ta/volatility/accbands.py b/pandas_ta/volatility/accbands.py
index f83c345..af5401a 100644
--- a/pandas_ta/volatility/accbands.py
+++ b/pandas_ta/volatility/accbands.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def accbands(
- high: Series, low: Series, close: Series, length: int = None,
- c: int = None, drift: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, close: Series, length: Int = None,
+ c: IntFloat = None, drift: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Acceleration Bands (ACCBANDS)
diff --git a/pandas_ta/volatility/atr.py b/pandas_ta/volatility/atr.py
index 6fb788b..52a8e53 100644
--- a/pandas_ta/volatility/atr.py
+++ b/pandas_ta/volatility/atr.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.utils import get_drift, get_offset, verify_series
@@ -7,9 +8,9 @@ from .true_range import true_range
def atr(
- high: Series, low: Series, close: Series, length: int = None,
- mamode: str = None, talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, close: Series, length: Int = None,
+ mamode: str = None, talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Average True Range (ATR)
diff --git a/pandas_ta/volatility/bbands.py b/pandas_ta/volatility/bbands.py
index e94a96b..7abf684 100644
--- a/pandas_ta/volatility/bbands.py
+++ b/pandas_ta/volatility/bbands.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.maps import Imports
from pandas_ta.statistics import stdev
@@ -7,9 +8,9 @@ from pandas_ta.utils import get_offset, non_zero_range, tal_ma, verify_series
def bbands(
- close: Series, length: int = None, std: int = None, ddof: int = 0,
+ close: Series, length: Int = None, std: IntFloat = None, ddof: Int = 0,
mamode: str = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Bollinger Bands (BBANDS)
diff --git a/pandas_ta/volatility/donchian.py b/pandas_ta/volatility/donchian.py
index 24fb06b..e77f707 100644
--- a/pandas_ta/volatility/donchian.py
+++ b/pandas_ta/volatility/donchian.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, verify_series
def donchian(
high: Series, low: Series,
- lower_length: int = None, upper_length: int = None,
- offset: int = None, **kwargs
+ lower_length: Int = None, upper_length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Donchian Channels (DC)
diff --git a/pandas_ta/volatility/hwc.py b/pandas_ta/volatility/hwc.py
index 8c61ef6..b8f72b3 100644
--- a/pandas_ta/volatility/hwc.py
+++ b/pandas_ta/volatility/hwc.py
@@ -1,22 +1,24 @@
# -*- coding: utf-8 -*-
from numpy import sqrt
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.utils import get_offset, verify_series
def hwc(
- close: Series, scalar: float = None, channel_eval: bool = None,
- na: float = None, nb: float = None, nc: float = None, nd: float = None,
- offset: int = None, **kwargs
+ close: Series, scalar: IntFloat = None, channel_eval: bool = None,
+ na: IntFloat = None, nb: IntFloat = None,
+ nc: IntFloat = None, nd: IntFloat = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""HWC (Holt-Winter Channel)
- Channel indicator HWC (Holt-Winters Channel) based on HWMA - a three-parameter
- moving average calculated by the method of Holt-Winters.
+ Channel indicator HWC (Holt-Winters Channel) based on HWMA - a
+ three-parameter moving average calculated by the method of Holt-Winters.
This version has been implemented for Pandas TA by rengel8 based on a
- publication for MetaTrader 5 extended by width and percentage price position
- against width of channel.
+ publication for MetaTrader 5 extended by width and percentage price
+ position against width of channel.
Sources:
https://www.mql5.com/en/code/20857
@@ -24,8 +26,8 @@ def hwc(
Args:
close (pd.Series): Series of 'close's
scaler (float): Width multiplier of the channel. Default: 1
- channel_eval (bool): Return width and percentage price position against
- price. Default: False
+ channel_eval (bool): Return width and percentage price position
+ against price. Default: False
na (float): Smoothed series (from 0 to 1). Default: 0.2
nb (float): Trend value (from 0 to 1). Default: 0.1
nc (float): Seasonality value (from 0 to 1). Default: 0.1
diff --git a/pandas_ta/volatility/kc.py b/pandas_ta/volatility/kc.py
index 82bc6a4..71071e2 100644
--- a/pandas_ta/volatility/kc.py
+++ b/pandas_ta/volatility/kc.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.utils import get_offset, high_low_range, verify_series
from .true_range import true_range
@@ -7,8 +8,8 @@ from .true_range import true_range
def kc(
high: Series, low: Series, close: Series,
- length: int = None, scalar: float = None, mamode: str = None,
- offset: int = None, **kwargs
+ length: Int = None, scalar: IntFloat = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Keltner Channels (KC)
diff --git a/pandas_ta/volatility/massi.py b/pandas_ta/volatility/massi.py
index 43a495c..3b1c7c5 100644
--- a/pandas_ta/volatility/massi.py
+++ b/pandas_ta/volatility/massi.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import ema
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def massi(
- high: Series, low: Series, fast: int = None, slow: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, fast: Int = None, slow: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Mass Index (MASSI)
diff --git a/pandas_ta/volatility/natr.py b/pandas_ta/volatility/natr.py
index c567452..5ee0a7b 100644
--- a/pandas_ta/volatility/natr.py
+++ b/pandas_ta/volatility/natr.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.maps import Imports
from pandas_ta.utils import get_drift, get_offset, verify_series
from pandas_ta.volatility import atr
@@ -7,9 +8,9 @@ from pandas_ta.volatility import atr
def natr(
high: Series, low: Series, close: Series,
- length: int = None, scalar: float = None, mamode: str = None,
- talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, scalar: IntFloat = None, mamode: str = None,
+ talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Normalized Average True Range (NATR)
diff --git a/pandas_ta/volatility/pdist.py b/pandas_ta/volatility/pdist.py
index f051710..c32aaf4 100644
--- a/pandas_ta/volatility/pdist.py
+++ b/pandas_ta/volatility/pdist.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def pdist(
open_: Series, high: Series, low: Series, close: Series,
- drift: int = None,
- offset: int = None, **kwargs
+ drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Price Distance (PDIST)
diff --git a/pandas_ta/volatility/rvi.py b/pandas_ta/volatility/rvi.py
index d8cf3f0..cb4b8c1 100644
--- a/pandas_ta/volatility/rvi.py
+++ b/pandas_ta/volatility/rvi.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.ma import ma
from pandas_ta.statistics import stdev
from pandas_ta.utils import get_drift, get_offset
@@ -8,10 +9,10 @@ from pandas_ta.utils import unsigned_differences, verify_series
def rvi(
close: Series, high: Series = None, low: Series = None,
- length: int = None, scalar: float = None,
+ length: Int = None, scalar: IntFloat = None,
refined: bool = None, thirds: bool = None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Relative Volatility Index (RVI)
diff --git a/pandas_ta/volatility/thermo.py b/pandas_ta/volatility/thermo.py
index af7c2f3..6001b56 100644
--- a/pandas_ta/volatility/thermo.py
+++ b/pandas_ta/volatility/thermo.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_offset, verify_series, get_drift
def thermo(
- high: Series, low: Series, length: int = None,
- long: int = None, short: int = None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ high: Series, low: Series, length: Int = None,
+ long: Int = None, short: Int = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Elders Thermometer (THERMO)
diff --git a/pandas_ta/volatility/true_range.py b/pandas_ta/volatility/true_range.py
index 93de895..e03806b 100644
--- a/pandas_ta/volatility/true_range.py
+++ b/pandas_ta/volatility/true_range.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import concat, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def true_range(
high: Series, low: Series, close: Series,
- talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""True Range
diff --git a/pandas_ta/volatility/ui.py b/pandas_ta/volatility/ui.py
index 4bea824..35bbc9b 100644
--- a/pandas_ta/volatility/ui.py
+++ b/pandas_ta/volatility/ui.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from numpy import sqrt
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.overlap import sma
from pandas_ta.utils import get_offset, verify_series
def ui(
- close: Series, length: int = None, scalar: int = None,
- offset: int = None, **kwargs
+ close: Series, length: Int = None, scalar: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Ulcer Index (UI)
diff --git a/pandas_ta/volume/ad.py b/pandas_ta/volume/ad.py
index f169d2a..94d0cac 100644
--- a/pandas_ta/volume/ad.py
+++ b/pandas_ta/volume/ad.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, non_zero_range, verify_series
@@ -7,7 +8,7 @@ from pandas_ta.utils import get_offset, non_zero_range, verify_series
def ad(
high: Series, low: Series, close: Series, volume: Series,
open_: Series = None, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Accumulation/Distribution (AD)
diff --git a/pandas_ta/volume/adosc.py b/pandas_ta/volume/adosc.py
index 0fea823..5ea5511 100644
--- a/pandas_ta/volume/adosc.py
+++ b/pandas_ta/volume/adosc.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.overlap import ema
from pandas_ta.utils import get_offset, verify_series
@@ -8,9 +9,9 @@ from pandas_ta.volume import ad
def adosc(
high: Series, low: Series, close: Series, volume: Series,
- open_: Series = None, fast: int = None, slow: int = None,
+ open_: Series = None, fast: Int = None, slow: Int = None,
talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Accumulation/Distribution Oscillator or Chaikin Oscillator
diff --git a/pandas_ta/volume/aobv.py b/pandas_ta/volume/aobv.py
index d889f6e..03cb2c6 100644
--- a/pandas_ta/volume/aobv.py
+++ b/pandas_ta/volume/aobv.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.trend import long_run, short_run
from pandas_ta.utils import get_offset, verify_series
@@ -7,9 +8,9 @@ from .obv import obv
def aobv(
- close: Series, volume: Series, fast: int = None, slow: int = None,
- max_lookback: int = None, min_lookback: int = None, mamode: str = None,
- offset: int = None, **kwargs
+ close: Series, volume: Series, fast: Int = None, slow: Int = None,
+ max_lookback: Int = None, min_lookback: Int = None, mamode: str = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Archer On Balance Volume (AOBV)
diff --git a/pandas_ta/volume/cmf.py b/pandas_ta/volume/cmf.py
index 7549bba..bf88ca2 100644
--- a/pandas_ta/volume/cmf.py
+++ b/pandas_ta/volume/cmf.py
@@ -1,17 +1,18 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, non_zero_range, verify_series
def cmf(
high: Series, low: Series, close: Series, volume: Series,
- open_: Series = None, length: int = None,
- offset: int = None, **kwargs
+ open_: Series = None, length: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Chaikin Money Flow (CMF)
- Chailin Money Flow measures the amount of money flow volume over a specific
- period in conjunction with Accumulation/Distribution.
+ Chaikin Money Flow measures the amount of money flow volume over a
+ specific period in conjunction with Accumulation/Distribution.
Sources:
https://www.tradingview.com/wiki/Chaikin_Money_Flow_(CMF)
diff --git a/pandas_ta/volume/efi.py b/pandas_ta/volume/efi.py
index 29e9ba1..57e23af 100644
--- a/pandas_ta/volume/efi.py
+++ b/pandas_ta/volume/efi.py
@@ -1,18 +1,19 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_drift, get_offset, verify_series
def efi(
- close: Series, volume: Series, length: int = None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, volume: Series, length: Int = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Elder's Force Index (EFI)
- Elder's Force Index measures the power behind a price movement using price
- and volume as well as potential reversals and price corrections.
+ Elder's Force Index measures the power behind a price movement using
+ price and volume as well as potential reversals and price corrections.
Sources:
https://www.tradingview.com/wiki/Elder%27s_Force_Index_(EFI)
diff --git a/pandas_ta/volume/eom.py b/pandas_ta/volume/eom.py
index c7f6042..eb9dc8c 100644
--- a/pandas_ta/volume/eom.py
+++ b/pandas_ta/volume/eom.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int, IntFloat
from pandas_ta.overlap import hl2, sma
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
def eom(
high: Series, low: Series, close: Series, volume: Series,
- length: int = None, divisor=None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, divisor: IntFloat= None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Ease of Movement (EOM)
@@ -25,6 +26,7 @@ def eom(
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
length (int): The short period. Default: 14
+ divisor (float): Divisor. Default: 100000000
drift (int): The diff period. Default: 1
offset (int): How many periods to offset the result. Default: 0
@@ -37,7 +39,7 @@ def eom(
"""
# Validate
length = int(length) if length and length > 0 else 14
- divisor = divisor if divisor and divisor > 0 else 100000000
+ divisor = float(divisor) if divisor and divisor > 0 else 100000000
high = verify_series(high, length)
low = verify_series(low, length)
close = verify_series(close, length)
diff --git a/pandas_ta/volume/kvo.py b/pandas_ta/volume/kvo.py
index 34b908a..8dd3417 100644
--- a/pandas_ta/volume/kvo.py
+++ b/pandas_ta/volume/kvo.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from numpy import isnan
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.overlap import hlc3
from pandas_ta.utils import get_drift, get_offset, signed_series, verify_series
@@ -8,9 +9,9 @@ from pandas_ta.utils import get_drift, get_offset, signed_series, verify_series
def kvo(
high: Series, low: Series, close: Series, volume: Series,
- fast: int = None, slow: int = None, signal=None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ fast: Int = None, slow: Int = None, signal: Int = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Klinger Volume Oscillator (KVO)
diff --git a/pandas_ta/volume/mfi.py b/pandas_ta/volume/mfi.py
index 85bbf6a..86988dd 100644
--- a/pandas_ta/volume/mfi.py
+++ b/pandas_ta/volume/mfi.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.overlap import hlc3
from pandas_ta.utils import get_drift, get_offset, verify_series
@@ -7,8 +8,8 @@ from pandas_ta.utils import get_drift, get_offset, verify_series
def mfi(
high: Series, low: Series, close: Series, volume: Series,
- length: int = None, talib: bool = None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, talib: bool = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Money Flow Index (MFI)
diff --git a/pandas_ta/volume/nvi.py b/pandas_ta/volume/nvi.py
index d8aa404..bc56191 100644
--- a/pandas_ta/volume/nvi.py
+++ b/pandas_ta/volume/nvi.py
@@ -1,17 +1,18 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.momentum import roc
from pandas_ta.utils import get_offset, signed_series, verify_series
def nvi(
- close: Series, volume: Series, length: int = None, initial: int = None,
- offset: int = None, **kwargs
+ close: Series, volume: Series, length: Int = None, initial: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Negative Volume Index (NVI)
- The Negative Volume Index is a cumulative indicator that uses volume change in
- an attempt to identify where smart money is active.
+ The Negative Volume Index is a cumulative indicator that uses volume
+ change in an attempt to identify where smart money is active.
Sources:
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:negative_volume_inde
diff --git a/pandas_ta/volume/obv.py b/pandas_ta/volume/obv.py
index f27c597..640f24a 100644
--- a/pandas_ta/volume/obv.py
+++ b/pandas_ta/volume/obv.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.maps import Imports
from pandas_ta.utils import get_offset, signed_series, verify_series
def obv(
close: Series, volume: Series, talib: bool = None,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""On Balance Volume (OBV)
diff --git a/pandas_ta/volume/pvi.py b/pandas_ta/volume/pvi.py
index 72209ee..8553256 100644
--- a/pandas_ta/volume/pvi.py
+++ b/pandas_ta/volume/pvi.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.momentum import roc
from pandas_ta.utils import get_offset, signed_series, verify_series
def pvi(
- close: Series, volume: Series, length: int = None, initial: int = None,
- offset: int = None, **kwargs
+ close: Series, volume: Series, length: Int = None, initial: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Positive Volume Index (PVI)
diff --git a/pandas_ta/volume/pvol.py b/pandas_ta/volume/pvol.py
index 4663489..e84241b 100644
--- a/pandas_ta/volume/pvol.py
+++ b/pandas_ta/volume/pvol.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import get_offset, signed_series, verify_series
def pvol(
close: Series, volume: Series,
- offset: int = None, **kwargs
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Price-Volume (PVOL)
@@ -14,7 +15,8 @@ def pvol(
Args:
close (pd.Series): Series of 'close's
volume (pd.Series): Series of 'volume's
- signed (bool): Keeps the sign of the difference in 'close's. Default: True
+ signed (bool): Keeps the sign of the difference in 'close's.
+ Default: True
offset (int): How many periods to offset the result. Default: 0
Kwargs:
diff --git a/pandas_ta/volume/pvr.py b/pandas_ta/volume/pvr.py
index f867edc..12af6ff 100644
--- a/pandas_ta/volume/pvr.py
+++ b/pandas_ta/volume/pvr.py
@@ -1,19 +1,21 @@
# -*- coding: utf-8 -*-
from numpy import nan
from pandas import Series
+from pandas_ta._typing import Int
from pandas_ta.utils import get_drift, verify_series
def pvr(
- close: Series, volume: Series, drift: int = None,
+ close: Series, volume: Series, drift: Int = None,
) -> Series:
"""Price Volume Rank
- The Price Volume Rank was developed by Anthony J. Macek and is described in his
- article in the June, 1994 issue of Technical Analysis of Stocks & Commodities
- Magazine. It was developed as a simple indicator that could be calculated even
- without a computer. The basic interpretation is to buy when the PV Rank is below
- 2.5 and sell when it is above 2.5.
+ The Price Volume Rank was developed by Anthony J. Macek and is described
+ in his article in the June, 1994 issue of Technical Analysis of
+ Stocks & Commodities (TASC) Magazine. It was developed as a simple
+ indicator that could be calculated even without a computer. The basic
+ interpretation is to buy when the PV Rank is below 2.5 and
+ sell when it is above 2.5.
Sources:
https://www.fmlabs.com/reference/default.htm?url=PVrank.htm
diff --git a/pandas_ta/volume/pvt.py b/pandas_ta/volume/pvt.py
index 69972b5..3ad0a40 100644
--- a/pandas_ta/volume/pvt.py
+++ b/pandas_ta/volume/pvt.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from pandas import Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.momentum import roc
from pandas_ta.utils import get_drift, get_offset, verify_series
def pvt(
- close: Series, volume: Series, drift: int = None,
- offset: int = None, **kwargs
+ close: Series, volume: Series, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> Series:
"""Price-Volume Trend (PVT)
diff --git a/pandas_ta/volume/vp.py b/pandas_ta/volume/vp.py
index c1eed9d..908fe34 100644
--- a/pandas_ta/volume/vp.py
+++ b/pandas_ta/volume/vp.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
from numpy import array_split, mean, sum
from pandas import cut, concat, DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.utils import signed_series, verify_series
def vp(
- close: Series, volume: Series, width: int = None,
- **kwargs
+ close: Series, volume: Series, width: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Volume Profile (VP)
diff --git a/pandas_ta/volume/wb_tsv.py b/pandas_ta/volume/wb_tsv.py
index 786683c..523a034 100644
--- a/pandas_ta/volume/wb_tsv.py
+++ b/pandas_ta/volume/wb_tsv.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
+from pandas_ta._typing import DictLike, Int
from pandas_ta.ma import ma
from pandas_ta.utils import get_drift, get_offset, verify_series, signed_series, zero
def wb_tsv(
close: Series, volume: Series,
- length: int = None, signal: int = None,
- mamode: str = None, drift: int = None,
- offset: int = None, **kwargs
+ length: Int = None, signal: Int = None,
+ mamode: str = None, drift: Int = None,
+ offset: Int = None, **kwargs: DictLike
) -> DataFrame:
"""Time Segmented Value (TSV)
@@ -43,10 +44,14 @@ def wb_tsv(
# Validate
length = int(length) if length and length > 0 else 18
signal = int(signal) if signal and signal > 0 else 10
+ close = verify_series(close, max(length, signal))
mamode = mamode if isinstance(mamode, str) else "sma"
drift = get_drift(drift)
offset = get_offset(offset)
+ if close is None:
+ return
+
# Calculate
signed_volume = volume * signed_series(close, 1) # > 0
signed_volume[signed_volume < 0] = -signed_volume # < 0
diff --git a/setup.py b/setup.py
index 1971311..94a1879 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ setup(
"pandas_ta.volatility",
"pandas_ta.volume"
],
- version=".".join(("0", "3", "51b")),
+ version=".".join(("0", "3", "52b")),
description=long_description,
long_description=long_description,
author="Kevin Johnson",
diff --git a/tests/config.py b/tests/config.py
index 6328957..d08abdc 100644
--- a/tests/config.py
+++ b/tests/config.py
@@ -1,22 +1,27 @@
# -*- coding: utf-8 -*-
-import os
import datetime
-from pandas import DataFrame, DatetimeIndex, concat, read_csv
+from pathlib import Path
+
+from pandas import DataFrame, read_csv
import pandas_datareader as pdr
import pandas_ta
+from pandas_ta._typing import DictLike, IntFloat
-ALERT = f"[!]"
-INFO = f"[i]"
-TEST = f"[T]"
+ALERT: str = f"[!]"
+INFO: str = f"[i]"
+TEST: str = f"[T]"
-CORRELATION = "corr" # "sem"
-CORRELATION_THRESHOLD = 0.99 # Less than 0.99 is undesirable
-VERBOSE = False
+CORRELATION: str = "corr" # "sem"
+CORRELATION_THRESHOLD: IntFloat = 0.99 # Less than 0.99 is undesirable
+VERBOSE: bool = False
-def error_analysis(df, kind, msg, icon=INFO, newline=True):
+def error_analysis(
+ df: DataFrame, kind: str, msg: str,
+ icon: str = INFO, newline: bool = True
+):
if VERBOSE:
s = f"{icon} {df.name}['{kind}']: {msg}"
if newline:
@@ -24,7 +29,7 @@ def error_analysis(df, kind, msg, icon=INFO, newline=True):
print(s)
-def load(**kwargs):
+def load(**kwargs: DictLike):
kwargs.setdefault("ticker", "SPY")
kwargs.setdefault("prefix", "PDR_")
kwargs.setdefault("interval", "d")
@@ -38,9 +43,10 @@ def load(**kwargs):
print(f"\n{TEST} Pandas TA on {datetime.datetime.now()}")
filename = f"{kwargs['prefix']}{kwargs['ticker']}_{kwargs['interval']}.csv"
+ fpath = f"./{Path(filename).suffix.replace('.', '')}/{filename}"
try:
df = read_csv(
- filename,
+ Path(fpath),
index_col=kwargs["index_col"],
parse_dates=kwargs["parse_dates"],
infer_datetime_format=kwargs["infer_datetime_format"],
@@ -51,24 +57,26 @@ def load(**kwargs):
print(f"{ALERT} {err}")
if kwargs["verbose"]: print(f"{INFO} Downloading: {kwargs['ticker']} from YF")
df = pdr.get_data_yahoo(kwargs['ticker'], interval=kwargs['interval'])
- df.to_csv(filename, mode="a")
+ df.to_csv(Path(fpath), mode="a")
_mode = "Downloading"
kwargs.setdefault("n", 0)
- if kwargs['n'] > 0:
- df = df[:kwargs['n']]
+ if kwargs["n"] > 0:
+ df = df[:kwargs["n"]]
elif kwargs['n'] < 0:
- df = df[kwargs['n']:]
+ df = df[kwargs["n"]:]
df.columns = df.columns.str.lower()
if kwargs["verbose"]:
- print(f"{INFO} {_mode} {kwargs['ticker']}{df.shape} from {filename}")
+ # print(f"{INFO} {_mode} {kwargs['ticker']}{df.shape} from {filename}")
+ print(f"{INFO} {_mode} {kwargs['ticker']}{df.shape} from {fpath}")
print(f"{INFO} From {df.index[0]} to {df.index[-1]}\n{df}\n")
return df
_tdpy = pandas_ta.RATE["TRADING_DAYS_PER_YEAR"]
# At least 90 (88 with trix with default values) bars/rows/observations are
-# needed to test All indicators individually and within the DataFrame extension
+# needed to test All indicators individually and within the DataFrame
+# extension. A larger sample may be required because of the Unstable Period
sample_data = load(
n = [
-2 * _tdpy, -_tdpy,
diff --git a/tests/test_ext_indicator_transform.py b/tests/test_ext_indicator_transform.py
index 94ee195..589b99b 100644
--- a/tests/test_ext_indicator_transform.py
+++ b/tests/test_ext_indicator_transform.py
@@ -24,7 +24,7 @@ class TestPerformaceExtension(TestCase):
def test_cube_ext(self):
self.data.ta.cube(append=True)
self.assertIsInstance(self.data, DataFrame)
- self.assertEqual(list(self.data.columns[-2:]), ["CUBE_3.0_1", "CUBEs_3.0_1"])
+ self.assertEqual(list(self.data.columns[-2:]), ["CUBE_3.0_-1", "CUBEs_3.0_-1"])
def test_inverse_fisher_ext(self):
self.data.ta.ifisher(append=True)
diff --git a/tests/test_indicator_candle.py b/tests/test_indicator_candle.py
index 609111f..8883b82 100644
--- a/tests/test_indicator_candle.py
+++ b/tests/test_indicator_candle.py
@@ -57,7 +57,7 @@ class TestCandle(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
diff --git a/tests/test_indicator_momentum.py b/tests/test_indicator_momentum.py
index ef38861..b257d1d 100644
--- a/tests/test_indicator_momentum.py
+++ b/tests/test_indicator_momentum.py
@@ -79,7 +79,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -105,7 +105,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -131,7 +131,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -163,7 +163,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -203,13 +203,13 @@ class TestMomentum(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- dmp = pandas_ta.utils.df_error_analysis(result.iloc[:,0], expecteddf.iloc[:,0], col=CORRELATION)
+ dmp = pandas_ta.utils.df_error_analysis(result.iloc[:,0], expecteddf.iloc[:,0])
self.assertGreater(dmp, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
try:
- dmn = pandas_ta.utils.df_error_analysis(result.iloc[:,1], expecteddf.iloc[:,1], col=CORRELATION)
+ dmn = pandas_ta.utils.df_error_analysis(result.iloc[:,1], expecteddf.iloc[:,1])
self.assertGreater(dmn, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -268,19 +268,19 @@ class TestMomentum(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- macd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0], col=CORRELATION)
+ macd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0])
self.assertGreater(macd_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex)
try:
- history_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1], col=CORRELATION)
+ history_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1])
self.assertGreater(history_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 1], CORRELATION, ex, newline=False)
try:
- signal_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 2], expecteddf.iloc[:, 2], col=CORRELATION)
+ signal_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 2], expecteddf.iloc[:, 2])
self.assertGreater(signal_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 2], CORRELATION, ex, newline=False)
@@ -306,7 +306,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -332,7 +332,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result["PPO_12_26_9"], expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result["PPO_12_26_9"], expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result["PPO_12_26_9"], expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result["PPO_12_26_9"], CORRELATION, ex)
@@ -376,7 +376,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -396,7 +396,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -504,13 +504,13 @@ class TestMomentum(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- stochk_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0], col=CORRELATION)
+ stochk_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0])
self.assertGreater(stochk_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex)
try:
- stochd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1], col=CORRELATION)
+ stochd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1])
self.assertGreater(stochd_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 1], CORRELATION, ex, newline=False)
@@ -532,13 +532,13 @@ class TestMomentum(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- stochk_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0], col=CORRELATION)
+ stochk_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0])
self.assertGreater(stochk_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex)
try:
- stochd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1], col=CORRELATION)
+ stochd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1])
self.assertGreater(stochd_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 1], CORRELATION, ex, newline=False)
@@ -560,7 +560,7 @@ class TestMomentum(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- stochrsid_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 1], col=CORRELATION)
+ stochrsid_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 1])
self.assertGreater(stochrsid_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex, newline=False)
@@ -599,7 +599,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -619,7 +619,7 @@ class TestMomentum(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
diff --git a/tests/test_indicator_overlap.py b/tests/test_indicator_overlap.py
index a1ac5e3..4a51be4 100644
--- a/tests/test_indicator_overlap.py
+++ b/tests/test_indicator_overlap.py
@@ -59,7 +59,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -80,7 +80,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -130,7 +130,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -182,7 +182,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -202,7 +202,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -222,7 +222,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -248,7 +248,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -288,7 +288,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -308,7 +308,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -352,7 +352,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -406,7 +406,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -426,7 +426,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -446,7 +446,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -463,7 +463,6 @@ class TestOverlap(TestCase):
def test_vwap(self):
"""Overlap: VWAP"""
- from icecream import ic
result = pandas_ta.vwap(self.high, self.low, self.close, self.volume)
self.assertIsInstance(result, Series)
self.assertEqual(result.name, "VWAP_D")
@@ -501,7 +500,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -521,7 +520,7 @@ class TestOverlap(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
diff --git a/tests/test_indicator_statistics.py b/tests/test_indicator_statistics.py
index 20b1ba4..75b72b6 100644
--- a/tests/test_indicator_statistics.py
+++ b/tests/test_indicator_statistics.py
@@ -82,7 +82,7 @@ class TestStatistics(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -119,7 +119,7 @@ class TestStatistics(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
diff --git a/tests/test_indicator_transform.py b/tests/test_indicator_transform.py
index 803ece6..2b1cfa3 100644
--- a/tests/test_indicator_transform.py
+++ b/tests/test_indicator_transform.py
@@ -32,7 +32,7 @@ class TestPerformace(TestCase):
"""Transform: Cube"""
result = pandas_ta.cube(self.close)
self.assertIsInstance(result, DataFrame)
- self.assertEqual(result.name, "CUBE_3.0_1")
+ self.assertEqual(result.name, "CUBE_3.0_-1")
def test_inverse_fisher(self):
"""Transform: Inverse Fisher"""
diff --git a/tests/test_indicator_trend.py b/tests/test_indicator_trend.py
index 5fbd0c0..791c250 100644
--- a/tests/test_indicator_trend.py
+++ b/tests/test_indicator_trend.py
@@ -47,7 +47,7 @@ class TestTrend(TestCase):
pdt.assert_series_equal(result.iloc[:, 0], expected)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -74,13 +74,13 @@ class TestTrend(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- aroond_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0], col=CORRELATION)
+ aroond_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:, 0])
self.assertGreater(aroond_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex)
try:
- aroonu_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1], col=CORRELATION)
+ aroonu_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:, 1])
self.assertGreater(aroonu_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 1], CORRELATION, ex, newline=False)
@@ -100,7 +100,7 @@ class TestTrend(TestCase):
pdt.assert_series_equal(result.iloc[:, 2], expected)
except AssertionError:
try:
- aroond_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,2], expected,col=CORRELATION)
+ aroond_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,2], expected)
self.assertGreater(aroond_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex)
@@ -183,11 +183,11 @@ class TestTrend(TestCase):
try:
expected = tal.SAR(self.high, self.low)
- psar_corr = pandas_ta.utils.df_error_analysis(psar, expected, col=CORRELATION)
+ psar_corr = pandas_ta.utils.df_error_analysis(psar, expected)
pdt.assert_series_equal(psar, expected)
except AssertionError:
try:
- psar_corr = pandas_ta.utils.df_error_analysis(psar, expected, col=CORRELATION)
+ psar_corr = pandas_ta.utils.df_error_analysis(psar, expected)
self.assertGreater(psar_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(psar, CORRELATION, ex)
diff --git a/tests/test_indicator_volatility.py b/tests/test_indicator_volatility.py
index d7bf6df..6be2197 100644
--- a/tests/test_indicator_volatility.py
+++ b/tests/test_indicator_volatility.py
@@ -58,7 +58,7 @@ class TestVolatility(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -79,19 +79,19 @@ class TestVolatility(TestCase):
pdt.assert_frame_equal(result, expecteddf)
except AssertionError:
try:
- bbl_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:,0], col=CORRELATION)
+ bbl_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 0], expecteddf.iloc[:,0])
self.assertGreater(bbl_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 0], CORRELATION, ex)
try:
- bbm_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:,1], col=CORRELATION)
+ bbm_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 1], expecteddf.iloc[:,1])
self.assertGreater(bbm_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 1], CORRELATION, ex, newline=False)
try:
- bbu_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 2], expecteddf.iloc[:,2], col=CORRELATION)
+ bbu_corr = pandas_ta.utils.df_error_analysis(result.iloc[:, 2], expecteddf.iloc[:,2])
self.assertGreater(bbu_corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result.iloc[:, 2], CORRELATION, ex, newline=False)
@@ -151,7 +151,7 @@ class TestVolatility(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -197,7 +197,7 @@ class TestVolatility(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
diff --git a/tests/test_indicator_volume.py b/tests/test_indicator_volume.py
index edeceab..142f82e 100644
--- a/tests/test_indicator_volume.py
+++ b/tests/test_indicator_volume.py
@@ -46,7 +46,7 @@ class TestVolume(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -72,7 +72,7 @@ class TestVolume(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -124,7 +124,7 @@ class TestVolume(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)
@@ -150,7 +150,7 @@ class TestVolume(TestCase):
pdt.assert_series_equal(result, expected, check_names=False)
except AssertionError:
try:
- corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION)
+ corr = pandas_ta.utils.df_error_analysis(result, expected)
self.assertGreater(corr, CORRELATION_THRESHOLD)
except Exception as ex:
error_analysis(result, CORRELATION, ex)