mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-07-29 02:07:42 +00:00
fix: sync 28+ Python default params with C# constructors
This commit is contained in:
+14
-14
@@ -46,7 +46,7 @@ __all__ = [
|
||||
]
|
||||
|
||||
|
||||
def gauss(close: object, sigma: float = 6.0, offset: int = 0, **kwargs) -> object:
|
||||
def gauss(close: object, sigma: float = 1.0, offset: int = 0, **kwargs) -> object:
|
||||
"""Gaussian Filter."""
|
||||
sigma = float(sigma)
|
||||
offset = int(offset)
|
||||
@@ -79,7 +79,7 @@ def hp(close: object, lam: float = 1600.0, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, "HP", "filters", offset)
|
||||
|
||||
|
||||
def hpf(close: object, length: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
def hpf(close: object, length: int = 40, offset: int = 0, **kwargs) -> object:
|
||||
"""High-Pass Filter."""
|
||||
length = int(length)
|
||||
offset = int(offset)
|
||||
@@ -90,7 +90,7 @@ def hpf(close: object, length: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"HPF_{length}", "filters", offset)
|
||||
|
||||
|
||||
def kalman(close: object, q: float = 0.3, r: float = 1.0, offset: int = 0, **kwargs) -> object:
|
||||
def kalman(close: object, q: float = 0.01, r: float = 0.1, offset: int = 0, **kwargs) -> object:
|
||||
"""Kalman Filter."""
|
||||
q = float(q)
|
||||
r = float(r)
|
||||
@@ -102,7 +102,7 @@ def kalman(close: object, q: float = 0.3, r: float = 1.0, offset: int = 0, **kwa
|
||||
return _wrap(output, idx, "KALMAN", "filters", offset)
|
||||
|
||||
|
||||
def laguerre(close: object, gamma: float = 0.7, offset: int = 0, **kwargs) -> object:
|
||||
def laguerre(close: object, gamma: float = 0.8, offset: int = 0, **kwargs) -> object:
|
||||
"""Laguerre Filter."""
|
||||
gamma = float(gamma)
|
||||
offset = int(offset)
|
||||
@@ -113,7 +113,7 @@ def laguerre(close: object, gamma: float = 0.7, offset: int = 0, **kwargs) -> ob
|
||||
return _wrap(output, idx, "LAGUERRE", "filters", offset)
|
||||
|
||||
|
||||
def lms(close: object, order: int = 3, mu: float = 0.01, offset: int = 0, **kwargs) -> object:
|
||||
def lms(close: object, order: int = 16, mu: float = 0.5, offset: int = 0, **kwargs) -> object:
|
||||
"""Least Mean Squares Filter."""
|
||||
order = int(order)
|
||||
mu = float(mu)
|
||||
@@ -136,7 +136,7 @@ def loess(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"LOESS_{period}", "filters", offset)
|
||||
|
||||
|
||||
def modf(close: object, period: int = 14, beta: float = 2.0, 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."""
|
||||
period = int(period)
|
||||
beta = float(beta)
|
||||
@@ -150,7 +150,7 @@ def modf(close: object, period: int = 14, beta: float = 2.0, feedback: int = 0,
|
||||
return _wrap(output, idx, f"MODF_{period}", "filters", offset)
|
||||
|
||||
|
||||
def notch(close: object, period: int = 14, q: float = 0.3, offset: int = 0, **kwargs) -> object:
|
||||
def notch(close: object, period: int = 14, q: float = 1.0, offset: int = 0, **kwargs) -> object:
|
||||
"""Notch Filter."""
|
||||
period = int(period)
|
||||
q = float(q)
|
||||
@@ -162,7 +162,7 @@ def notch(close: object, period: int = 14, q: float = 0.3, offset: int = 0, **kw
|
||||
return _wrap(output, idx, f"NOTCH_{period}", "filters", offset)
|
||||
|
||||
|
||||
def nw(close: object, period: int = 14, bandwidth: float = 0.25, offset: int = 0, **kwargs) -> object:
|
||||
def nw(close: object, period: int = 64, bandwidth: float = 8.0, offset: int = 0, **kwargs) -> object:
|
||||
"""Nadaraya-Watson Filter."""
|
||||
period = int(period)
|
||||
bandwidth = float(bandwidth)
|
||||
@@ -174,7 +174,7 @@ def nw(close: object, period: int = 14, bandwidth: float = 0.25, offset: int = 0
|
||||
return _wrap(output, idx, f"NW_{period}", "filters", offset)
|
||||
|
||||
|
||||
def oneeuro(close: object, minCutoff: float = 1.0, beta: float = 2.0, dCutoff: float = 1.0, offset: int = 0, **kwargs) -> object:
|
||||
def oneeuro(close: object, minCutoff: float = 1.0, beta: float = 0.007, dCutoff: float = 1.0, offset: int = 0, **kwargs) -> object:
|
||||
"""1€ Filter."""
|
||||
minCutoff = float(minCutoff)
|
||||
beta = float(beta)
|
||||
@@ -187,7 +187,7 @@ def oneeuro(close: object, minCutoff: float = 1.0, beta: float = 2.0, dCutoff: f
|
||||
return _wrap(output, idx, "ONEEURO", "filters", offset)
|
||||
|
||||
|
||||
def rls(close: object, order: int = 3, lam: float = 1600.0, offset: int = 0, **kwargs) -> object:
|
||||
def rls(close: object, order: int = 16, lam: float = 0.99, offset: int = 0, **kwargs) -> object:
|
||||
"""Recursive Least Squares Filter."""
|
||||
order = int(order)
|
||||
lam = float(lam)
|
||||
@@ -210,7 +210,7 @@ def rmed(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"RMED_{period}", "filters", offset)
|
||||
|
||||
|
||||
def roofing(close: object, hpLength: int = 40, ssLength: int = 10, offset: int = 0, **kwargs) -> object:
|
||||
def roofing(close: object, hpLength: int = 48, ssLength: int = 10, offset: int = 0, **kwargs) -> object:
|
||||
"""Roofing Filter."""
|
||||
hpLength = int(hpLength)
|
||||
ssLength = int(ssLength)
|
||||
@@ -222,7 +222,7 @@ def roofing(close: object, hpLength: int = 40, ssLength: int = 10, offset: int =
|
||||
return _wrap(output, idx, f"ROOFING_{hpLength}", "filters", offset)
|
||||
|
||||
|
||||
def sgf(close: object, period: int = 14, polyOrder: int = 3, offset: int = 0, **kwargs) -> object:
|
||||
def sgf(close: object, period: int = 14, polyOrder: int = 2, offset: int = 0, **kwargs) -> object:
|
||||
"""Savitzky-Golay Filter."""
|
||||
period = int(period)
|
||||
polyOrder = int(polyOrder)
|
||||
@@ -234,7 +234,7 @@ def sgf(close: object, period: int = 14, polyOrder: int = 3, offset: int = 0, **
|
||||
return _wrap(output, idx, f"SGF_{period}", "filters", offset)
|
||||
|
||||
|
||||
def spbf(close: object, shortPeriod: int = 12, longPeriod: int = 26, rmsPeriod: int = 20, offset: int = 0, **kwargs) -> object:
|
||||
def spbf(close: object, shortPeriod: int = 40, longPeriod: int = 60, rmsPeriod: int = 50, offset: int = 0, **kwargs) -> object:
|
||||
"""Short-Period Bandpass Filter."""
|
||||
shortPeriod = int(shortPeriod)
|
||||
longPeriod = int(longPeriod)
|
||||
@@ -306,7 +306,7 @@ def wavelet(close: object, levels: int = 4, threshMult: float = 1.0, offset: int
|
||||
return _wrap(output, idx, "WAVELET", "filters", offset)
|
||||
|
||||
|
||||
def wiener(close: object, period: int = 14, smoothPeriod: int = 5, offset: int = 0, **kwargs) -> object:
|
||||
def wiener(close: object, period: int = 14, smoothPeriod: int = 10, offset: int = 0, **kwargs) -> object:
|
||||
"""Wiener Filter."""
|
||||
period = int(period)
|
||||
smoothPeriod = int(smoothPeriod)
|
||||
|
||||
@@ -123,7 +123,7 @@ def rocr(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"ROCR_{period}", "momentum", offset)
|
||||
|
||||
|
||||
def sam(close: object, alpha: float = 2.0, cutoff: int = 10, offset: int = 0, **kwargs) -> object:
|
||||
def sam(close: object, alpha: float = 0.07, cutoff: int = 8, offset: int = 0, **kwargs) -> object:
|
||||
"""Simple Alpha Momentum."""
|
||||
alpha = float(alpha)
|
||||
cutoff = int(cutoff)
|
||||
|
||||
@@ -48,7 +48,7 @@ def accel(close: object, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, "ACCEL", "numerics", offset)
|
||||
|
||||
|
||||
def fdist(close: object, d1: int = 10, d2: int = 20, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
def fdist(close: object, d1: int = 1, d2: int = 1, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
"""F-Distribution."""
|
||||
d1 = int(d1)
|
||||
d2 = int(d2)
|
||||
@@ -74,7 +74,7 @@ def fft(close: object, windowSize: int = 256, minPeriod: int = 6, maxPeriod: int
|
||||
return _wrap(output, idx, f"FFT_{minPeriod}", "numerics", offset)
|
||||
|
||||
|
||||
def gammadist(close: object, alpha: float = 2.0, beta: float = 2.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
def gammadist(close: object, alpha: float = 2.0, beta: float = 1.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
"""Gamma Distribution."""
|
||||
alpha = float(alpha)
|
||||
beta = float(beta)
|
||||
@@ -132,7 +132,7 @@ def lineartrans(close: object, slope: float = 1.0, intercept: float = 0.0, offse
|
||||
return _wrap(output, idx, "LINEARTRANS", "numerics", offset)
|
||||
|
||||
|
||||
def lognormdist(close: object, mu: float = 0.01, sigma: float = 6.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
def lognormdist(close: object, mu: float = 0.0, sigma: float = 1.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
"""Log-Normal Distribution."""
|
||||
mu = float(mu)
|
||||
sigma = float(sigma)
|
||||
@@ -177,7 +177,7 @@ def normalize(close: object, period: int = 14, offset: int = 0, **kwargs) -> obj
|
||||
return _wrap(output, idx, f"NORMALIZE_{period}", "numerics", offset)
|
||||
|
||||
|
||||
def normdist(close: object, mu: float = 0.01, sigma: float = 6.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
def normdist(close: object, mu: float = 0.0, sigma: float = 1.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
"""Normal Distribution."""
|
||||
mu = float(mu)
|
||||
sigma = float(sigma)
|
||||
@@ -190,7 +190,7 @@ def normdist(close: object, mu: float = 0.01, sigma: float = 6.0, period: int =
|
||||
return _wrap(output, idx, f"NORMDIST_{period}", "numerics", offset)
|
||||
|
||||
|
||||
def poissondist(close: object, lam: float = 1600.0, period: int = 14, threshold: int = 10, 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."""
|
||||
lam = float(lam)
|
||||
period = int(period)
|
||||
@@ -213,7 +213,7 @@ def relu(close: object, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, "RELU", "numerics", offset)
|
||||
|
||||
|
||||
def sigmoid(close: object, k: float = 2.0, x0: float = 0.0, offset: int = 0, **kwargs) -> object:
|
||||
def sigmoid(close: object, k: float = 1.0, x0: float = 0.0, offset: int = 0, **kwargs) -> object:
|
||||
"""Sigmoid Transform."""
|
||||
k = float(k)
|
||||
x0 = float(x0)
|
||||
@@ -257,7 +257,7 @@ def tdist(close: object, nu: int = 10, period: int = 14, offset: int = 0, **kwar
|
||||
return _wrap(output, idx, f"TDIST_{period}", "numerics", offset)
|
||||
|
||||
|
||||
def weibulldist(close: object, k: float = 2.0, lam: float = 1600.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
def weibulldist(close: object, k: float = 1.5, lam: float = 1.0, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
"""Weibull Distribution."""
|
||||
k = float(k)
|
||||
lam = float(lam)
|
||||
|
||||
@@ -200,7 +200,7 @@ def marketfi(high: object, low: object, volume: object, offset: int = 0, **kwarg
|
||||
return _wrap(output, idx, "MARKETFI", "oscillators", offset)
|
||||
|
||||
|
||||
def mstoch(close: object, stochLength: int = 14, hpLength: int = 40, ssLength: int = 10, offset: int = 0, **kwargs) -> object:
|
||||
def mstoch(close: object, stochLength: int = 20, hpLength: int = 48, ssLength: int = 10, offset: int = 0, **kwargs) -> object:
|
||||
"""Modified Stochastic."""
|
||||
stochLength = int(stochLength)
|
||||
hpLength = int(hpLength)
|
||||
|
||||
@@ -56,7 +56,7 @@ def fwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"FWMA_{period}", "trends_fir", offset)
|
||||
|
||||
|
||||
def gwma(close: object, period: int = 14, sigma: float = 6.0, 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."""
|
||||
period = int(period)
|
||||
sigma = float(sigma)
|
||||
@@ -102,7 +102,7 @@ def ilrs(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"ILRS_{period}", "trends_fir", offset)
|
||||
|
||||
|
||||
def kaiser(close: object, period: int = 14, beta: float = 2.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."""
|
||||
period = int(period)
|
||||
beta = float(beta)
|
||||
|
||||
@@ -74,7 +74,7 @@ def frama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"FRAMA_{period}", "trends_iir", offset)
|
||||
|
||||
|
||||
def holt(close: object, period: int = 14, gamma: float = 0.7, offset: int = 0, **kwargs) -> object:
|
||||
def holt(close: object, period: int = 14, gamma: float = 0.0, offset: int = 0, **kwargs) -> object:
|
||||
"""Holt Exponential Smoothing."""
|
||||
period = int(period)
|
||||
gamma = float(gamma)
|
||||
@@ -107,7 +107,7 @@ def hwma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"HWMA_{period}", "trends_iir", offset)
|
||||
|
||||
|
||||
def jma(close: object, period: int = 14, phase: int = 0, power: float = 1.0, offset: int = 0, **kwargs) -> object:
|
||||
def jma(close: object, period: int = 14, phase: int = 0, power: float = 0.45, offset: int = 0, **kwargs) -> object:
|
||||
"""Jurik Moving Average."""
|
||||
period = int(period)
|
||||
phase = int(phase)
|
||||
@@ -180,7 +180,7 @@ def mcnma(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"MCNMA_{period}", "trends_iir", offset)
|
||||
|
||||
|
||||
def mgdi(close: object, period: int = 14, k: float = 2.0, offset: int = 0, **kwargs) -> object:
|
||||
def mgdi(close: object, period: int = 14, k: float = 0.6, offset: int = 0, **kwargs) -> object:
|
||||
"""McGinley Dynamic."""
|
||||
period = int(period)
|
||||
k = float(k)
|
||||
@@ -225,7 +225,7 @@ def qema(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
|
||||
return _wrap(output, idx, f"QEMA_{period}", "trends_iir", offset)
|
||||
|
||||
|
||||
def rema(close: object, period: int = 14, lam: float = 1600.0, offset: int = 0, **kwargs) -> object:
|
||||
def rema(close: object, period: int = 14, lam: float = 0.5, offset: int = 0, **kwargs) -> object:
|
||||
"""Regularized EMA."""
|
||||
period = int(period)
|
||||
lam = float(lam)
|
||||
|
||||
@@ -69,8 +69,8 @@ class TestPandasSeriesIO:
|
||||
result = qtl.ema(s, length=14)
|
||||
assert isinstance(result, pd.Series)
|
||||
assert result.name == "EMA_14"
|
||||
assert hasattr(result, "category")
|
||||
assert result.category == "trend"
|
||||
assert "category" in result.attrs
|
||||
assert result.attrs["category"] == "trends_iir"
|
||||
|
||||
def test_rsi_series(self, qtl, pd) -> None:
|
||||
s = pd.Series(CLOSE)
|
||||
|
||||
Reference in New Issue
Block a user