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

add_all_ta_features not installing due to bug on OnBalanceVolumeIndicator #336

Open
Zman67 opened this issue Jan 28, 2024 · 0 comments
Open

Comments

@Zman67
Copy link

Zman67 commented Jan 28, 2024

Code:
ta_all_indicators_df = ta.add_all_ta_features(ohlc[["open","high","low","close","volume"]], open="open", high="high",
low="low", close="close", volume="volume", fillna=True)

  • No NaNs or any other problems in the data
  • Python version 3.10.13 (latest by conda)
  • ta 0.11.0

Error:

File ~/anaconda3/envs/bayes5/lib/python3.10/site-packages/ta/wrapper.py:96, in add_volume_ta(df, high, low, close, volume, fillna, colprefix, vectorized)
91 df[f"{colprefix}volume_adi"] = AccDistIndexIndicator(
92 high=df[high], low=df[low], close=df[close], volume=df[volume], fillna=fillna
93 ).acc_dist_index()
95 # On Balance Volume
---> 96 df[f"{colprefix}volume_obv"] = OnBalanceVolumeIndicator(
97 close=df[close], volume=df[volume], fillna=fillna
98 ).on_balance_volume()
100 # Chaikin Money Flow
101 df[f"{colprefix}volume_cmf"] = ChaikinMoneyFlowIndicator(
102 high=df[high], low=df[low], close=df[close], volume=df[volume], fillna=fillna
103 ).chaikin_money_flow()

File ~/anaconda3/envs/bayes5/lib/python3.10/site-packages/ta/volume.py:83, in OnBalanceVolumeIndicator.init(self, close, volume, fillna)
81 self._volume = volume
82 self._fillna = fillna
---> 83 self._run()

File ~/anaconda3/envs/bayes5/lib/python3.10/site-packages/ta/volume.py:86, in OnBalanceVolumeIndicator._run(self)
85 def _run(self):
---> 86 obv = np.where(self._close < self._close.shift(1), -self._volume, self._volume)
87 self._obv = pd.Series(obv, index=self._close.index).cumsum()

File missing.pyx:392, in pandas._libs.missing.NAType.bool()

TypeError: boolean value of NA is ambiguous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant