Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for wrapper reference to Ulcer Index feature #204

Merged
merged 1 commit into from Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions ta/tests/wrapper.py
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
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