mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-08-12 12:20:27 +08:00
Merge remote-tracking branch 'github-desktop-ryanrussell/development' into development
This commit is contained in:
@@ -920,7 +920,7 @@ Back to [Contents](#contents)
|
||||
* _Jurik Moving Average_: **jma**
|
||||
* _Kaufman's Adaptive Moving Average_: **kama**
|
||||
* _Linear Regression_: **linreg**
|
||||
* _Ehler's MESA Adapative Moving Average_: **mama**
|
||||
* _Ehler's MESA Adaptive Moving Average_: **mama**
|
||||
* Includes: **fama**
|
||||
* _McGinley Dynamic_: **mcgd**
|
||||
* _Midpoint_: **midpoint**
|
||||
|
||||
@@ -466,7 +466,7 @@
|
||||
"[+] Saving: /Users/kj/av_data/SPY_D.csv\n",
|
||||
"[+] Study: Common Price and Volume SMAs\n",
|
||||
"[i] Indicator arguments: {'timed': True, 'append': True}\n",
|
||||
"[i] No mulitproccessing (cores = 0).\n"
|
||||
"[i] No multiprocessing (cores = 0).\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -502,7 +502,7 @@
|
||||
"[+] Saving: /Users/kj/av_data/IWM_D.csv\n",
|
||||
"[+] Study: Common Price and Volume SMAs\n",
|
||||
"[i] Indicator arguments: {'timed': True, 'append': True}\n",
|
||||
"[i] No mulitproccessing (cores = 0).\n"
|
||||
"[i] No multiprocessing (cores = 0).\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -836,7 +836,7 @@
|
||||
"[i] Loaded SPY(7367, 34)\n",
|
||||
"[+] Study: Common Price and Volume SMAs\n",
|
||||
"[i] Indicator arguments: {'append': True}\n",
|
||||
"[i] No mulitproccessing (cores = 0).\n"
|
||||
"[i] No multiprocessing (cores = 0).\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-3
@@ -222,7 +222,7 @@ class AnalysisIndicators(object):
|
||||
|
||||
@property
|
||||
def time_range(self) -> Float:
|
||||
"""Returns the time ranges of the DataFrame as a float. Default is in "years". help(ta.toal_time)"""
|
||||
"""Returns the time ranges of the DataFrame as a float. Default is in "years". help(ta.total_time)"""
|
||||
return total_time(self._df, self._time_range)
|
||||
|
||||
@time_range.setter
|
||||
@@ -717,9 +717,9 @@ class AnalysisIndicators(object):
|
||||
else:
|
||||
# Without multiprocessing:
|
||||
if verbose:
|
||||
_col_msg = f"[i] No mulitproccessing (cores = 0)."
|
||||
_col_msg = f"[i] No multiprocessing (cores = 0)."
|
||||
if has_col_names:
|
||||
_col_msg = f"[i] No mulitproccessing support for 'col_names' option."
|
||||
_col_msg = f"[i] No multiprocessing support for 'col_names' option."
|
||||
print(_col_msg)
|
||||
|
||||
if mode["custom"]:
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ def import_dir(path: str, verbose: bool = True):
|
||||
|
||||
>>> import_dir(ta_dir)
|
||||
|
||||
If your custom indicator(s) loaded succesfully then it should behave exactly
|
||||
If your custom indicator(s) loaded successfully then it should behave exactly
|
||||
like all other native indicators in pandas_ta, including help functions.
|
||||
"""
|
||||
# ensure that the passed directory exists / is readable
|
||||
|
||||
@@ -25,7 +25,7 @@ def inertia(
|
||||
|
||||
Inertia was developed by Donald Dorsey and was introduced his article
|
||||
in September, 1995. It is the Relative Vigor Index smoothed by the Least
|
||||
Squares Moving Average. Postive Inertia when values are greater than 50,
|
||||
Squares Moving Average. Positive Inertia when values are greater than 50,
|
||||
Negative Inertia otherwise.
|
||||
|
||||
Sources:
|
||||
|
||||
@@ -64,8 +64,8 @@ def rsi(
|
||||
negative = close.diff(drift)
|
||||
positive = negative.copy()
|
||||
|
||||
positive[positive < 0] = 0 # Make negatives 0 for the postive series
|
||||
negative[negative > 0] = 0 # Make postives 0 for the negative series
|
||||
positive[positive < 0] = 0 # Make negatives 0 for the positive series
|
||||
negative[negative > 0] = 0 # Make positives 0 for the negative series
|
||||
|
||||
positive_avg = rma(positive, length=length)
|
||||
negative_avg = rma(negative, length=length)
|
||||
|
||||
@@ -19,12 +19,12 @@ def stc(
|
||||
"""Schaff Trend Cycle (STC)
|
||||
|
||||
The Schaff Trend Cycle is an evolution of the popular MACD
|
||||
incorportating two cascaded stochastic calculations with additional
|
||||
incorporating two cascaded stochastic calculations with additional
|
||||
smoothing.
|
||||
|
||||
The STC returns also the beginning MACD result as well as the result
|
||||
after the first stochastic including its smoothing. This implementation
|
||||
has been extended for Pandas TA to also allow for separatly feeding any
|
||||
has been extended for Pandas TA to also allow for separately feeding any
|
||||
other two moving Averages (as ma1 and ma2) or to skip this to feed an
|
||||
oscillator, based on which the Schaff Trend Cycle should be calculated.
|
||||
|
||||
@@ -55,9 +55,9 @@ def stc(
|
||||
offset (int): How many periods to offset the result. Default: 0
|
||||
|
||||
Kwargs:
|
||||
ma1: External MA (mandatory in conjuction with ma2)
|
||||
ma2: External MA (mandatory in conjuction with ma1)
|
||||
osc: External osillator
|
||||
ma1: External MA (mandatory in conjunction with ma2)
|
||||
ma2: External MA (mandatory in conjunction with ma1)
|
||||
osc: External oscillator
|
||||
fillna (value, optional): pd.DataFrame.fillna(value)
|
||||
fill_method (value, optional): Type of fill method
|
||||
|
||||
@@ -94,14 +94,14 @@ def stc(
|
||||
|
||||
if ma1 is None or ma2 is None:
|
||||
return
|
||||
# According to external feeded series
|
||||
# According to external feed series
|
||||
xmacd = ma1 - ma2
|
||||
pff, pf = schaff_tc(close, xmacd, tclength, factor)
|
||||
elif isinstance(osc, Series):
|
||||
osc = v_series(osc, _length)
|
||||
if osc is None:
|
||||
return
|
||||
# According to feeded oscillator (should be ranging around 0 x-axis)
|
||||
# According to feed oscillator (should be ranging around 0 x-axis)
|
||||
xmacd = osc
|
||||
pff, pf = schaff_tc(close, xmacd, tclength, factor)
|
||||
else:
|
||||
|
||||
@@ -14,7 +14,7 @@ def alligator(
|
||||
|
||||
The Alligator Indicator was developed by Bill Williams and combines
|
||||
moving averages with fractal geometry and the lines are meant to
|
||||
resemeble an alligator opening and closing his mouth.. It attempts to
|
||||
resemble an alligator opening and closing his mouth.. It attempts to
|
||||
identify if an asset is trending. It consists of 3 lines: the
|
||||
Alligator's Jaw, Teeth, and Lips. Each have different lookback periods
|
||||
and but require the user to offset the results; this is avoid data leaks
|
||||
|
||||
@@ -89,10 +89,10 @@ def jma(
|
||||
power = np_power(r_volty, pow1)
|
||||
alpha = np_power(beta, power)
|
||||
|
||||
# 1st stage - prelimimary smoothing by adaptive EMA
|
||||
# 1st stage - preliminary smoothing by adaptive EMA
|
||||
ma1 = (1 - alpha) * price + alpha * ma1
|
||||
|
||||
# 2nd stage - one more prelimimary smoothing by Kalman filter
|
||||
# 2nd stage - one more preliminary smoothing by Kalman filter
|
||||
det0 = (1 - beta) * (price - ma1) + beta * det0
|
||||
ma2 = ma1 + pr * det0
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@ def mama(
|
||||
prenan: Int = None, talib: bool = None,
|
||||
offset: Int = None, **kwargs: DictLike
|
||||
) -> Series:
|
||||
"""Ehler's MESA Adapative Moving Average (MAMA)
|
||||
"""Ehler's MESA Adaptive Moving Average (MAMA)
|
||||
|
||||
Ehler's MESA Adapative Moving Average (MAMA) aka the Mother of All Moving
|
||||
Ehler's MESA Adaptive Moving Average (MAMA) aka the Mother of All Moving
|
||||
Averages attempts to adapt to the source's dynamic nature. The adapation
|
||||
is based on the rate change of phase as measured by the Hilbert
|
||||
Transform Discriminator. The advantage of this method of adaptation is
|
||||
|
||||
@@ -53,7 +53,7 @@ def ssf(
|
||||
|
||||
John F. Ehlers's solution to reduce lag and remove aliasing noise with
|
||||
his research in Aerospace analog filter design. This implementation had
|
||||
two poles. Since SSF is a (Resursive) Digital Filter, the number of
|
||||
two poles. Since SSF is a (Recursive) Digital Filter, the number of
|
||||
poles determine how many prior recursive SSF bars to include in the
|
||||
filter design.
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ def ssf3(
|
||||
|
||||
John F. Ehlers's solution to reduce lag and remove aliasing noise
|
||||
with his research in aerospace analog filter design. This is
|
||||
implementation has three poles. Since SSF is a (Resursive) Digital
|
||||
implementation has three poles. Since SSF is a (Recursive) Digital
|
||||
Filter, the number of poles determine how many prior recursive SSF bars
|
||||
to include in the filter design.
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ def unsigned_differences(series: Series, amount: Int = None,
|
||||
|
||||
Default Example:
|
||||
series = Series([3, 2, 2, 1, 1, 5, 6, 6, 7, 5, 3]) and returns
|
||||
postive = Series([0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0])
|
||||
positive = Series([0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0])
|
||||
negative = Series([0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1])
|
||||
"""
|
||||
amount = int(amount) if amount is not None else 1
|
||||
|
||||
@@ -46,7 +46,7 @@ def df_year_to_date(df: DataFrame) -> DataFrame:
|
||||
|
||||
|
||||
def final_time(stime: Float) -> str:
|
||||
"""Human readable elapsed time. Calculates the final time elasped since
|
||||
"""Human readable elapsed time. Calculates the final time elapsed since
|
||||
stime and returns a string with microseconds and seconds."""
|
||||
time_diff = perf_counter() - stime
|
||||
return f"{time_diff * 1000:2.4f} ms ({time_diff:2.4f} s)"
|
||||
|
||||
@@ -436,7 +436,7 @@ def yf(ticker: str, **kwargs) -> DataFrame:
|
||||
print(
|
||||
f"[!] Best choice: update yfinance to the latest version.")
|
||||
print(
|
||||
f"[!] Ignore if aleady patched. Some tickers do not have financials.")
|
||||
f"[!] Ignore if already patched. Some tickers do not have financials.")
|
||||
print(
|
||||
f"[!] Otherwise to enable Company Financials, see yfinance Issue #517 patch.")
|
||||
print(
|
||||
|
||||
@@ -24,7 +24,7 @@ def atr(
|
||||
) -> Series:
|
||||
"""Average True Range (ATR)
|
||||
|
||||
Averge True Range is used to measure volatility, especially volatility
|
||||
Average True Range is used to measure volatility, especially volatility
|
||||
caused by gaps or limit moves.
|
||||
|
||||
Sources:
|
||||
|
||||
@@ -13,7 +13,7 @@ def massi(
|
||||
"""Mass Index (MASSI)
|
||||
|
||||
The Mass Index is a non-directional volatility indicator that
|
||||
utilitizes the High-Low Range to identify trend reversals based on
|
||||
utilizes the High-Low Range to identify trend reversals based on
|
||||
range expansions.
|
||||
|
||||
Sources:
|
||||
|
||||
@@ -33,7 +33,7 @@ def vwap(
|
||||
https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliases
|
||||
Default: "D".
|
||||
bands (list): List of deviations to be calculated. Calculates upper
|
||||
and lower values given a postive list of ints or floats.
|
||||
and lower values given a positive list of ints or floats.
|
||||
Default: []
|
||||
offset (int): How many periods to offset the result. Default: 0
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from pandas import DataFrame
|
||||
from .config import sample_data
|
||||
|
||||
|
||||
class TestCylesExtension(TestCase):
|
||||
class TestCyclesExtension(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.data = sample_data
|
||||
|
||||
@@ -79,7 +79,7 @@ class TestCandle(TestCase):
|
||||
self.assertEqual(result.name, "CDL_Z_30_1")
|
||||
|
||||
def test_ha(self):
|
||||
"""Candle: Heiken Ashi"""
|
||||
"""Candle: Heikin Ashi"""
|
||||
result = pandas_ta.ha(self.open, self.high, self.low, self.close)
|
||||
self.assertIsInstance(result, DataFrame)
|
||||
self.assertEqual(result.name, "Heikin-Ashi")
|
||||
|
||||
Reference in New Issue
Block a user