feat: add length->period kwargs alias across all 168 indicator functions for pandas-ta compat

This commit is contained in:
Miha Kralj
2026-03-02 10:00:29 -08:00
parent ae7207c3d8
commit 18694e337e
16 changed files with 211 additions and 168 deletions
+17 -17
View File
@@ -36,7 +36,7 @@ __all__ = [
def aberr(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def aberr(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Aberration Bands.""" """Aberration Bands."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -50,7 +50,7 @@ def aberr(close: object, period: int = 14, multiplier: float = 2.0, offset: int
def accbands(high: object, low: object, close: object, period: int = 14, factor: float = 2.0, offset: int = 0, **kwargs) -> object: def accbands(high: object, low: object, close: object, period: int = 14, factor: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Acceleration Bands.""" """Acceleration Bands."""
period = int(period) period = int(kwargs.get("length", period))
factor = float(factor) factor = float(factor)
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
@@ -64,7 +64,7 @@ def accbands(high: object, low: object, close: object, period: int = 14, factor:
def apz(open: object, high: object, low: object, close: object, volume: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def apz(open: object, high: object, low: object, close: object, volume: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Adaptive Price Zone.""" """Adaptive Price Zone."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
@@ -79,7 +79,7 @@ def apz(open: object, high: object, low: object, close: object, volume: object,
def dchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def dchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Donchian Channel.""" """Donchian Channel."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -92,7 +92,7 @@ def dchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwa
def decaychannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def decaychannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Decay Channel.""" """Decay Channel."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -105,7 +105,7 @@ def decaychannel(high: object, low: object, period: int = 14, offset: int = 0, *
def fcb(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def fcb(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Fractal Chaos Bands.""" """Fractal Chaos Bands."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -118,7 +118,7 @@ def fcb(high: object, low: object, period: int = 14, offset: int = 0, **kwargs)
def jbands(close: object, period: int = 14, phase: int = 0, offset: int = 0, **kwargs) -> object: def jbands(close: object, period: int = 14, phase: int = 0, offset: int = 0, **kwargs) -> object:
"""J-Line Bands.""" """J-Line Bands."""
period = int(period) period = int(kwargs.get("length", period))
phase = int(phase) phase = int(phase)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -132,7 +132,7 @@ def jbands(close: object, period: int = 14, phase: int = 0, offset: int = 0, **k
def kchannel(high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def kchannel(high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Keltner Channel.""" """Keltner Channel."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
@@ -146,7 +146,7 @@ def kchannel(high: object, low: object, close: object, period: int = 14, multipl
def maenv(close: object, period: int = 14, percentage: float = 2.5, maType: int = 0, offset: int = 0, **kwargs) -> object: def maenv(close: object, period: int = 14, percentage: float = 2.5, maType: int = 0, offset: int = 0, **kwargs) -> object:
"""Moving Average Envelope.""" """Moving Average Envelope."""
period = int(period) period = int(kwargs.get("length", period))
percentage = float(percentage) percentage = float(percentage)
maType = int(maType) maType = int(maType)
offset = int(offset) offset = int(offset)
@@ -161,7 +161,7 @@ def maenv(close: object, period: int = 14, percentage: float = 2.5, maType: int
def mmchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mmchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Min-Max Channel.""" """Min-Max Channel."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -173,7 +173,7 @@ def mmchannel(high: object, low: object, period: int = 14, offset: int = 0, **kw
def pchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def pchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Price Channel.""" """Price Channel."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -186,7 +186,7 @@ def pchannel(high: object, low: object, period: int = 14, offset: int = 0, **kwa
def regchannel(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def regchannel(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Regression Channel.""" """Regression Channel."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -200,7 +200,7 @@ def regchannel(close: object, period: int = 14, multiplier: float = 2.0, offset:
def sdchannel(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def sdchannel(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Standard Deviation Channel.""" """Standard Deviation Channel."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -214,7 +214,7 @@ def sdchannel(close: object, period: int = 14, multiplier: float = 2.0, offset:
def starchannel(high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, atrPeriod: int = 22, offset: int = 0, **kwargs) -> object: def starchannel(high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, atrPeriod: int = 22, offset: int = 0, **kwargs) -> object:
"""Stoller Average Range Channel (STARC).""" """Stoller Average Range Channel (STARC)."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
atrPeriod = int(atrPeriod) atrPeriod = int(atrPeriod)
offset = int(offset) offset = int(offset)
@@ -229,7 +229,7 @@ def starchannel(high: object, low: object, close: object, period: int = 14, mult
def stbands(high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def stbands(high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""SuperTrend Bands.""" """SuperTrend Bands."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
@@ -243,7 +243,7 @@ def stbands(high: object, low: object, close: object, period: int = 14, multipli
def ttm_lrc(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ttm_lrc(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""TTM Linear Regression Channel.""" """TTM Linear Regression Channel."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -258,7 +258,7 @@ def ttm_lrc(close: object, period: int = 14, offset: int = 0, **kwargs) -> objec
def ubands(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def ubands(close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Upper/Lower Bands.""" """Upper/Lower Bands."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
+2 -2
View File
@@ -34,7 +34,7 @@ def ha(open: object, high: object, low: object, close: object, offset: int = 0,
def midpoint(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def midpoint(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Midpoint = src[i] over period.""" """Midpoint = src[i] over period."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -45,7 +45,7 @@ def midpoint(close: object, period: int = 14, offset: int = 0, **kwargs) -> obje
def midprice(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def midprice(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mid Price = (High+Low)/2 over period.""" """Mid Price = (High+Low)/2 over period."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
+1 -1
View File
@@ -100,7 +100,7 @@ def solar(close: object, offset: int = 0, **kwargs) -> object:
def ssfdsp(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ssfdsp(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Supersmoother DSP.""" """Supersmoother DSP."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
+14 -14
View File
@@ -34,7 +34,7 @@ __all__ = [
def adx(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def adx(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Average Directional Index.""" """Average Directional Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -45,7 +45,7 @@ def adx(high: object, low: object, close: object, period: int = 14, offset: int
def adxr(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def adxr(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""ADX Rating.""" """ADX Rating."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -86,7 +86,7 @@ def amat(close: object, fastPeriod: int = 12, slowPeriod: int = 26, offset: int
def aroon(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def aroon(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Aroon.""" """Aroon."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -97,7 +97,7 @@ def aroon(high: object, low: object, period: int = 14, offset: int = 0, **kwargs
def aroonosc(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object: def aroonosc(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Aroon Oscillator.""" """Aroon Oscillator."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low) h, idx = _arr(high); l, _ = _arr(low)
n = len(h) n = len(h)
@@ -108,7 +108,7 @@ def aroonosc(high: object, low: object, period: int = 14, offset: int = 0, **kwa
def chop(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def chop(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Choppiness Index.""" """Choppiness Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -120,7 +120,7 @@ def chop(open: object, high: object, low: object, close: object, volume: object,
def dmx(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def dmx(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Directional Movement Extended.""" """Directional Movement Extended."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -131,7 +131,7 @@ def dmx(high: object, low: object, close: object, period: int = 14, offset: int
def dx(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def dx(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Directional Movement Index.""" """Directional Movement Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -142,7 +142,7 @@ def dx(high: object, low: object, close: object, period: int = 14, offset: int =
def ghla(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ghla(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Gann Hi-Lo Activator.""" """Gann Hi-Lo Activator."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -196,7 +196,7 @@ def impulse(close: object, emaPeriod: int = 13, macdFast: int = 12, macdSlow: in
def pfe(close: object, period: int = 14, smoothPeriod: int = 5, offset: int = 0, **kwargs) -> object: def pfe(close: object, period: int = 14, smoothPeriod: int = 5, offset: int = 0, **kwargs) -> object:
"""Polarized Fractal Efficiency.""" """Polarized Fractal Efficiency."""
period = int(period) period = int(kwargs.get("length", period))
smoothPeriod = int(smoothPeriod) smoothPeriod = int(smoothPeriod)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -208,7 +208,7 @@ def pfe(close: object, period: int = 14, smoothPeriod: int = 5, offset: int = 0,
def qstick(open: object, high: object, low: object, close: object, volume: object, period: int = 14, useEma: int = 0, offset: int = 0, **kwargs) -> object: def qstick(open: object, high: object, low: object, close: object, volume: object, period: int = 14, useEma: int = 0, offset: int = 0, **kwargs) -> object:
"""QStick.""" """QStick."""
period = int(period) period = int(kwargs.get("length", period))
useEma = int(useEma) useEma = int(useEma)
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
@@ -233,7 +233,7 @@ def ravi(close: object, shortPeriod: int = 12, longPeriod: int = 26, offset: int
def supertrend(open: object, high: object, low: object, close: object, volume: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def supertrend(open: object, high: object, low: object, close: object, volume: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""SuperTrend.""" """SuperTrend."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
@@ -262,7 +262,7 @@ def ttm_squeeze(open: object, high: object, low: object, close: object, volume:
def ttm_trend(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ttm_trend(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""TTM Trend.""" """TTM Trend."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -274,7 +274,7 @@ def ttm_trend(open: object, high: object, low: object, close: object, volume: ob
def vhf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vhf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Vertical Horizontal Filter.""" """Vertical Horizontal Filter."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -285,7 +285,7 @@ def vhf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def vortex(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vortex(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Vortex Indicator.""" """Vortex Indicator."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
+22 -22
View File
@@ -39,7 +39,7 @@ __all__ = [
def huber(actual: object, predicted: object, period: int = 14, delta: float = 1.35, offset: int = 0, **kwargs) -> object: def huber(actual: object, predicted: object, period: int = 14, delta: float = 1.35, offset: int = 0, **kwargs) -> object:
"""Huber Loss.""" """Huber Loss."""
period = int(period) period = int(kwargs.get("length", period))
delta = float(delta) delta = float(delta)
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
@@ -51,7 +51,7 @@ def huber(actual: object, predicted: object, period: int = 14, delta: float = 1.
def logcosh(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def logcosh(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Log-Cosh Loss.""" """Log-Cosh Loss."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -62,7 +62,7 @@ def logcosh(actual: object, predicted: object, period: int = 14, offset: int = 0
def maape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def maape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Arctangent Absolute Percentage Error.""" """Mean Arctangent Absolute Percentage Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -73,7 +73,7 @@ def maape(actual: object, predicted: object, period: int = 14, offset: int = 0,
def mapd(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mapd(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Absolute Percentage Deviation.""" """Mean Absolute Percentage Deviation."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -84,7 +84,7 @@ def mapd(actual: object, predicted: object, period: int = 14, offset: int = 0, *
def mase(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mase(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Absolute Scaled Error.""" """Mean Absolute Scaled Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -95,7 +95,7 @@ def mase(actual: object, predicted: object, period: int = 14, offset: int = 0, *
def mdae(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mdae(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Median Absolute Error.""" """Median Absolute Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -106,7 +106,7 @@ def mdae(actual: object, predicted: object, period: int = 14, offset: int = 0, *
def mdape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mdape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Median Absolute Percentage Error.""" """Median Absolute Percentage Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -117,7 +117,7 @@ def mdape(actual: object, predicted: object, period: int = 14, offset: int = 0,
def me(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def me(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Error.""" """Mean Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -128,7 +128,7 @@ def me(actual: object, predicted: object, period: int = 14, offset: int = 0, **k
def mpe(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mpe(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Percentage Error.""" """Mean Percentage Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -139,7 +139,7 @@ def mpe(actual: object, predicted: object, period: int = 14, offset: int = 0, **
def mrae(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mrae(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Relative Absolute Error.""" """Mean Relative Absolute Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -150,7 +150,7 @@ def mrae(actual: object, predicted: object, period: int = 14, offset: int = 0, *
def msle(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def msle(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Squared Logarithmic Error.""" """Mean Squared Logarithmic Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -161,7 +161,7 @@ def msle(actual: object, predicted: object, period: int = 14, offset: int = 0, *
def pseudohuber(actual: object, predicted: object, period: int = 14, delta: float = 1.35, offset: int = 0, **kwargs) -> object: def pseudohuber(actual: object, predicted: object, period: int = 14, delta: float = 1.35, offset: int = 0, **kwargs) -> object:
"""Pseudo-Huber Loss.""" """Pseudo-Huber Loss."""
period = int(period) period = int(kwargs.get("length", period))
delta = float(delta) delta = float(delta)
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
@@ -173,7 +173,7 @@ def pseudohuber(actual: object, predicted: object, period: int = 14, delta: floa
def quantileloss(actual: object, predicted: object, period: int = 14, quantile: float = 0.5, offset: int = 0, **kwargs) -> object: def quantileloss(actual: object, predicted: object, period: int = 14, quantile: float = 0.5, offset: int = 0, **kwargs) -> object:
"""Quantile Loss (Pinball Loss).""" """Quantile Loss (Pinball Loss)."""
period = int(period) period = int(kwargs.get("length", period))
quantile = float(quantile) quantile = float(quantile)
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
@@ -185,7 +185,7 @@ def quantileloss(actual: object, predicted: object, period: int = 14, quantile:
def rae(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rae(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Relative Absolute Error.""" """Relative Absolute Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -196,7 +196,7 @@ def rae(actual: object, predicted: object, period: int = 14, offset: int = 0, **
def rmsle(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rmsle(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Root Mean Squared Logarithmic Error.""" """Root Mean Squared Logarithmic Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -207,7 +207,7 @@ def rmsle(actual: object, predicted: object, period: int = 14, offset: int = 0,
def rse(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rse(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Relative Squared Error.""" """Relative Squared Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -218,7 +218,7 @@ def rse(actual: object, predicted: object, period: int = 14, offset: int = 0, **
def rsquared(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rsquared(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""R-Squared (Coefficient of Determination).""" """R-Squared (Coefficient of Determination)."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -229,7 +229,7 @@ def rsquared(actual: object, predicted: object, period: int = 14, offset: int =
def smape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def smape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Symmetric Mean Absolute Percentage Error.""" """Symmetric Mean Absolute Percentage Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -240,7 +240,7 @@ def smape(actual: object, predicted: object, period: int = 14, offset: int = 0,
def theilu(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def theilu(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Theil U Statistic (Error).""" """Theil U Statistic (Error)."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -251,7 +251,7 @@ def theilu(actual: object, predicted: object, period: int = 14, offset: int = 0,
def tukeybiweight(actual: object, predicted: object, period: int = 14, c: float = 4.685, offset: int = 0, **kwargs) -> object: def tukeybiweight(actual: object, predicted: object, period: int = 14, c: float = 4.685, offset: int = 0, **kwargs) -> object:
"""Tukey Biweight Loss.""" """Tukey Biweight Loss."""
period = int(period) period = int(kwargs.get("length", period))
c = float(c) c = float(c)
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
@@ -263,7 +263,7 @@ def tukeybiweight(actual: object, predicted: object, period: int = 14, c: float
def wmape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def wmape(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Weighted Mean Absolute Percentage Error.""" """Weighted Mean Absolute Percentage Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
@@ -274,7 +274,7 @@ def wmape(actual: object, predicted: object, period: int = 14, offset: int = 0,
def wrmse(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object: def wrmse(actual: object, predicted: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Weighted Root Mean Squared Error.""" """Weighted Root Mean Squared Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
a, idx = _arr(actual); p, _ = _arr(predicted) a, idx = _arr(actual); p, _ = _arr(predicted)
n = len(a) n = len(a)
+11 -11
View File
@@ -127,7 +127,7 @@ def lms(close: object, order: int = 16, mu: float = 0.5, offset: int = 0, **kwar
def loess(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def loess(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""LOESS Smoother.""" """LOESS Smoother."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -138,7 +138,7 @@ def loess(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def modf(close: object, period: int = 14, beta: float = 0.8, feedback: int = 0, fbWeight: float = 0.5, offset: int = 0, **kwargs) -> object: def modf(close: object, period: int = 14, beta: float = 0.8, feedback: int = 0, fbWeight: float = 0.5, offset: int = 0, **kwargs) -> object:
"""Modified Filter.""" """Modified Filter."""
period = int(period) period = int(kwargs.get("length", period))
beta = float(beta) beta = float(beta)
feedback = int(feedback) feedback = int(feedback)
fbWeight = float(fbWeight) fbWeight = float(fbWeight)
@@ -152,7 +152,7 @@ def modf(close: object, period: int = 14, beta: float = 0.8, feedback: int = 0,
def notch(close: object, period: int = 14, q: float = 1.0, offset: int = 0, **kwargs) -> object: def notch(close: object, period: int = 14, q: float = 1.0, offset: int = 0, **kwargs) -> object:
"""Notch Filter.""" """Notch Filter."""
period = int(period) period = int(kwargs.get("length", period))
q = float(q) q = float(q)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -164,7 +164,7 @@ def notch(close: object, period: int = 14, q: float = 1.0, offset: int = 0, **kw
def nw(close: object, period: int = 64, bandwidth: float = 8.0, offset: int = 0, **kwargs) -> object: def nw(close: object, period: int = 64, bandwidth: float = 8.0, offset: int = 0, **kwargs) -> object:
"""Nadaraya-Watson Filter.""" """Nadaraya-Watson Filter."""
period = int(period) period = int(kwargs.get("length", period))
bandwidth = float(bandwidth) bandwidth = float(bandwidth)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -201,7 +201,7 @@ def rls(close: object, order: int = 16, lam: float = 0.99, offset: int = 0, **kw
def rmed(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rmed(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Running Median Filter.""" """Running Median Filter."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -224,7 +224,7 @@ def roofing(close: object, hpLength: int = 48, ssLength: int = 10, offset: int =
def sgf(close: object, period: int = 14, polyOrder: int = 2, offset: int = 0, **kwargs) -> object: def sgf(close: object, period: int = 14, polyOrder: int = 2, offset: int = 0, **kwargs) -> object:
"""Savitzky-Golay Filter.""" """Savitzky-Golay Filter."""
period = int(period) period = int(kwargs.get("length", period))
polyOrder = int(polyOrder) polyOrder = int(polyOrder)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -249,7 +249,7 @@ def spbf(close: object, shortPeriod: int = 40, longPeriod: int = 60, rmsPeriod:
def ssf2(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ssf2(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Super Smoother (2-pole).""" """Super Smoother (2-pole)."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -260,7 +260,7 @@ def ssf2(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def ssf3(close: object, period: int = 14, initialLast: float = 0.0, offset: int = 0, **kwargs) -> object: def ssf3(close: object, period: int = 14, initialLast: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Super Smoother (3-pole).""" """Super Smoother (3-pole)."""
period = int(period) period = int(kwargs.get("length", period))
initialLast = float(initialLast) initialLast = float(initialLast)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -272,7 +272,7 @@ def ssf3(close: object, period: int = 14, initialLast: float = 0.0, offset: int
def usf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def usf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Universal Smoother Filter.""" """Universal Smoother Filter."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -283,7 +283,7 @@ def usf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def voss(close: object, period: int = 14, predict: int = 3, bandwidth: float = 0.25, offset: int = 0, **kwargs) -> object: def voss(close: object, period: int = 14, predict: int = 3, bandwidth: float = 0.25, offset: int = 0, **kwargs) -> object:
"""Voss Predictor.""" """Voss Predictor."""
period = int(period) period = int(kwargs.get("length", period))
predict = int(predict) predict = int(predict)
bandwidth = float(bandwidth) bandwidth = float(bandwidth)
offset = int(offset) offset = int(offset)
@@ -308,7 +308,7 @@ def wavelet(close: object, levels: int = 4, threshMult: float = 1.0, offset: int
def wiener(close: object, period: int = 14, smoothPeriod: int = 10, offset: int = 0, **kwargs) -> object: def wiener(close: object, period: int = 14, smoothPeriod: int = 10, offset: int = 0, **kwargs) -> object:
"""Wiener Filter.""" """Wiener Filter."""
period = int(period) period = int(kwargs.get("length", period))
smoothPeriod = int(smoothPeriod) smoothPeriod = int(smoothPeriod)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
+4 -4
View File
@@ -43,7 +43,7 @@ def bop(open: object, high: object, low: object, close: object, offset: int = 0,
def cci(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def cci(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Commodity Channel Index.""" """Commodity Channel Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -103,7 +103,7 @@ def prs(x: object, y: object, smoothPeriod: int = 5, offset: int = 0, **kwargs)
def rocp(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rocp(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Rate of Change (Percentage).""" """Rate of Change (Percentage)."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -114,7 +114,7 @@ def rocp(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def rocr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rocr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Rate of Change (Ratio).""" """Rate of Change (Ratio)."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -137,7 +137,7 @@ def sam(close: object, alpha: float = 0.07, cutoff: int = 8, offset: int = 0, **
def vel(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vel(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Velocity.""" """Velocity."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
+10 -10
View File
@@ -52,7 +52,7 @@ def fdist(close: object, d1: int = 1, d2: int = 1, period: int = 14, offset: int
"""F-Distribution.""" """F-Distribution."""
d1 = int(d1) d1 = int(d1)
d2 = int(d2) d2 = int(d2)
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -78,7 +78,7 @@ def gammadist(close: object, alpha: float = 2.0, beta: float = 1.0, period: int
"""Gamma Distribution.""" """Gamma Distribution."""
alpha = float(alpha) alpha = float(alpha)
beta = float(beta) beta = float(beta)
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -89,7 +89,7 @@ def gammadist(close: object, alpha: float = 2.0, beta: float = 1.0, period: int
def highest(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def highest(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Highest Value.""" """Highest Value."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -136,7 +136,7 @@ def lognormdist(close: object, mu: float = 0.0, sigma: float = 1.0, period: int
"""Log-Normal Distribution.""" """Log-Normal Distribution."""
mu = float(mu) mu = float(mu)
sigma = float(sigma) sigma = float(sigma)
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -157,7 +157,7 @@ def logtrans(close: object, offset: int = 0, **kwargs) -> object:
def lowest(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def lowest(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Lowest Value.""" """Lowest Value."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -168,7 +168,7 @@ def lowest(close: object, period: int = 14, offset: int = 0, **kwargs) -> object
def normalize(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def normalize(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Normalization.""" """Normalization."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -181,7 +181,7 @@ def normdist(close: object, mu: float = 0.0, sigma: float = 1.0, period: int = 1
"""Normal Distribution.""" """Normal Distribution."""
mu = float(mu) mu = float(mu)
sigma = float(sigma) sigma = float(sigma)
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -193,7 +193,7 @@ def normdist(close: object, mu: float = 0.0, sigma: float = 1.0, period: int = 1
def poissondist(close: object, lam: float = 1.0, period: int = 14, threshold: int = 5, offset: int = 0, **kwargs) -> object: def poissondist(close: object, lam: float = 1.0, period: int = 14, threshold: int = 5, offset: int = 0, **kwargs) -> object:
"""Poisson Distribution.""" """Poisson Distribution."""
lam = float(lam) lam = float(lam)
period = int(period) period = int(kwargs.get("length", period))
threshold = int(threshold) threshold = int(threshold)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -248,7 +248,7 @@ def sqrttrans(close: object, offset: int = 0, **kwargs) -> object:
def tdist(close: object, nu: int = 10, period: int = 14, offset: int = 0, **kwargs) -> object: def tdist(close: object, nu: int = 10, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Student's t-Distribution.""" """Student's t-Distribution."""
nu = int(nu) nu = int(nu)
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -261,7 +261,7 @@ def weibulldist(close: object, k: float = 1.5, lam: float = 1.0, period: int = 1
"""Weibull Distribution.""" """Weibull Distribution."""
k = float(k) k = float(k)
lam = float(lam) lam = float(lam)
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
+8 -8
View File
@@ -108,7 +108,7 @@ def coppock(close: object, longRoc: int = 14, shortRoc: int = 11, wmaPeriod: int
def eri(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def eri(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Elder Ray Index.""" """Elder Ray Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -119,7 +119,7 @@ def eri(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def fi(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def fi(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Force Index.""" """Force Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -146,7 +146,7 @@ def gator(close: object, jawPeriod: int = 13, jawShift: int = 8, teethPeriod: in
def imi(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def imi(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Intraday Momentum Index.""" """Intraday Momentum Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -215,7 +215,7 @@ def mstoch(close: object, stochLength: int = 20, hpLength: int = 48, ssLength: i
def pgo(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def pgo(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Pretty Good Oscillator.""" """Pretty Good Oscillator."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -239,7 +239,7 @@ def qqe(close: object, rsiPeriod: int = 14, smoothFactor: int = 5, qqeFactor: fl
def reverseema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def reverseema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Reverse EMA.""" """Reverse EMA."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -250,7 +250,7 @@ def reverseema(close: object, period: int = 14, offset: int = 0, **kwargs) -> ob
def rvgi(open: object, high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rvgi(open: object, high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Relative Vigor Index.""" """Relative Vigor Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low); c, _ = _arr(close) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(o) n = len(o)
@@ -277,7 +277,7 @@ def smi(high: object, low: object, close: object, kPeriod: int = 14, kSmooth: in
def squeeze(high: object, low: object, close: object, period: int = 14, bbMult: float = 2.0, kcMult: float = 1.5, offset: int = 0, **kwargs) -> object: def squeeze(high: object, low: object, close: object, period: int = 14, bbMult: float = 2.0, kcMult: float = 1.5, offset: int = 0, **kwargs) -> object:
"""Squeeze Momentum.""" """Squeeze Momentum."""
period = int(period) period = int(kwargs.get("length", period))
bbMult = float(bbMult) bbMult = float(bbMult)
kcMult = float(kcMult) kcMult = float(kcMult)
offset = int(offset) offset = int(offset)
@@ -369,7 +369,7 @@ def ultosc(high: object, low: object, close: object, period1: int = 14, period2:
def willr(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def willr(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Williams %R.""" """Williams %R."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
+1 -1
View File
@@ -25,7 +25,7 @@ __all__ = [
def chandelier(open: object, high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object: def chandelier(open: object, high: object, low: object, close: object, period: int = 14, multiplier: float = 2.0, offset: int = 0, **kwargs) -> object:
"""Chandelier Exit.""" """Chandelier Exit."""
period = int(period) period = int(kwargs.get("length", period))
multiplier = float(multiplier) multiplier = float(multiplier)
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low); c, _ = _arr(close) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
+26 -26
View File
@@ -45,7 +45,7 @@ __all__ = [
def acf(close: object, period: int = 14, lag: int = 10, offset: int = 0, **kwargs) -> object: def acf(close: object, period: int = 14, lag: int = 10, offset: int = 0, **kwargs) -> object:
"""Autocorrelation Function.""" """Autocorrelation Function."""
period = int(period) period = int(kwargs.get("length", period))
lag = int(lag) lag = int(lag)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -57,7 +57,7 @@ def acf(close: object, period: int = 14, lag: int = 10, offset: int = 0, **kwarg
def geomean(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def geomean(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Geometric Mean.""" """Geometric Mean."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -68,7 +68,7 @@ def geomean(close: object, period: int = 14, offset: int = 0, **kwargs) -> objec
def granger(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -> object: def granger(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Granger Causality.""" """Granger Causality."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
xarr, idx = _arr(x); yarr, _ = _arr(y) xarr, idx = _arr(x); yarr, _ = _arr(y)
n = len(xarr) n = len(xarr)
@@ -79,7 +79,7 @@ def granger(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -
def harmean(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def harmean(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Harmonic Mean.""" """Harmonic Mean."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -90,7 +90,7 @@ def harmean(close: object, period: int = 14, offset: int = 0, **kwargs) -> objec
def hurst(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def hurst(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Hurst Exponent.""" """Hurst Exponent."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -101,7 +101,7 @@ def hurst(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def iqr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def iqr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Interquartile Range.""" """Interquartile Range."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -112,7 +112,7 @@ def iqr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def jb(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def jb(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Jarque-Bera Test.""" """Jarque-Bera Test."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -123,7 +123,7 @@ def jb(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def kendall(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -> object: def kendall(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Kendall Rank Correlation.""" """Kendall Rank Correlation."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
xarr, idx = _arr(x); yarr, _ = _arr(y) xarr, idx = _arr(x); yarr, _ = _arr(y)
n = len(xarr) n = len(xarr)
@@ -134,7 +134,7 @@ def kendall(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -
def kurtosis(close: object, period: int = 14, isPopulation: int = 0, offset: int = 0, **kwargs) -> object: def kurtosis(close: object, period: int = 14, isPopulation: int = 0, offset: int = 0, **kwargs) -> object:
"""Kurtosis.""" """Kurtosis."""
period = int(period) period = int(kwargs.get("length", period))
isPopulation = int(isPopulation) isPopulation = int(isPopulation)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -146,7 +146,7 @@ def kurtosis(close: object, period: int = 14, isPopulation: int = 0, offset: int
def linreg(close: object, period: int = 14, initialLastValid: float = 0.0, offset: int = 0, **kwargs) -> object: def linreg(close: object, period: int = 14, initialLastValid: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Linear Regression.""" """Linear Regression."""
period = int(period) period = int(kwargs.get("length", period))
initialLastValid = float(initialLastValid) initialLastValid = float(initialLastValid)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -158,7 +158,7 @@ def linreg(close: object, period: int = 14, initialLastValid: float = 0.0, offse
def meandev(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def meandev(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Mean Deviation.""" """Mean Deviation."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -169,7 +169,7 @@ def meandev(close: object, period: int = 14, offset: int = 0, **kwargs) -> objec
def median(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def median(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Rolling Median.""" """Rolling Median."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -180,7 +180,7 @@ def median(close: object, period: int = 14, offset: int = 0, **kwargs) -> object
def mode(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mode(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Rolling Mode.""" """Rolling Mode."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -191,7 +191,7 @@ def mode(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def pacf(close: object, period: int = 14, lag: int = 10, offset: int = 0, **kwargs) -> object: def pacf(close: object, period: int = 14, lag: int = 10, offset: int = 0, **kwargs) -> object:
"""Partial Autocorrelation Function.""" """Partial Autocorrelation Function."""
period = int(period) period = int(kwargs.get("length", period))
lag = int(lag) lag = int(lag)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -203,7 +203,7 @@ def pacf(close: object, period: int = 14, lag: int = 10, offset: int = 0, **kwar
def percentile(close: object, period: int = 14, percent: float = 50.0, offset: int = 0, **kwargs) -> object: def percentile(close: object, period: int = 14, percent: float = 50.0, offset: int = 0, **kwargs) -> object:
"""Rolling Percentile.""" """Rolling Percentile."""
period = int(period) period = int(kwargs.get("length", period))
percent = float(percent) percent = float(percent)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -215,7 +215,7 @@ def percentile(close: object, period: int = 14, percent: float = 50.0, offset: i
def polyfit(close: object, period: int = 14, degree: int = 2, initialLastValid: float = 0.0, offset: int = 0, **kwargs) -> object: def polyfit(close: object, period: int = 14, degree: int = 2, initialLastValid: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Polynomial Fit.""" """Polynomial Fit."""
period = int(period) period = int(kwargs.get("length", period))
degree = int(degree) degree = int(degree)
initialLastValid = float(initialLastValid) initialLastValid = float(initialLastValid)
offset = int(offset) offset = int(offset)
@@ -228,7 +228,7 @@ def polyfit(close: object, period: int = 14, degree: int = 2, initialLastValid:
def quantile(close: object, period: int = 14, quantileLevel: float = 0.5, offset: int = 0, **kwargs) -> object: def quantile(close: object, period: int = 14, quantileLevel: float = 0.5, offset: int = 0, **kwargs) -> object:
"""Rolling Quantile.""" """Rolling Quantile."""
period = int(period) period = int(kwargs.get("length", period))
quantileLevel = float(quantileLevel) quantileLevel = float(quantileLevel)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -240,7 +240,7 @@ def quantile(close: object, period: int = 14, quantileLevel: float = 0.5, offset
def skew(close: object, period: int = 14, isPopulation: int = 0, offset: int = 0, **kwargs) -> object: def skew(close: object, period: int = 14, isPopulation: int = 0, offset: int = 0, **kwargs) -> object:
"""Skewness.""" """Skewness."""
period = int(period) period = int(kwargs.get("length", period))
isPopulation = int(isPopulation) isPopulation = int(isPopulation)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -252,7 +252,7 @@ def skew(close: object, period: int = 14, isPopulation: int = 0, offset: int = 0
def spearman(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -> object: def spearman(x: object, y: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Spearman Rank Correlation.""" """Spearman Rank Correlation."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
xarr, idx = _arr(x); yarr, _ = _arr(y) xarr, idx = _arr(x); yarr, _ = _arr(y)
n = len(xarr) n = len(xarr)
@@ -263,7 +263,7 @@ def spearman(x: object, y: object, period: int = 14, offset: int = 0, **kwargs)
def stderr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def stderr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Standard Error.""" """Standard Error."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -274,7 +274,7 @@ def stderr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object
def sum(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def sum(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Rolling Sum.""" """Rolling Sum."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -285,7 +285,7 @@ def sum(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def theil(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def theil(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Theil U Statistic.""" """Theil U Statistic."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -296,7 +296,7 @@ def theil(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def trim(close: object, period: int = 14, trimPct: float = 0.1, offset: int = 0, **kwargs) -> object: def trim(close: object, period: int = 14, trimPct: float = 0.1, offset: int = 0, **kwargs) -> object:
"""Trimmed Mean.""" """Trimmed Mean."""
period = int(period) period = int(kwargs.get("length", period))
trimPct = float(trimPct) trimPct = float(trimPct)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -308,7 +308,7 @@ def trim(close: object, period: int = 14, trimPct: float = 0.1, offset: int = 0,
def wavg(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def wavg(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Weighted Average.""" """Weighted Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -319,7 +319,7 @@ def wavg(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def wins(close: object, period: int = 14, winPct: float = 0.05, offset: int = 0, **kwargs) -> object: def wins(close: object, period: int = 14, winPct: float = 0.05, offset: int = 0, **kwargs) -> object:
"""Winsorized Mean.""" """Winsorized Mean."""
period = int(period) period = int(kwargs.get("length", period))
winPct = float(winPct) winPct = float(winPct)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -331,7 +331,7 @@ def wins(close: object, period: int = 14, winPct: float = 0.05, offset: int = 0,
def ztest(close: object, period: int = 14, mu0: float = 0.0, offset: int = 0, **kwargs) -> object: def ztest(close: object, period: int = 14, mu0: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Z-Test.""" """Z-Test."""
period = int(period) period = int(kwargs.get("length", period))
mu0 = float(mu0) mu0 = float(mu0)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
+13 -13
View File
@@ -47,7 +47,7 @@ __all__ = [
def fwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def fwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Fibonacci Weighted Moving Average.""" """Fibonacci Weighted Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -58,7 +58,7 @@ def fwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def gwma(close: object, period: int = 14, sigma: float = 0.4, offset: int = 0, **kwargs) -> object: def gwma(close: object, period: int = 14, sigma: float = 0.4, offset: int = 0, **kwargs) -> object:
"""Gaussian Weighted Moving Average.""" """Gaussian Weighted Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
sigma = float(sigma) sigma = float(sigma)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -70,7 +70,7 @@ def gwma(close: object, period: int = 14, sigma: float = 0.4, offset: int = 0, *
def hamma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def hamma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Hamming Moving Average.""" """Hamming Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -81,7 +81,7 @@ def hamma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def hend(close: object, period: int = 14, nanValue: float = 0.0, offset: int = 0, **kwargs) -> object: def hend(close: object, period: int = 14, nanValue: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Henderson Moving Average.""" """Henderson Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
nanValue = float(nanValue) nanValue = float(nanValue)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -93,7 +93,7 @@ def hend(close: object, period: int = 14, nanValue: float = 0.0, offset: int = 0
def ilrs(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ilrs(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Integral of Linear Regression Slope.""" """Integral of Linear Regression Slope."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -104,7 +104,7 @@ def ilrs(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def kaiser(close: object, period: int = 14, beta: float = 3.0, nanValue: float = 0.0, offset: int = 0, **kwargs) -> object: def kaiser(close: object, period: int = 14, beta: float = 3.0, nanValue: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Kaiser Window Moving Average.""" """Kaiser Window Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
beta = float(beta) beta = float(beta)
nanValue = float(nanValue) nanValue = float(nanValue)
offset = int(offset) offset = int(offset)
@@ -117,7 +117,7 @@ def kaiser(close: object, period: int = 14, beta: float = 3.0, nanValue: float =
def lanczos(close: object, period: int = 14, nanValue: float = 0.0, offset: int = 0, **kwargs) -> object: def lanczos(close: object, period: int = 14, nanValue: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Lanczos Moving Average.""" """Lanczos Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
nanValue = float(nanValue) nanValue = float(nanValue)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -129,7 +129,7 @@ def lanczos(close: object, period: int = 14, nanValue: float = 0.0, offset: int
def nlma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def nlma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Non-Lag Moving Average.""" """Non-Lag Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -140,7 +140,7 @@ def nlma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def nyqma(close: object, period: int = 14, nyquistPeriod: int = 2, offset: int = 0, **kwargs) -> object: def nyqma(close: object, period: int = 14, nyquistPeriod: int = 2, offset: int = 0, **kwargs) -> object:
"""Nyquist Moving Average.""" """Nyquist Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
nyquistPeriod = int(nyquistPeriod) nyquistPeriod = int(nyquistPeriod)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -152,7 +152,7 @@ def nyqma(close: object, period: int = 14, nyquistPeriod: int = 2, offset: int =
def pma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def pma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Predictive Moving Average.""" """Predictive Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -164,7 +164,7 @@ def pma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def pwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def pwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Pascal Weighted Moving Average.""" """Pascal Weighted Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -175,7 +175,7 @@ def pwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def qrma(close: object, period: int = 14, initialLastValid: float = 0.0, offset: int = 0, **kwargs) -> object: def qrma(close: object, period: int = 14, initialLastValid: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Quick Reaction Moving Average.""" """Quick Reaction Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
initialLastValid = float(initialLastValid) initialLastValid = float(initialLastValid)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -187,7 +187,7 @@ def qrma(close: object, period: int = 14, initialLastValid: float = 0.0, offset:
def rwma(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rwma(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Range Weighted Moving Average.""" """Range Weighted Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
+20 -20
View File
@@ -53,7 +53,7 @@ __all__ = [
def adxvma(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def adxvma(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""ADX Variable Moving Average.""" """ADX Variable Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -65,7 +65,7 @@ def adxvma(open: object, high: object, low: object, close: object, volume: objec
def frama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def frama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Fractal Adaptive Moving Average.""" """Fractal Adaptive Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -76,7 +76,7 @@ def frama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def holt(close: object, period: int = 14, gamma: float = 0.0, offset: int = 0, **kwargs) -> object: def holt(close: object, period: int = 14, gamma: float = 0.0, offset: int = 0, **kwargs) -> object:
"""Holt Exponential Smoothing.""" """Holt Exponential Smoothing."""
period = int(period) period = int(kwargs.get("length", period))
gamma = float(gamma) gamma = float(gamma)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -98,7 +98,7 @@ def htit(close: object, offset: int = 0, **kwargs) -> object:
def hwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def hwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Holt-Winter Moving Average.""" """Holt-Winter Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -121,7 +121,7 @@ def jma(close: object, period: int = 14, phase: int = 0, offset: int = 0, **kwar
def kama(close: object, period: int = 14, fastPeriod: int = 12, slowPeriod: int = 26, offset: int = 0, **kwargs) -> object: def kama(close: object, period: int = 14, fastPeriod: int = 12, slowPeriod: int = 26, offset: int = 0, **kwargs) -> object:
"""Kaufman Adaptive Moving Average.""" """Kaufman Adaptive Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
fastPeriod = int(fastPeriod) fastPeriod = int(fastPeriod)
slowPeriod = int(slowPeriod) slowPeriod = int(slowPeriod)
offset = int(offset) offset = int(offset)
@@ -134,7 +134,7 @@ def kama(close: object, period: int = 14, fastPeriod: int = 12, slowPeriod: int
def ltma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ltma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Low-Lag Triple Moving Average.""" """Low-Lag Triple Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -170,7 +170,7 @@ def mavp(x: object, periods: object, minPeriod: int = 6, maxPeriod: int = 48, of
def mcnma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mcnma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""McNicholl Moving Average.""" """McNicholl Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -181,7 +181,7 @@ def mcnma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def mgdi(close: object, period: int = 14, k: float = 0.6, offset: int = 0, **kwargs) -> object: def mgdi(close: object, period: int = 14, k: float = 0.6, offset: int = 0, **kwargs) -> object:
"""McGinley Dynamic.""" """McGinley Dynamic."""
period = int(period) period = int(kwargs.get("length", period))
k = float(k) k = float(k)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -193,7 +193,7 @@ def mgdi(close: object, period: int = 14, k: float = 0.6, offset: int = 0, **kwa
def mma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def mma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Modified Moving Average.""" """Modified Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -204,7 +204,7 @@ def mma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def nma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def nma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Normalized Moving Average.""" """Normalized Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -215,7 +215,7 @@ def nma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def qema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def qema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Quadruple EMA.""" """Quadruple EMA."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -226,7 +226,7 @@ def qema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def rema(close: object, period: int = 14, lam: float = 0.5, offset: int = 0, **kwargs) -> object: def rema(close: object, period: int = 14, lam: float = 0.5, offset: int = 0, **kwargs) -> object:
"""Regularized EMA.""" """Regularized EMA."""
period = int(period) period = int(kwargs.get("length", period))
lam = float(lam) lam = float(lam)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -238,7 +238,7 @@ def rema(close: object, period: int = 14, lam: float = 0.5, offset: int = 0, **k
def rgma(close: object, period: int = 14, passes: int = 3, offset: int = 0, **kwargs) -> object: def rgma(close: object, period: int = 14, passes: int = 3, offset: int = 0, **kwargs) -> object:
"""Recursive Gaussian Moving Average.""" """Recursive Gaussian Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
passes = int(passes) passes = int(passes)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -250,7 +250,7 @@ def rgma(close: object, period: int = 14, passes: int = 3, offset: int = 0, **kw
def rma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def rma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Rolling Moving Average.""" """Rolling Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -261,7 +261,7 @@ def rma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def t3(close: object, period: int = 14, vfactor: float = 0.7, offset: int = 0, **kwargs) -> object: def t3(close: object, period: int = 14, vfactor: float = 0.7, offset: int = 0, **kwargs) -> object:
"""Tillson T3.""" """Tillson T3."""
period = int(period) period = int(kwargs.get("length", period))
vfactor = float(vfactor) vfactor = float(vfactor)
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
@@ -273,7 +273,7 @@ def t3(close: object, period: int = 14, vfactor: float = 0.7, offset: int = 0, *
def trama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def trama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Triangular Adaptive Moving Average.""" """Triangular Adaptive Moving Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -300,7 +300,7 @@ def vama(open: object, high: object, low: object, close: object, volume: object,
def vidya(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vidya(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Variable Index Dynamic Average.""" """Variable Index Dynamic Average."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -327,7 +327,7 @@ def yzvama(open: object, high: object, low: object, close: object, volume: objec
def zldema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def zldema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Zero-Lag Double EMA.""" """Zero-Lag Double EMA."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -338,7 +338,7 @@ def zldema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object
def zlema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def zlema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Zero-Lag EMA.""" """Zero-Lag EMA."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -349,7 +349,7 @@ def zlema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def zltema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def zltema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Zero-Lag Triple EMA.""" """Zero-Lag Triple EMA."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
+14 -14
View File
@@ -41,7 +41,7 @@ __all__ = [
def adr(open: object, high: object, low: object, close: object, volume: object, period: int = 14, method: int = 0, offset: int = 0, **kwargs) -> object: def adr(open: object, high: object, low: object, close: object, volume: object, period: int = 14, method: int = 0, offset: int = 0, **kwargs) -> object:
"""Average Daily Range.""" """Average Daily Range."""
period = int(period) period = int(kwargs.get("length", period))
method = int(method) method = int(method)
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
@@ -54,7 +54,7 @@ def adr(open: object, high: object, low: object, close: object, volume: object,
def atr(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def atr(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Average True Range.""" """Average True Range."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -66,7 +66,7 @@ def atr(open: object, high: object, low: object, close: object, volume: object,
def atrn(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def atrn(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Normalized ATR.""" """Normalized ATR."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -78,7 +78,7 @@ def atrn(open: object, high: object, low: object, close: object, volume: object,
def gkv(open: object, high: object, low: object, close: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object: def gkv(open: object, high: object, low: object, close: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object:
"""Garman-Klass Volatility.""" """Garman-Klass Volatility."""
period = int(period) period = int(kwargs.get("length", period))
annualize = int(annualize) annualize = int(annualize)
annualPeriods = int(annualPeriods) annualPeriods = int(annualPeriods)
offset = int(offset) offset = int(offset)
@@ -91,7 +91,7 @@ def gkv(open: object, high: object, low: object, close: object, period: int = 14
def hlv(high: object, low: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object: def hlv(high: object, low: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object:
"""High-Low Volatility.""" """High-Low Volatility."""
period = int(period) period = int(kwargs.get("length", period))
annualize = int(annualize) annualize = int(annualize)
annualPeriods = int(annualPeriods) annualPeriods = int(annualPeriods)
offset = int(offset) offset = int(offset)
@@ -104,7 +104,7 @@ def hlv(high: object, low: object, period: int = 14, annualize: int = 1, annualP
def hv(close: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object: def hv(close: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object:
"""Historical Volatility.""" """Historical Volatility."""
period = int(period) period = int(kwargs.get("length", period))
annualize = int(annualize) annualize = int(annualize)
annualPeriods = int(annualPeriods) annualPeriods = int(annualPeriods)
offset = int(offset) offset = int(offset)
@@ -117,7 +117,7 @@ def hv(close: object, period: int = 14, annualize: int = 1, annualPeriods: int =
def jvolty(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def jvolty(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Jurik Volatility.""" """Jurik Volatility."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -128,7 +128,7 @@ def jvolty(close: object, period: int = 14, offset: int = 0, **kwargs) -> object
def jvoltyn(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def jvoltyn(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Jurik Volatility Normalized.""" """Jurik Volatility Normalized."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -151,7 +151,7 @@ def massi(close: object, emaLength: int = 9, sumLength: int = 25, offset: int =
def natr(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def natr(open: object, high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Normalized ATR.""" """Normalized ATR."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low)
c, _ = _arr(close); v, _ = _arr(volume) c, _ = _arr(close); v, _ = _arr(volume)
@@ -163,7 +163,7 @@ def natr(open: object, high: object, low: object, close: object, volume: object,
def rsv(open: object, high: object, low: object, close: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object: def rsv(open: object, high: object, low: object, close: object, period: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object:
"""Rogers-Satchell Volatility.""" """Rogers-Satchell Volatility."""
period = int(period) period = int(kwargs.get("length", period))
annualize = int(annualize) annualize = int(annualize)
annualPeriods = int(annualPeriods) annualPeriods = int(annualPeriods)
offset = int(offset) offset = int(offset)
@@ -176,7 +176,7 @@ def rsv(open: object, high: object, low: object, close: object, period: int = 14
def rv(close: object, period: int = 14, smoothingPeriod: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object: def rv(close: object, period: int = 14, smoothingPeriod: int = 14, annualize: int = 1, annualPeriods: int = 252, offset: int = 0, **kwargs) -> object:
"""Realized Volatility.""" """Realized Volatility."""
period = int(period) period = int(kwargs.get("length", period))
smoothingPeriod = int(smoothingPeriod) smoothingPeriod = int(smoothingPeriod)
annualize = int(annualize) annualize = int(annualize)
annualPeriods = int(annualPeriods) annualPeriods = int(annualPeriods)
@@ -202,7 +202,7 @@ def rvi(close: object, stdevLength: int = 10, rmaLength: int = 14, offset: int =
def ui(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def ui(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Ulcer Index.""" """Ulcer Index."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -225,7 +225,7 @@ def vov(close: object, volatilityPeriod: int = 20, vovPeriod: int = 20, offset:
def vr(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vr(high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Volatility Ratio.""" """Volatility Ratio."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(h) n = len(h)
@@ -236,7 +236,7 @@ def vr(high: object, low: object, close: object, period: int = 14, offset: int =
def yzv(open: object, high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def yzv(open: object, high: object, low: object, close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Yang-Zhang Volatility.""" """Yang-Zhang Volatility."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low); c, _ = _arr(close) o, idx = _arr(open); h, _ = _arr(high); l, _ = _arr(low); c, _ = _arr(close)
n = len(o) n = len(o)
+5 -5
View File
@@ -62,7 +62,7 @@ def adosc(high: object, low: object, close: object, volume: object, fastPeriod:
def iii(high: object, low: object, close: object, volume: object, period: int = 14, cumulative: int = 0, offset: int = 0, **kwargs) -> object: def iii(high: object, low: object, close: object, volume: object, period: int = 14, cumulative: int = 0, offset: int = 0, **kwargs) -> object:
"""Intraday Intensity Index.""" """Intraday Intensity Index."""
period = int(period) period = int(kwargs.get("length", period))
cumulative = int(cumulative) cumulative = int(cumulative)
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close); v, _ = _arr(volume) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close); v, _ = _arr(volume)
@@ -88,7 +88,7 @@ def kvo(high: object, low: object, close: object, volume: object, fastPeriod: in
def twap(close: object, period: int = 14, offset: int = 0, **kwargs) -> object: def twap(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Time Weighted Average Price.""" """Time Weighted Average Price."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
src, idx = _arr(close) src, idx = _arr(close)
n = len(src) n = len(src)
@@ -121,7 +121,7 @@ def vo(volume: object, shortPeriod: int = 12, longPeriod: int = 26, offset: int
def vroc(volume: object, period: int = 14, usePercent: int = 1, offset: int = 0, **kwargs) -> object: def vroc(volume: object, period: int = 14, usePercent: int = 1, offset: int = 0, **kwargs) -> object:
"""Volume Rate of Change.""" """Volume Rate of Change."""
period = int(period) period = int(kwargs.get("length", period))
usePercent = int(usePercent) usePercent = int(usePercent)
offset = int(offset) offset = int(offset)
src, idx = _arr(volume) src, idx = _arr(volume)
@@ -133,7 +133,7 @@ def vroc(volume: object, period: int = 14, usePercent: int = 1, offset: int = 0,
def vwad(high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vwad(high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Volume Weighted Accumulation/Distribution.""" """Volume Weighted Accumulation/Distribution."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close); v, _ = _arr(volume) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close); v, _ = _arr(volume)
n = len(h) n = len(h)
@@ -144,7 +144,7 @@ def vwad(high: object, low: object, close: object, volume: object, period: int =
def vwap(high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object: def vwap(high: object, low: object, close: object, volume: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Volume Weighted Average Price.""" """Volume Weighted Average Price."""
period = int(period) period = int(kwargs.get("length", period))
offset = int(offset) offset = int(offset)
h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close); v, _ = _arr(volume) h, idx = _arr(high); l, _ = _arr(low); c, _ = _arr(close); v, _ = _arr(volume)
n = len(h) n = len(h)
+43
View File
@@ -0,0 +1,43 @@
"""Add length→period alias to all old-style Python wrapper functions.
Replaces: period = int(period)
With: period = int(kwargs.get("length", period))
Only targets exact standalone `period = int(period)` lines (4-space indent).
Does NOT touch compound names like fastPeriod, slowPeriod, etc.
"""
import re
import os
import glob
base = os.path.join(os.path.dirname(__file__), '..', 'quantalib')
base = os.path.normpath(base)
files = sorted(glob.glob(os.path.join(base, '*.py')))
total = 0
for fpath in files:
fname = os.path.basename(fpath)
if fname.startswith('_'):
continue
with open(fpath, 'r', encoding='utf-8') as f:
content = f.read()
# Match exactly ' period = int(period)' (4-space indent, standalone)
pattern = r'^( )period = int\(period\)$'
matches = re.findall(pattern, content, re.MULTILINE)
count = len(matches)
if count > 0:
new_content = re.sub(
pattern,
r'\1period = int(kwargs.get("length", period))',
content,
flags=re.MULTILINE,
)
with open(fpath, 'w', encoding='utf-8') as f:
f.write(new_content)
print(f'{fname}: {count} replacements')
total += count
else:
print(f'{fname}: 0 (skipped)')
print(f'\nTotal: {total} replacements across {len(files)} files')