Skip to content

Commit

Permalink
BUG MAINT TST #779 pvi update
Browse files Browse the repository at this point in the history
  • Loading branch information
twopirllc committed Jun 11, 2024
1 parent 65768e7 commit fa7082b
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ $ pip install pandas_ta[full]

## Development Version

The _development_ version, _0.4.13b_, includes _numerous_ bug fixes, speed improvements and better documentation since release, _0.3.14b_.
The _development_ version, _0.4.14b_, includes _numerous_ bug fixes, speed improvements and better documentation since release, _0.3.14b_.

```sh
$ pip install -U git+https://github.com/twopirllc/pandas-ta.git@development
Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/overlap/sma.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def sma(
sma = SMA(close, length)
else:
np_close = close.to_numpy()
sma = np_sma(np_close, length)
sma = nb_sma(np_close, length)
sma = Series(sma, index=close.index)

# Offset
Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/overlap/ssf3.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def ssf3(

# Calculate
np_close = close.to_numpy()
ssf = np_ssf3(np_close, length, pi, sqrt3)
ssf = nb_ssf3(np_close, length, pi, sqrt3)
ssf = Series(ssf, index=close.index)

# Offset
Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/overlap/wma.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def wma(
wma = WMA(close, length)
else:
np_close = close.to_numpy()
wma_ = np_wma(np_close, length, asc, True)
wma_ = nb_wma(np_close, length, asc, True)
wma = Series(wma_, index=close.index)

# Offset
Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/trend/alphatrend.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def alphatrend(

np_upper_atr, np_lower_atr = upper_atr.to_numpy(), lower_atr.to_numpy()

at = np_alpha(np_lower_atr, np_upper_atr, momo.to_numpy() >= threshold)
at = nb_alpha(np_lower_atr, np_upper_atr, momo.to_numpy() >= threshold)
at = Series(at, index=close.index)

atl = at.shift(lag)
Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/trend/ht_trendline.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def ht_trendline(
tl = HT_TRENDLINE(close)
else:
np_close = close.to_numpy()
np_tl = np_ht_trendline(np_close)
np_tl = nb_ht_trendline(np_close)

if prenan > 0:
np_tl[:prenan] = nan
Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/trend/trendflex.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def trendflex(

# Calculate
np_close = close.to_numpy()
result = np_trendflex(np_close, length, smooth, alpha, pi, sqrt2)
result = nb_trendflex(np_close, length, smooth, alpha, pi, sqrt2)
result[:length] = nan
result = Series(result, index=close.index)

Expand Down
2 changes: 1 addition & 1 deletion pandas_ta/volatility/atrts.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def atrts(
ma_ = _ma(mamode, close, length=ma_length, talib=mode_tal)

np_close, np_ma, np_atr = close.to_numpy(), ma_.to_numpy(), atr_.to_numpy()
np_atrts_, _, _ = np_atrts(np_close, np_ma, np_atr, length, ma_length)
np_atrts_, _, _ = nb_atrts(np_close, np_ma, np_atr, length, ma_length)

percent = kwargs.pop("percent", False)
if percent:
Expand Down
8 changes: 5 additions & 3 deletions pandas_ta/volume/pvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@njit(cache=True)
def np_pvi(np_close, np_volume, initial):
def nb_pvi(np_close, np_volume, initial):
result = zeros_like(np_close, dtype=float64)
result[0] = initial

Expand Down Expand Up @@ -77,7 +77,7 @@ def pvi(

# Calculate
np_close, np_volume = close.to_numpy(), volume.to_numpy()
_pvi = np_pvi(np_close, np_volume, initial)
_pvi = nb_pvi(np_close, np_volume, initial)

pvi = Series(_pvi, index=close.index)
pvi_ma = ma(mamode, pvi, length=length)
Expand All @@ -102,7 +102,9 @@ def pvi(
pvi_ma.name = f"PVI{_props}"
pvi.category = pvi_ma.category = "volume"

data = { pvi.name: pvi, pvi_ma.name: pvi_ma }
data = { pvi.name: pvi}
if np_close.size > length + 1:
data[pvi_ma.name] = pvi_ma
df = DataFrame(data, index=close.index)

# Name and Category
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"pandas_ta.volatility",
"pandas_ta.volume"
],
version=".".join(("0", "4", "13b")),
version=".".join(("0", "4", "14b")),
description=long_description,
long_description=long_description,
author="Kevin Johnson",
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from pandas import read_csv

TEST_ROWS = 300
TEST_ROWS = 200
TEST_CSV = f"data/SPY_D.csv"

BEEP = False
Expand Down
6 changes: 3 additions & 3 deletions tests/test_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[pytest.param(ta.CommonStudy, id="common"), pytest.param(ta.AllStudy, id="all")]

# +/- when adding/removing indicators
ALL_COLUMNS = 325
ALL_COLUMNS = 323


def test_all_study_props(all_study):
Expand All @@ -33,7 +33,7 @@ def test_common_study_props(common_study):
@pytest.mark.parametrize("category,columns", [
("candles", 70), ("cycles", 2), ("momentum", 78), ("overlap", 56),
("performance", 2), ("statistics", 16), ("transform", 5), ("trend", 31),
("volatility", 36), ("volume", 29),
("volatility", 36), ("volume", 27),
pytest.param(ta.AllStudy, ALL_COLUMNS, id=f"all-{ALL_COLUMNS}"),
pytest.param(ta.CommonStudy, 5, id="common-5"),
])
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_study_custom_e_talib(df, custom_study_e, talib):

@pytest.mark.parametrize("talib", [False, True])
def test_study_all_multirun_talib(df, all_study, talib):
new_columns = 619 # +/- when adding/removing indicators
new_columns = 613 # +/- when adding/removing indicators
initial_columns = df.shape[1]
df.ta.study(all_study, length=10, cores=0, talib=talib)
df.ta.study(all_study, length=50, cores=0, talib=talib)
Expand Down

0 comments on commit fa7082b

Please sign in to comment.