mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-08-19 12:30:41 +08:00
all overlap indicators fully typed
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# from numpy import nan as npNaN
|
||||
from pandas import DataFrame
|
||||
from pandas import DataFrame, Series
|
||||
from .smma import smma
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def alligator(close, jaw=None, teeth=None, lips=None, talib=None, offset=None, **kwargs):
|
||||
def alligator(close: Series, jaw: int = None, teeth: int = None, lips: int = None, talib: bool = None,
|
||||
offset: int = None, **kwargs) -> DataFrame:
|
||||
"""Bill Williams Alligator (ALLIGATOR)
|
||||
|
||||
The Alligator Indicator was developed by Bill Williams and combines moving
|
||||
|
||||
@@ -11,7 +11,8 @@ from pandas import Series
|
||||
from pandas_ta.utils import get_offset, strided_window, verify_series
|
||||
|
||||
|
||||
def alma(close, length=None, sigma=None, dist_offset=None, offset=None, **kwargs):
|
||||
def alma(close: Series, length: int = None, sigma: float = None, dist_offset: float = None, offset: int = None,
|
||||
**kwargs) -> Series:
|
||||
"""Arnaud Legoux Moving Average (ALMA)
|
||||
|
||||
The ALMA moving average uses the curve of the Normal (Gauss) distribution, which
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
from .ema import ema
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def dema(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def dema(close: Series, length: int = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Double Exponential Moving Average (DEMA)
|
||||
|
||||
The Double Exponential Moving Average attempts to a smoother average with less
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
from numpy import nan as npNaN
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def ema(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def ema(close: Series, length: int = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Exponential Moving Average (EMA)
|
||||
|
||||
The Exponential Moving Average is more responsive moving average compared to the
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import fibonacci, get_offset, verify_series, weights
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def fwma(close, length=None, asc=None, offset=None, **kwargs):
|
||||
def fwma(close: Series, length: int = None, asc: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Fibonacci's Weighted Moving Average (FWMA)
|
||||
|
||||
Fibonacci's Weighted Moving Average is similar to a Weighted Moving Average
|
||||
|
||||
@@ -5,7 +5,8 @@ from .ma import ma
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
|
||||
def hilo(high: Series, low: Series, close: Series, high_length: int = None, low_length: int = None,
|
||||
mamode: str = None, offset: int = None, **kwargs) -> DataFrame:
|
||||
"""Gann HiLo Activator(HiLo)
|
||||
|
||||
The Gann High Low Activator Indicator was created by Robert Krausz in a 1998
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def hl2(high, low, offset=None, **kwargs):
|
||||
def hl2(high: Series, low: Series, offset: int = None, **kwargs) -> Series:
|
||||
"""HL2
|
||||
|
||||
HL2 is the midpoint/average of high and low.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def hlc3(high, low, close, talib=None, offset=None, **kwargs):
|
||||
def hlc3(high: Series, low: Series, close: Series, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""HLC3
|
||||
|
||||
HLC3 is the average of high, low and close.
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
from numpy import sqrt as npSqrt
|
||||
from .wma import wma
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def hma(close, length=None, offset=None, **kwargs):
|
||||
def hma(close: Series, length: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Hull Moving Average (HMA)
|
||||
|
||||
The Hull Exponential Moving Average attempts to reduce or remove lag in moving
|
||||
|
||||
@@ -3,7 +3,7 @@ from pandas import Series
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def hwma(close, na=None, nb=None, nc=None, offset=None, **kwargs):
|
||||
def hwma(close: Series, na: float = None, nb: float = None, nc: float = None, offset: int = None, **kwargs) -> Series:
|
||||
"""HWMA (Holt-Winter Moving Average)
|
||||
|
||||
Indicator HWMA (Holt-Winter Moving Average) is a three-parameter moving average
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas import date_range, DataFrame, RangeIndex, Timedelta
|
||||
from pandas import date_range, DataFrame, RangeIndex, Timedelta, Series
|
||||
from .midprice import midprice
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def ichimoku(high, low, close, tenkan=None, kijun=None, senkou=None, include_chikou=True, offset=None, **kwargs):
|
||||
def ichimoku(high: Series, low: Series, close: Series, tenkan: int = None, kijun: int = None, senkou: int = None,
|
||||
include_chikou: bool = True, offset: int = None, **kwargs) -> DataFrame:
|
||||
"""Ichimoku Kinkō Hyō (ichimoku)
|
||||
|
||||
Developed Pre WWII as a forecasting model for financial markets.
|
||||
|
||||
@@ -9,7 +9,7 @@ from pandas import Series
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def jma(close, length=None, phase=None, offset=None, **kwargs):
|
||||
def jma(close: Series, length: int = None, phase: float = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Jurik Moving Average Average (JMA)
|
||||
|
||||
Mark Jurik's Moving Average (JMA) attempts to eliminate noise to see the "true"
|
||||
|
||||
@@ -5,7 +5,8 @@ from pandas_ta.overlap.ma import ma
|
||||
from pandas_ta.utils import get_drift, get_offset, non_zero_range, verify_series
|
||||
|
||||
|
||||
def kama(close, length=None, fast=None, slow=None, mamode=None, drift=None, offset=None, **kwargs):
|
||||
def kama(close: Series, length: int = None, fast: int = None, slow: int = None, mamode: str = None,
|
||||
drift: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Kaufman's Adaptive Moving Average (KAMA)
|
||||
|
||||
Developed by Perry Kaufman, Kaufman's Adaptive Moving Average (KAMA) is a moving average
|
||||
|
||||
@@ -9,7 +9,7 @@ from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, strided_window, verify_series
|
||||
|
||||
|
||||
def linreg(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def linreg(close: Series, length: int = None, talib: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Linear Regression Moving Average (linreg)
|
||||
|
||||
Linear Regression Moving Average (LINREG). This is a simplified version of a
|
||||
|
||||
@@ -19,7 +19,7 @@ from .vidya import vidya
|
||||
from .wma import wma
|
||||
|
||||
|
||||
def ma(name:str = None, source:Series = None, **kwargs) -> Series:
|
||||
def ma(name: str = None, source: Series = None, **kwargs) -> Series:
|
||||
"""Simple MA Utility for easier MA selection
|
||||
|
||||
Available MAs:
|
||||
@@ -50,7 +50,7 @@ def ma(name:str = None, source:Series = None, **kwargs) -> Series:
|
||||
return _mas
|
||||
elif isinstance(name, str) and name.lower() in _mas:
|
||||
name = name.lower()
|
||||
else: # "ema"
|
||||
else: # "ema"
|
||||
name = _mas[1]
|
||||
|
||||
if name == "dema": return dema(source, **kwargs)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def mcgd(close, length=None, offset=None, c=None, **kwargs):
|
||||
def mcgd(close: Series, length: int = None, offset: int = None, c: float = None, **kwargs) -> Series:
|
||||
"""McGinley Dynamic Indicator
|
||||
|
||||
The McGinley Dynamic looks like a moving average line, yet it is actually a
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def midpoint(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def midpoint(close: Series, length: int = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Midpoint
|
||||
|
||||
The Midpoint is the average of the rolling high and low of period length.
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def midprice(high, low, length=None, talib=None, offset=None, **kwargs):
|
||||
def midprice(high: Series, low: Series, length: int = None, talib: bool = None, offset: int = None,
|
||||
**kwargs) -> Series:
|
||||
"""Midprice
|
||||
|
||||
The Midprice is the average of the rolling high and low of period length.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def ohlc4(open_, high, low, close, offset=None, **kwargs):
|
||||
def ohlc4(open_: Series, high: Series, low: Series, close: Series, offset: int = None, **kwargs) -> Series:
|
||||
"""OHLC4
|
||||
|
||||
OHLC4 is the average of open, high, low and close.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import get_offset, pascals_triangle, verify_series, weights
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def pwma(close, length=None, asc=None, offset=None, **kwargs):
|
||||
def pwma(close: Series, length: int = None, asc: bool = None, offset: bool = None, **kwargs) -> Series:
|
||||
"""Pascal's Weighted Moving Average (PWMA)
|
||||
|
||||
Pascal's Weighted Moving Average is similar to a symmetric triangular window
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def rma(close, length=None, offset=None, **kwargs):
|
||||
def rma(close: Series, length: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""wildeR's Moving Average (RMA)
|
||||
|
||||
The WildeR's Moving Average is simply an Exponential Moving Average (EMA) with
|
||||
|
||||
@@ -5,7 +5,7 @@ from pandas import Series
|
||||
from pandas_ta.utils import get_offset, verify_series, weights
|
||||
|
||||
|
||||
def sinwma(close, length=None, offset=None, **kwargs):
|
||||
def sinwma(close: Series, length: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Sine Weighted Moving Average (SWMA)
|
||||
|
||||
A weighted average using sine cycles. The middle term(s) of the average have the
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def sma(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def sma(close: Series, length: int = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Simple Moving Average (SMA)
|
||||
|
||||
The Simple Moving Average is the classic moving average that is the equally
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from numpy import nan as npNaN
|
||||
from pandas_ta.overlap.ma import ma
|
||||
from pandas import Series
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def smma(close, length=None, mamode=None, talib=None, offset=None, **kwargs):
|
||||
def smma(close: Series, length: int = None, mamode: str = None, talib: bool = None, offset: int = None,
|
||||
**kwargs) -> Series:
|
||||
"""SMoothed Moving Average (SMMA)
|
||||
|
||||
The SMoothed Moving Average (SMMA) is bootstrapped by default with a Simple
|
||||
|
||||
@@ -5,9 +5,10 @@ from numpy import nan as npNaN
|
||||
from numpy import pi as npPi
|
||||
from numpy import sqrt as npSqrt
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def ssf(close, length=None, poles=None, offset=None, **kwargs):
|
||||
def ssf(close: Series, length: int = None, poles: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Ehler's Super Smoother Filter (SSF) © 2013
|
||||
|
||||
John F. Ehlers's solution to reduce lag and remove aliasing noise with his
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from numpy import nan as npNaN
|
||||
from pandas import DataFrame
|
||||
from pandas import DataFrame, Series
|
||||
from pandas_ta.overlap import hl2
|
||||
from pandas_ta.volatility import atr
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def supertrend(high, low, close, length=None, multiplier=None, offset=None, **kwargs):
|
||||
def supertrend(high: Series, low: Series, close: Series, length: int = None, multiplier: float = None,
|
||||
offset: int = None, **kwargs) -> DataFrame:
|
||||
"""Supertrend (supertrend)
|
||||
|
||||
Supertrend is an overlap indicator. It is used to help identify trend
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta.utils import get_offset, symmetric_triangle, verify_series, weights
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def swma(close, length=None, asc=None, offset=None, **kwargs):
|
||||
def swma(close: Series, length: int = None, asc: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Symmetric Weighted Moving Average (SWMA)
|
||||
|
||||
Symmetric Weighted Moving Average where weights are based on a symmetric
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
from .ema import ema
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def t3(close, length=None, a=None, talib=None, offset=None, **kwargs):
|
||||
def t3(close: Series, length: int = None, a: float = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Tim Tillson's T3 Moving Average (T3)
|
||||
|
||||
Tim Tillson's T3 Moving Average is considered a smoother and more responsive
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
from .ema import ema
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def tema(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def tema(close: Series, length: int = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Triple Exponential Moving Average (TEMA)
|
||||
|
||||
A less laggy Exponential Moving Average.
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
from .sma import sma
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def trima(close, length=None, talib=None, offset=None, **kwargs):
|
||||
def trima(close: Series, length: int = None, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Triangular Moving Average (TRIMA)
|
||||
|
||||
A weighted moving average where the shape of the weights are triangular and the
|
||||
|
||||
@@ -4,7 +4,7 @@ from pandas import Series
|
||||
from pandas_ta.utils import get_drift, get_offset, verify_series
|
||||
|
||||
|
||||
def vidya(close, length=None, drift=None, offset=None, **kwargs):
|
||||
def vidya(close: Series, length: int = None, drift: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Variable Index Dynamic Average (VIDYA)
|
||||
|
||||
Variable Index Dynamic Average (VIDYA) was developed by Tushar Chande. It is
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from .hlc3 import hlc3
|
||||
from pandas_ta.utils import get_offset, is_datetime_ordered, verify_series
|
||||
from pandas import Series
|
||||
|
||||
def vwap(high, low, close, volume, anchor=None, offset=None, **kwargs):
|
||||
|
||||
def vwap(high: Series, low: Series, close: Series, volume: Series, anchor: str = None, offset: int = None,
|
||||
**kwargs) -> Series:
|
||||
"""Volume Weighted Average Price (VWAP)
|
||||
|
||||
The Volume Weighted Average Price that measures the average typical price
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from .sma import sma
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def vwma(close, volume, length=None, offset=None, **kwargs):
|
||||
def vwma(close: Series, volume: Series, length: int = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Volume Weighted Moving Average (VWMA)
|
||||
|
||||
Volume Weighted Moving Average.
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def wcp(high, low, close, talib=None, offset=None, **kwargs):
|
||||
def wcp(high: Series, low: Series, close: Series, talib: bool = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Weighted Closing Price (WCP)
|
||||
|
||||
Weighted Closing Price is the weighted price given: high, low
|
||||
|
||||
@@ -4,7 +4,8 @@ from pandas_ta import Imports
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
|
||||
|
||||
def wma(close, length=None, asc=None, talib=None, offset=None, **kwargs):
|
||||
def wma(close: Series, length: int = None, asc: bool = None, talib: bool = None, offset: int = None,
|
||||
**kwargs) -> Series:
|
||||
"""Weighted Moving Average (WMA)
|
||||
|
||||
The Weighted Moving Average where the weights are linearly increasing and
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
# )
|
||||
from pandas_ta.overlap import ma
|
||||
from pandas_ta.utils import get_offset, verify_series
|
||||
from pandas import Series
|
||||
|
||||
|
||||
def zlma(close, length=None, mamode=None, offset=None, **kwargs):
|
||||
def zlma(close: Series, length: int = None, mamode: str = None, offset: int = None, **kwargs) -> Series:
|
||||
"""Zero Lag Moving Average (ZLMA)
|
||||
|
||||
The Zero Lag Moving Average attempts to eliminate the lag associated
|
||||
|
||||
Reference in New Issue
Block a user