-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Problem with strategy (all) #466
Comments
Hello @hn2,
Index(['open', 'high', 'low', 'close', 'volume', 'SMA_10', 'SMA_20', 'SMA_50',
'SMA_200', 'VOL_SMA_20'],
Yes. This is the correct behavior for the Common Strategy (as defined below). These are the indicators used the be financial news media (CNBC, Bloomberg, et al...) You are welcome to submit more Builtin Strategies if you want to share with the community. Lines 92 to 110 in b92e45c
Could you please share reproducible code that was requested in the bug report? According to the Stack Trace, it is not a Pandas TA problem. The problem has to do with your "open" data type: Kind Regards, |
I believe that it has to do with the fact the pandas-ta candlestick patterns are build on top of ta-lib, and ta-lib is probably expecting a different data type. Could that be the reason for the error? |
I am still not sure how to resolve it though. I tried converting to nparray but it didn't work. |
class technical_features:
def __init__(self,
security,
open_name,
high_name,
low_name,
close_name,
volume_name):
open_price = security[open_name].values
high_price = security[high_name].values
low_price = security[low_name].values
close_price = security[close_name].values
security['open'] = np.array(open_price)
security['high'] = np.array(high_price)
security['low'] = np.array(low_price)
security['close'] = np.array(close_price)
print('Type')
print(type(security['open']))
def get_indicators_all(self):
security.ta.strategy('all')
print(security.columns)
print(security.ta.categories)
print(security)
return security |
The type is this: |
No. It's a Type Error as the stack trace says. Again, it is not a Pandas TA error. Thanks for sharing "some" code this time. Please share your input data or how you read your data in? Also please provide a small csv sample (around 300 rows should do). What type is Also, you shouldn't have to use either of these: open_price = security[open_name].values # This converts to numpy values
security['open'] = np.array(open_price) # This line is redundant Do you have import pandas as pd
import pandas_ta as ta
security = pd.DataFrame()
security = security.ta.ticker("aapl", period="1y")
security.ta.strategy(timed=True)
print(security)
print(security.columns) Would be interested in your output with the code I provided. Kind Regards, |
You code did not run for me. Same error: |
Screenshot? |
Is there anything in import pandas as pd
import pandas_ta as ta
security = pd.DataFrame()
security = security.ta.ticker("aapl", period="1y")
print(security)
print(security.dtypes) |
I closed visual code and reopened it. Restarted the kernal. I don't believe that there is anything in security. |
|
Also upgrade Pandas TA. $ pip install -U git+https://github.com/twopirllc/pandas-ta Has other bug fixes and new features. I am changing |
Your local environment could be corrupted... it happens sometimes. |
That wouldn't help. |
I am sorry solutions I have presented have not solved your issue.
I agree. I would recreate the local environment, usually solves most of my problems. Also time permitting, I am trying to implement numpy versions of TA Lib and hopefully the candles so TA Lib is optional.
Yes, I am sure. In fact, 62. KJ |
What version of TA-Lib are you using? |
Ok. I have an earlier version. I will try to install version 0.4.21 (right now it is giving me an error). |
I know. That's partly the reason this package exists. |
I upgraded my ta-lib. I now get this error: in get_indicators_all(self) ~\Anaconda3\lib\site-packages\pandas_ta\core.py in strategy(self, *args, **kwargs) ~\Anaconda3\lib\site-packages\pandas_ta\core.py in (.0) ~\Anaconda3\lib\site-packages\tqdm\std.py in iter(self) ~\Anaconda3\lib\multiprocessing\pool.py in (.0) ~\Anaconda3\lib\multiprocessing\pool.py in next(self, timeout) Exception: inputs are all NaN This is my data: open high low close volume |
I guess that the dataframe needs datetimeindex? |
@hn2,
No. The only indicator that requires it is: vwap. How come you use time invariant data?
import pandas as pd
import pandas_ta as ta
security = pd.DataFrame()
security = security.ta.ticker("aapl", period="1y")
vwap_ = ["vwap"] #
security.ta.strategy(exclude=vwap_, timed=True)
print(security)
print(security.columns)
# help(security.ta.strategy) # Documentation on the strategy method Also, since you are using Windows and strategy (which uses multiprocessing), you might get a Here are others ways to get help. I recommend reading Quick Start, Help and Issues. KJ |
Thank you |
Is there a way to easily exclude the entire volume group of indicators? |
Which version are you running? The lastest version is on Github. Pip is for major releases.
0.3.14b0
Do you have TA Lib also installed in your environment?
Yes
TA-Lib 0.4.17
Upgrade.
Describe the bug
When trying to add all indicators (ta.AllStrategy) to my dataframe I get:
As you can see it is probably due to cdl_pattern error.
When I switch to ta.CommonStrategy I get:
Index(['open', 'high', 'low', 'close', 'volume', 'SMA_10', 'SMA_20', 'SMA_50',
'SMA_200', 'VOL_SMA_20'],
I get 6 indicators(sma) added to my dataframe.
Is this the expected behavior? Only 6 common indicators?
The text was updated successfully, but these errors were encountered: