Skip to content

Commit

Permalink
Merge pull request #204 from vinopm/master
Browse files Browse the repository at this point in the history
Bug fix for wrapper reference to Ulcer Index feature
  • Loading branch information
bukosabino authored Nov 17, 2020
2 parents 438bda4 + 6271093 commit 48ce4e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ta/tests/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ def test_general(self):
# Add all ta features not filling nans values
ta.add_all_ta_features(
df=df, open="Open", high="High", low="Low", close="Close", volume="Volume_BTC", fillna=False)

# Check added ta features are all numerical values after filling nans
input_cols = self._df.columns
df_with_ta = ta.add_all_ta_features(
df=df, open="Open", high="High", low="Low", close="Close", volume="Volume_BTC", fillna=True
)
ta_cols = [c for c in df_with_ta.columns if c not in input_cols]
assert df_with_ta[ta_cols].apply(lambda series: pd.to_numeric(series, errors='coerce')).notnull().all().all()
2 changes: 1 addition & 1 deletion ta/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def add_volatility_ta(df: pd.DataFrame, high: str, low: str, close: str,
df[f'{colprefix}volatility_dcp'] = indicator_dc.donchian_channel_pband()

# Ulcer Index
df[f'{colprefix}volatility_ui'] = UlcerIndex(close=df[close], n=14, fillna=fillna)
df[f'{colprefix}volatility_ui'] = UlcerIndex(close=df[close], n=14, fillna=fillna).ulcer_index()

return df

Expand Down

0 comments on commit 48ce4e7

Please sign in to comment.